feat(cloud-query): introduce MetricsLabelSearch functionality#3789
Conversation
- Add `MetricsLabelSearchInput`, `MetricsLabelSearchOptions`, and `AzureMetricsLabelSearchOptions` to support label search in metrics. - Implement `MetricsLabelSearchResult` and `MetricsLabelSearchOutput` for returning search outcomes. - Extend `ToolQuery` interface with `MetricsLabelSearch` method for querying metrics labels. - Update proto message indexes to accommodate new structures.
Soffi AI SummaryThis PR extends the What changed:
Commits
Updated: 2026-07-01 10:03 UTC |
Greptile SummaryThis PR introduces
Confidence Score: 5/5Safe to merge — all provider implementations are consistent, nil/empty guards are present, the shared output helper correctly deduplicates and limits results, and error paths follow existing conventions throughout the stack. The change is a clean additive feature with no modification of existing behavior. Each provider has input validation, the Azure client handles an empty metrics endpoint with its existing fallback, and the Dynatrace stub correctly signals unsupported operation. Generated protobuf code has consistent index updates. No logic errors or missing guard conditions were found. No files require special attention.
|
| Filename | Overview |
|---|---|
| go/cloud-query/api/proto/toolquery.proto | Added MetricsLabelSearchInput/Options/AzureMetricsLabelSearchOptions/Result/Output messages and MetricsLabelSearch RPC. Proto field numbers are correct and non-colliding. |
| go/cloud-query/internal/tools/metrics_label_search.go | New shared helper: deduplicates, substring-filters, sorts, and truncates label results to the requested limit. Clean and correct. |
| go/cloud-query/internal/tools/provider_prometheus.go | Added MetricsLabelSearch using Prometheus LabelNames/LabelValues APIs over a 24h window with metric-scoped match, filters name from label names results. |
| go/cloud-query/internal/tools/provider_cloudwatch.go | Added MetricsLabelSearch via ListMetrics with the new cloudwatchMetricIdentifier helper that correctly splits namespace/metric on last slash. Bounded to maxPages=6. |
| go/cloud-query/internal/tools/provider_azure.go | Added MetricsLabelSearch with three paths: Managed Prometheus delegate, native label names from metric definitions, and native label values from time-series metadata. Logic is consistent with existing Azure patterns. |
| go/cloud-query/internal/tools/provider_datadog.go | Added MetricsLabelSearch using Datadog v2 ListTagsByMetricName; extracts label names or values from indexed tags. Correct and consistent. |
| go/cloud-query/internal/tools/provider_dynatrace.go | MetricsLabelSearch stub returns ErrUnsupportedOperation as documented; consistent with feature matrix. |
| go/cloud-query/internal/service/toolquery.go | New MetricsLabelSearch gRPC handler validates nil input, connection, and non-empty metric before delegating to provider. Consistent with MetricsSearch pattern. |
| lib/console/ai/tools/workbench/observability/metrics_label_search.ex | New Elixir tool wrapping the gRPC call; correctly dispatches Azure options and delegates non-Azure connections to nil options. Schema selection based on azure prometheus_url is correct. |
| lib/console/ai/workbench/subagents/observability.ex | MetricsLabelSearch tool added alongside Metrics and MetricsSearch in to_tool/2 and plrl_metric_tools/1. Integration looks correct. |
| lib/console/ai/tools/workbench/observability/plrl_metrics_label_search.ex | Plural-native label search tool wrapping MetricsLabelSearch with the internal Prometheus connection. Straightforward delegation. |
| priv/tools/workbench/observability/metric_label_search.json | JSON schema for non-Azure label search: requires only metric, with optional query/label/limit fields. Correct and minimal. |
Reviews (2): Last reviewed commit: "feat(cloud-query): introduce MetricsLabe..." | Re-trigger Greptile
|
@greptileai |
|
plural deploy to dev |
…tions - Replace direct token assignment with inline `new` keyword for PrometheusConnection. - Streamline metric query options by using `new()` for StartTime, EndTime, and Interval values.
MetricsLabelSearchInput,MetricsLabelSearchOptions, andAzureMetricsLabelSearchOptionsto support label search in metrics.MetricsLabelSearchResultandMetricsLabelSearchOutputfor returning search outcomes.ToolQueryinterface withMetricsLabelSearchmethod for querying metrics labels.Test Plan
Test environment: https://console.plrl-dev-aws.onplural.sh/
Checklist
Plural Flow: console