Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTAdmin: Workflow status endpoint #16587

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

beingnoble03
Copy link
Member

@beingnoble03 beingnoble03 commented Aug 12, 2024

Description

Currently, VTAdmin misses out on workflow status endpoint. This endpoint is important for fetching/monitoring the progress of the workflow.

Example: http://localhost:14200/api/workflow_status/local/customer/commerce2customer

{
  "result": {
    "shard_streams": {
      "customer/0": {
        "streams": [
          {
            "id": 1,
            "tablet": {
              "cell": "zone1",
              "uid": 201
            },
            "source_shard": "commerce/0",
            "position": "6d7be442-5964-11ef-8add-2ccc79fa7a75:1-54",
            "status": "Running",
            "info": "VStream Lag: 0s"
          }
        ]
      }
    },
    "traffic_state": "Reads Not Switched. Writes Not Switched"
  },
  "ok": true
}

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

@github-actions github-actions bot added this to the v21.0.0 milestone Aug 12, 2024
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 4.16667% with 23 lines in your changes missing coverage. Please review.

Project coverage is 68.78%. Comparing base (0b7c0e4) to head (f865ef7).
Report is 31 commits behind head on main.

Files Patch % Lines
go/vt/vtadmin/api.go 6.25% 15 Missing ⚠️
go/vt/vtadmin/http/workflows.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #16587    +/-   ##
========================================
  Coverage   68.78%   68.78%            
========================================
  Files        1556     1557     +1     
  Lines      199803   199915   +112     
========================================
+ Hits       137429   137511    +82     
- Misses      62374    62404    +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@beingnoble03 beingnoble03 added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VTAdmin VTadmin interface labels Aug 12, 2024
Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I just had one comment about the API endpoint.

I tested the current endpoint locally and added the url/output to the description.

@@ -417,6 +417,7 @@ func (api *API) Handler() http.Handler {
router.HandleFunc("/vtexplain", httpAPI.Adapt(vtadminhttp.VTExplain)).Name("API.VTExplain")
router.HandleFunc("/workflow/{cluster_id}/{keyspace}/{name}", httpAPI.Adapt(vtadminhttp.GetWorkflow)).Name("API.GetWorkflow")
router.HandleFunc("/workflows", httpAPI.Adapt(vtadminhttp.GetWorkflows)).Name("API.GetWorkflows")
router.HandleFunc("/workflow_status/{cluster_id}/{keyspace}/{name}", httpAPI.Adapt(vtadminhttp.GetWorkflowStatus)).Name("API.GetWorkflowStatus")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably do this like
/workflow/{cluster_id}/{keyspace}/{name}/status similar to the keyspace APIs, for example:

        router.HandleFunc("/keyspace/{cluster_id}", httpAPI.Adapt(vtadminhttp.CreateKeyspace)).Name("API.CreateKeyspace").Methods("POST")
	router.HandleFunc("/keyspace/{cluster_id}/{name}", httpAPI.Adapt(vtadminhttp.DeleteKeyspace)).Name("API.DeleteKeyspace").Methods("DELETE")
	router.HandleFunc("/keyspace/{cluster_id}/{name}", httpAPI.Adapt(vtadminhttp.GetKeyspace)).Name("API.GetKeyspace")
	router.HandleFunc("/keyspace/{cluster_id}/{name}/rebuild_keyspace_graph", httpAPI.Adapt(vtadminhttp.RebuildKeyspaceGraph)).Name("API.RebuildKeyspaceGraph").Methods("PUT", "OPTIONS")
	router.HandleFunc("/keyspace/{cluster_id}/{name}/remove_keyspace_cell", httpAPI.Adapt(vtadminhttp.RemoveKeyspaceCell)).Name("API.RemoveKeyspaceCell").Methods("PUT", "OPTIONS")
	router.HandleFunc("/keyspace/{cluster_id}/{name}/validate", httpAPI.Adapt(vtadminhttp.ValidateKeyspace)).Name("API.ValidateKeyspace").Methods("PUT", "OPTIONS")
	router.HandleFunc("/keyspace/{cluster_id}/{name}/validate/schema", httpAPI.Adapt(vtadminhttp.ValidateSchemaKeyspace)).Name("API.ValidateSchemaKeyspace").Methods("PUT", "OPTIONS")
	router.HandleFunc("/keyspace/{cluster_id}/{name}/validate/version", httpAPI.Adapt(vtadminhttp.ValidateVersionKeyspace)).Name("API.ValidateVersionKeyspace").Methods("PUT", "OPTIONS")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense! done.

Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

Copy link
Contributor

@notfelineit notfelineit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. So excited to see more workflow stuff in VTAdmin 😄

@rohit-nayak-ps rohit-nayak-ps merged commit 81ed314 into vitessio:main Aug 23, 2024
132 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VTAdmin VTadmin interface Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants