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

ResolveCanvas API #6390

Merged
merged 3 commits into from
Jan 13, 2025
Merged

ResolveCanvas API #6390

merged 3 commits into from
Jan 13, 2025

Conversation

begelundmuller
Copy link
Contributor

@begelundmuller begelundmuller commented Jan 10, 2025

This PR introduces a new API ResolveCanvas. It is a single convenience API, which is equivalent to separately:

  1. Calling GetResource to get the canvas
  2. Then calling ResolveComponent for each of the canvas's components
  3. Then calling GetResource to lookup the metrics view(s) referenced by each of the components

The type signature for the API is:

// ResolveCanvas is a convenience API that returns a canvas and all its referenced components and metrics views.
rpc ResolveCanvas(ResolveCanvasRequest) returns (ResolveCanvasResponse) {
  option (google.api.http) = {
    post: "/v1/instances/{instance_id}/queries/canvases/{canvas}/resolve",
    body: "*"
  };
}

message ResolveCanvasRequest {
  // Instance ID
  string instance_id = 1;
  // Canvas name
  string canvas = 2;
  // Optional args for resolving templating in the component properties
  google.protobuf.Struct args = 3;
}

message ResolveCanvasResponse {
  // The canvas resource.
  Resource canvas = 1;
  // All the component resources referenced by the canvas.
  // The resources state.valid_spec.renderer_properties will have templating resolved for the provided args.
  // (Corresponds to calling the ResolveComponent API for each component referenced in the canvas spec).
  map<string, Resource> resolved_components = 2;
  // All the metrics view resources referenced in the components' renderer_properties.metrics_view field.
  map<string, Resource> referenced_metrics_views = 3;
}

Closes #6364

@begelundmuller begelundmuller self-assigned this Jan 10, 2025
@begelundmuller begelundmuller requested review from k-anshul and AdityaHegde and removed request for k-anshul January 10, 2025 17:02
@begelundmuller begelundmuller merged commit 231ef2e into main Jan 13, 2025
10 checks passed
@begelundmuller begelundmuller deleted the begelundmuller/resolve-canvas-api branch January 13, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unified API for resolving a canvas and its components
2 participants