fix(mcp): resolve attribute scope and explain empty results - #1227
Conversation
…and service-scoped keys Traces breakdowns and timeseries can now group by a ResourceAttributes key (filters.groupByResourceAttributeKey). Metric breakdowns apply the service, environment and datapoint attribute filters they used to drop, so filtering and grouping on the same label narrows the result. A metric attribute filter without a value means exists, not equals the empty string. span/resource attribute key and value discovery honors service_name by sampling that service's raw spans (the hourly rollup has no ServiceName). Root trace rows carry deployment environment and service.version, and span_search accepts a deployment_env filter.
query_data resolves attribute_key against span (or log/metric label) keys, then resource keys, so deployment.environment or k8s.pod.name filter and group instead of returning nothing; attribute_scope overrides. Traces accept group_by=resource_attribute, metrics stop collapsing it to service, and a value filter on the grouped key is kept. Logs take attribute and environment filters, metrics take environments. span_name falls back to a case-insensitive substring when nothing matches exactly. An empty result carries did-you-mean hints for the service, environment, attribute key and span name (shared helper). Trace counts are rounded and labelled as sample-weighted estimates; durations are labelled as unweighted.
…mpty results search_traces takes an environment filter, matches a resource attribute (k8s.pod.name=...) when attribute_key resolves to one, and its root rows carry deployment.environment and service.version. find_errors, search_logs, search_traces and list_error_issues add hints on an empty result when the service, environment or attribute key does not exist, naming close matches. explore_attributes notes that service-scoped key counts come from a sample.
Simple widgets rejected group_by=service with "Valid: service.name, span.name" while query_data uses service/span_name. A small alias map translates the query_data tokens to the builder ones when valid for the widget's source.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (35)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Maple review🔴 Confidence 2/5 · risky as written Warning This review ended early; what follows is what it established. Makes
Findings🟠 Warning · F1 · Capped environment list is reported to the agent as completecorrectness ·
🤖 Prompt to fix this finding with an AI agentWhat was checked
Observability coverage: 0 of 2 changes observable
Files not reviewed (6)The review ended before it read these diffs, so nothing above vouches for them.
|
services_facets caps environments at 50 rows like services, so absence from that list no longer produces a "not seen in this window" hint. The create_dashboard group_by alias table is a Map so it keeps its known entries instead of widening to an open dictionary.
Maple review🟡 Confidence 3/5 · needs attention Warning This review ended early; what follows is what it established. Adds "did you mean" empty-result hints across the MCP tools, auto-resolves attribute scope, accepts query_data group_by spellings in create_dashboard, and changes query-engine group-by/filter handling for resource attributes. The MCP surface is reasonable, but the hint lookups hide their own failures.
Findings🔵 Note · F2 ·
|
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| emptyResultHints warehouse lookups (services_facets, attribute keys, span-name breakdown) | outbound database query | no | Effect.withSpan("McpTool.emptyResultHints") at empty-result-hints.ts:92; the individual lookups carry no Client span attributes of their own |
| emptyResultHints failure fallback | error path | no | soft() = Effect.orElseSucceed at empty-result-hints.ts:78 turns any lookup failure into {} with no log or span event |
6ecdd21 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one. Check ids refer to Maple's instrumentation audit.
|
Note A newer push replaced |
|
Note A newer push replaced |
Maple review🟡 Confidence 3/5 · needs attention Warning This review ended early; what follows is what it established. Resolves
Still open from earlier reviews
What was checked
Observability coverage: 3 of 3 changes observable
Files not reviewed (1)The review ended before it read these diffs, so nothing above vouches for them.
|
What
attribute_keyagainst span then resource attributes (orattribute_scope), for filters and group-by. Resource keys likedeployment.environment,vcs.ref.head.revision,k8s.pod.namereturned empty or zeros before.group_by: resource_attributereturning service names on metrics, and the attribute filter being dropped when grouping by the same key.group_by: resource_attribute; logs get attribute filters;environmentsapplies to logs and metrics.environmentfilter, and rows carry deployment.environment and service.version.service_namefor key listings (sampled from the service's spans).Tests
query-engine metrics, attribute-keys, traces, pipe-dispatch, catalog(+baseline); apps/ai filter-suggestions, query-data, create-dashboard (new), registry(.contract), query-spec-tokens; apps/ai typecheck.