Skip to content

Commit

Permalink
Add VTAdmin integration
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Feb 18, 2025
1 parent 4d0d779 commit b5af7a5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
18 changes: 15 additions & 3 deletions go/vt/proto/vtctldata/vtctldata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion go/vt/vtadmin/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ type FindWorkflowsOptions struct {
ActiveOnly bool
IgnoreKeyspaces sets.Set[string]
Filter func(workflow *vtadminpb.Workflow) bool
VerbosityLevel vtctldatapb.VerbosityLevel
IncludeLogs bool
}

// FindWorkflows returns a list of Workflows in this cluster, across the given
Expand Down Expand Up @@ -759,6 +761,8 @@ func (c *Cluster) findWorkflows(ctx context.Context, keyspaces []string, opts Fi
span.Annotate("keyspaces", strings.Join(keyspaces, ","))
span.Annotate("num_ignore_keyspaces", opts.IgnoreKeyspaces.Len())
span.Annotate("ignore_keyspaces", strings.Join(sets.List(opts.IgnoreKeyspaces), ","))
span.Annotate("include_logs", opts.IncludeLogs)
span.Annotate("verbosity_level", opts.VerbosityLevel.String())
}

clusterpb := c.ToProto()
Expand Down Expand Up @@ -799,7 +803,8 @@ func (c *Cluster) findWorkflows(ctx context.Context, keyspaces []string, opts Fi
resp, err := c.Vtctld.GetWorkflows(ctx, &vtctldatapb.GetWorkflowsRequest{
Keyspace: ks,
ActiveOnly: opts.ActiveOnly,
IncludeLogs: true,
IncludeLogs: opts.IncludeLogs,
Verbosity: opts.VerbosityLevel,
})
c.workflowReadPool.Release()

Expand Down Expand Up @@ -2023,6 +2028,8 @@ func (c *Cluster) GetWorkflow(ctx context.Context, keyspace string, name string,
Filter: func(workflow *vtadminpb.Workflow) bool {
return workflow.Workflow.Name == name
},
VerbosityLevel: vtctldatapb.VerbosityLevel_HIGH,
IncludeLogs: true,
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -2067,6 +2074,8 @@ func (c *Cluster) GetWorkflows(ctx context.Context, keyspaces []string, opts Get
ActiveOnly: opts.ActiveOnly,
IgnoreKeyspaces: opts.IgnoreKeyspaces,
Filter: func(_ *vtadminpb.Workflow) bool { return true },
IncludeLogs: false,
VerbosityLevel: vtctldatapb.VerbosityLevel_LOW,
})
}

Expand Down
12 changes: 12 additions & 0 deletions proto/vtctldata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,10 @@ enum VerbosityLevel {
HIGH = 3;
}

// NOTE: if you want to get all information about a workflow, you must
// set the VerbosityLevel to HIGH. Otherwise certain fields will be
// set to the type's Zero value and should be elided when displaying
// results built from the GetWorkflowsResponse.
message GetWorkflowsRequest {
string keyspace = 1;
bool active_only = 2;
Expand All @@ -1211,9 +1215,17 @@ message GetWorkflowsRequest {
string workflow = 4;
bool include_logs = 5;
repeated string shards = 6;
// How much info to return. Note that values are elided simply by
// not setting the field in the response. So you're not guaranteed
// to see any particular value in the response unless you set the
// VerbosityLevel to HIGH so that everything is included/set.
VerbosityLevel verbosity = 7;
}

// NOTE: if you want to get all information about a workflow, you must
// set the VerbosityLevel to HIGH in the GetWorkflowsRequest. Otherwise
// certain fields will be set to the type's Zero value in the response
// and should be elided when displaying results from the response.
message GetWorkflowsResponse {
repeated Workflow workflows = 1;
}
Expand Down

0 comments on commit b5af7a5

Please sign in to comment.