From 434a85fb740365d2cf79f7e111c7c87dc7854abc Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Sat, 17 Oct 2026 11:13:03 -0700 Subject: [PATCH] fix(mcp): show slow operations for every protocol in service performance The service performance preset grouped its slow-endpoint table by http_route and kept only rows with a route. gRPC servers and message consumers have no HTTP route, so for services such as checkout and fraud-detection in the OpenTelemetry Demo the panel was always empty, and chat opened it as a large empty box. The panel is now "Slow operations": p95 duration by operation over the spans a service handles (server and consumer spans). HTTP, gRPC and consumer spans each name the operation, so one query covers all three. When several filters combine to match nothing, the empty-state diagnosis now names the combination instead of blaming one filter that matches rows on its own. Claude-Session: https://claude.ai/code/session_018HfyEXHyGD1utmKF4CQtyQ --- internal/agent/runtime.go | 2 +- internal/mcp/fragments.go | 4 +- internal/mcp/fragments_test.go | 14 +-- internal/mcp/performance_operations_test.go | 102 ++++++++++++++++++ internal/mcp/server.go | 6 +- internal/panel/diagnose.go | 11 +- internal/panel/diagnose_regression_test.go | 42 +++++++- site/src/content/docs/reference/mcp-tools.mdx | 4 +- .../dashboards/fragment-interactions.test.tsx | 2 +- ui/host/src/dashboards/fragment-view.test.tsx | 4 +- ui/host/tests/fixtures.ts | 2 +- ui/host/tests/go-fragments/performance.json | 18 ++-- .../go-fragments/performance.summary.txt | 4 +- 13 files changed, 179 insertions(+), 36 deletions(-) create mode 100644 internal/mcp/performance_operations_test.go diff --git a/internal/agent/runtime.go b/internal/agent/runtime.go index c91a1a05f..676ae1e4a 100644 --- a/internal/agent/runtime.go +++ b/internal/agent/runtime.go @@ -25,7 +25,7 @@ import ( "github.com/labstack/fanout/internal/toolerror" ) -const systemPrompt = `You are Fanout's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_observability_overview first for broad health questions, get_intelligence_snapshot for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/endpoints/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or explain every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, keep its panel and say why in the panel description instead of dropping it. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, or internal execution steps. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance +const systemPrompt = `You are Fanout's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_observability_overview first for broad health questions, get_intelligence_snapshot for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/operations/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or explain every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, keep its panel and say why in the panel description instead of dropping it. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, or internal execution steps. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance const dashboardAnalysisGuidance = ` For analysis dashboards, use only the types the question needs; do not fill a dashboard with all of them. Use heatmap for latency changes, histogram for distributions, scatter for relationships, state_timeline for threshold states, logs for events, log_patterns for repeated messages, traces for slow or erroring traces, service_map for dependencies, and health for service health. Use drill for span or log evidence; keep checked filters. Include annotations for change investigations; deploys and detector findings do not prove causes. Use a deploy split for scoped before/since comparisons; retain missing-deploy explanations. A definition, explanation, or single fact is an answer intent; do not create or replace a dashboard for it. Preserve every requested facet and explain absent telemetry without inventing it. Saved panels must keep working as new telemetry arrives: never filter on trace, span or request IDs or other values copied from one result; show recent evidence with a traces panel and drill to its logs. In replies, never name schema fields to the user. Explain in chat is answer intent: use the observed absolute panel window and resolved variables, explain errors and suggest corrections without creating, editing, replacing or restoring dashboards.` diff --git a/internal/mcp/fragments.go b/internal/mcp/fragments.go index feb704321..d912f0eb1 100644 --- a/internal/mcp/fragments.go +++ b/internal/mcp/fragments.go @@ -197,8 +197,8 @@ func fragmentPreset(kind, service, namespace, severity, search string, limit int add("latency", "p95 latency", "timeseries", "spans", "p95(duration_ms)", "ms", nil, "auto") add("errors", "Error rate", "timeseries", "spans", "error_rate()", "percent", nil, "auto") add("requests", "Request rate", "timeseries", "spans", "rate()", "per_second", nil, "auto") - add("endpoints", "Slow endpoints", "table", "spans", "p95(duration_ms)", "ms", []string{"http_route"}, "") - d.Panels[len(d.Panels)-1].Query.Where = append(d.Panels[len(d.Panels)-1].Query.Where, "http_route <> ''") + add("operations", "Slow operations", "table", "spans", "p95(duration_ms)", "ms", []string{"operation"}, "") + d.Panels[len(d.Panels)-1].Query.Where = append(d.Panels[len(d.Panels)-1].Query.Where, "kind IN ('SPAN_KIND_SERVER','SPAN_KIND_CONSUMER')") case "logs": if severity != "" { filters = append(filters, "severity = "+literal(severity)) diff --git a/internal/mcp/fragments_test.go b/internal/mcp/fragments_test.go index 440b5a5e0..c9242feea 100644 --- a/internal/mcp/fragments_test.go +++ b/internal/mcp/fragments_test.go @@ -247,7 +247,7 @@ func TestFragmentVarsRoundTripAndAppHelpers(t *testing.T) { } } -func TestFragmentPresetsExecutedSummariesAndEndpointScope(t *testing.T) { +func TestFragmentPresetsExecutedSummariesAndOperationScope(t *testing.T) { s := panelServerFixture(t, true) for _, name := range []string{"overview", "performance", "topology", "logs", "trace"} { content, f, err := s.presetFragment(t.Context(), QueryInput{Namespace: "shop"}, name, "checkout", "ERROR", "timeout") @@ -261,25 +261,25 @@ func TestFragmentPresetsExecutedSummariesAndEndpointScope(t *testing.T) { if r.Status == panel.StatusError { t.Fatalf("%s: %+v", name, r) } - if r.ID == "endpoints" { + if r.ID == "operations" { if r.Frame == nil { - t.Fatal("missing endpoints frame") + t.Fatal("missing operations frame") } cart := false for c, col := range r.Frame.Columns { - if col.Name == "http_route" { + if col.Name == "operation" { for _, value := range r.Frame.Values[c] { - if value == "/cart" { + if value == "GET cart" { cart = true } if value == "" { - t.Fatal("empty route included") + t.Fatal("unexpected empty operation") } } } } if !cart { - t.Fatal("missing /cart endpoint") + t.Fatal("missing GET cart operation") } } } diff --git a/internal/mcp/performance_operations_test.go b/internal/mcp/performance_operations_test.go new file mode 100644 index 000000000..8d042f2ac --- /dev/null +++ b/internal/mcp/performance_operations_test.go @@ -0,0 +1,102 @@ +package mcp + +import ( + "fmt" + "reflect" + "testing" + "time" + + "github.com/labstack/fanout/internal/config" + "github.com/labstack/fanout/internal/panel" + "github.com/labstack/fanout/internal/query" + "github.com/labstack/fanout/internal/telemetry" + telemetrystore "github.com/labstack/fanout/internal/telemetry/store" +) + +func TestPerformanceSlowOperationsAcrossProtocols(t *testing.T) { + cfg := config.Config{DataDir: t.TempDir(), DuckDBMemory: "256MB", DuckDBThreads: 2, DuckDBMaxConns: 4, RollupInterval: time.Hour} + repo, err := telemetrystore.Open(cfg.TelemetryDir()) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = repo.Close() }) + duck, err := query.NewDuck(t.Context(), cfg, repo) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = duck.Close() }) + from := time.Date(2026, 10, 1, 12, 0, 0, 0, time.UTC) + to := from.Add(time.Hour) + cases := []struct{ protocol, service, kind, slow, fast, route string }{ + {"grpc", "checkout", "SPAN_KIND_SERVER", "CheckoutService/PlaceOrder", "CheckoutService/GetCart", ""}, + {"kafka", "fraud-detection", "SPAN_KIND_CONSUMER", "orders process", "refunds process", ""}, + {"http", "frontend", "SPAN_KIND_SERVER", "GET /cart", "GET /health", "/cart"}, + } + var spans []telemetry.Span + add := func(namespace, service, operation, kind, route string, ms float64) { + n := from.Add(time.Minute).UnixNano() + id := fmt.Sprintf("span-%d", len(spans)) + spans = append(spans, telemetry.Span{ + Namespace: namespace, ServiceName: service, TraceID: id, SpanID: id, + Name: operation, Kind: kind, HTTPRoute: route, DurationMS: ms, + StartUnixNanos: n, EndUnixNanos: n + int64(ms*1e6), IngestedAt: n, + }) + } + for _, tc := range cases { + for _, ms := range []float64{100, 300} { + add("shop", tc.service, tc.slow, tc.kind, tc.route, ms) + } + for _, ms := range []float64{20, 40} { + add("shop", tc.service, tc.fast, tc.kind, tc.route, ms) + } + for _, kind := range []string{"SPAN_KIND_CLIENT", "SPAN_KIND_INTERNAL", "SPAN_KIND_PRODUCER"} { + // Excluded kinds must neither create groups nor inflate a handled + // operation's p95. Even an HTTP route must not admit these spans. + add("shop", tc.service, "excluded "+kind, kind, "/outbound", 10000) + add("shop", tc.service, tc.fast, kind, tc.route, 10000) + } + add("other", tc.service, "other namespace", tc.kind, tc.route, 10000) + } + if err := repo.Commit(t.Context(), telemetrystore.Batch{ID: "operations", Spans: spans}); err != nil { + t.Fatal(err) + } + s := &Server{panels: panel.NewExecutor(duck, 30)} + for _, tc := range cases { + t.Run(tc.protocol, func(t *testing.T) { + for _, limit := range []int{0, 1} { + _, out, err := s.performance(t.Context(), nil, PerformanceInput{Service: tc.service, Namespace: "shop", From: &from, To: &to, Limit: limit}) + if err != nil { + t.Fatal(err) + } + p := out.Dashboard.Panels[3] + if p.ID != "operations" || p.Title != "Slow operations" || p.Viz != "table" || p.Unit != "ms" || p.Drill != "traces" || !reflect.DeepEqual(p.Query.By, []string{"operation"}) { + t.Fatalf("operations panel = %+v", p) + } + wantLimit := 400 + if limit > 0 { + wantLimit = limit + } + if p.Query.Limit != wantLimit { + t.Fatalf("limit = %d, want %d", p.Query.Limit, wantLimit) + } + r := out.Results[3] + wantOperations := []any{tc.slow, tc.fast} + wantP95 := []float64{290, 39} + if limit > 0 { + wantOperations, wantP95 = wantOperations[:limit], wantP95[:limit] + } + if r.ID != "operations" || r.Status != panel.StatusOK || r.Frame == nil || r.Frame.Rows != len(wantOperations) { + t.Fatalf("operations result = %+v", r) + } + if len(r.Frame.Columns) != 2 || r.Frame.Columns[0].Name != "operation" || r.Frame.Columns[1].Name != "p95" || !reflect.DeepEqual(r.Frame.Values[0], wantOperations) { + t.Fatalf("operations frame = %+v, want %v / %v", r.Frame, wantOperations, wantP95) + } + for i, want := range wantP95 { + if got := numeric(r.Frame.Values[1][i]); got != want { + t.Errorf("%s p95 = %v, want %v", wantOperations[i], got, want) + } + } + } + }) + } +} diff --git a/internal/mcp/server.go b/internal/mcp/server.go index ce62eb274..b3a4a24aa 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -28,7 +28,7 @@ const ProtocolVersion = "2026-07-28" const staticCatalogTTLMs = 5 * 60 * 1000 -const serverInstructions = "Start with get_observability_overview for system health, use get_intelligence_snapshot for the latest precomputed anomalies and log patterns, get_service_topology for direct dependency edges (use this preset once for a service map; do not repeat the same map with query_telemetry), get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for latency and errors, inspect_trace for one trace, and search_logs for application events. Treat schema, timestamps, provenance, and bounded time windows as authoritative. Dashboard tools are scoped to the authenticated user. For a custom chart in chat, use query_telemetry with one v1 panel; every chart view returns a dashboard fragment rendered by the shared panel renderer. To build a dashboard, read get_telemetry_schema, draft panels, run preview_panels until every panel is ok or deliberately empty, then create_dashboard. To change one, get_dashboard first and use edit_dashboard; replace only for a redesign the user asked for." +const serverInstructions = "Start with get_observability_overview for system health, use get_intelligence_snapshot for the latest precomputed anomalies and log patterns, get_service_topology for direct dependency edges (use this preset once for a service map; do not repeat the same map with query_telemetry), get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for latency, errors and slow operations across HTTP, gRPC and consumers, inspect_trace for one trace, and search_logs for application events. Treat schema, timestamps, provenance, and bounded time windows as authoritative. Dashboard tools are scoped to the authenticated user. For a custom chart in chat, use query_telemetry with one v1 panel; every chart view returns a dashboard fragment rendered by the shared panel renderer. To build a dashboard, read get_telemetry_schema, draft panels, run preview_panels until every panel is ok or deliberately empty, then create_dashboard. To change one, get_dashboard first and use edit_dashboard; replace only for a redesign the user asked for." type Observability interface { Dependencies(context.Context, observability.Scope, observability.DependencyOptions) (observability.Result[observability.Dependencies], error) @@ -62,7 +62,7 @@ type PerformanceInput struct { Window string `json:"window,omitempty" jsonschema:"Time window such as 15m, 1h, 24h, 168h, or 720h; defaults to 1h"` Namespace string `json:"namespace,omitempty" jsonschema:"OpenTelemetry service namespace; empty queries all namespaces"` Service string `json:"service,omitempty" jsonschema:"Optional exact OpenTelemetry service name; omit for the whole system"` - Limit int `json:"limit,omitempty" jsonschema:"Maximum endpoints to return, from 1 to 500"` + Limit int `json:"limit,omitempty" jsonschema:"Maximum operations to return, from 1 to 500"` } type TraceInput struct { @@ -349,7 +349,7 @@ func (s *Server) registerTools() { fragmentTool(s, &mcp.Tool{ Name: "get_service_performance", Title: "Service performance explorer", - Description: "Display separate latency, error rate and request rate panels plus slow endpoints for one service or the system.", + Description: "Display separate latency, error rate and request rate panels plus slow operations (HTTP, gRPC and consumers) for one service or the system.", Annotations: readOnly, Meta: appToolMeta(panelsAppURI), }, s.performance) diff --git a/internal/panel/diagnose.go b/internal/panel/diagnose.go index e1e306c42..f6b8ee26b 100644 --- a/internal/panel/diagnose.go +++ b/internal/panel/diagnose.go @@ -15,8 +15,8 @@ const maxDiagnosedFilters = 8 // diagnose explains an empty structured panel. It counts the signal in the // window, then reruns the count with each of the first maxDiagnosedFilters // filters removed in turn. The filter whose removal recovers the most rows is -// named, with the values seen for its field when it was an equality. Ties -// keep the author's filter order. +// named in the context of the active combination, with the values seen for its +// field when it was an equality. Ties keep the author's filter order. func (e *Executor) diagnose(ctx context.Context, p *Panel, filters []Filter, scope Scope) string { if p.Query == nil { return "The query returned no rows for this time range." @@ -78,6 +78,13 @@ func (e *Executor) diagnose(ctx context.Context, p *Panel, filters []Filter, sco f := active[best] others := append(append([]Filter{}, active[:best]...), active[best+1:]...) message := fmt.Sprintf("No %s match %s. Without that filter, %d do.", sig.name, f.Source, recovered) + if len(active) > 1 { + var sources []string + for _, filter := range active { + sources = append(sources, "("+filter.Source+")") + } + message = fmt.Sprintf("No %s match the combination of filters: %s. Without %s, %d match the remaining filters.", sig.name, strings.Join(sources, " AND "), f.Source, recovered) + } if f.EqField != "" { if seen := e.topValues(ctx, sig, f.EqField, others, scope); seen != "" { message += " Values seen: " + seen + "." diff --git a/internal/panel/diagnose_regression_test.go b/internal/panel/diagnose_regression_test.go index 39a5449b4..14fd0f674 100644 --- a/internal/panel/diagnose_regression_test.go +++ b/internal/panel/diagnose_regression_test.go @@ -65,14 +65,45 @@ func TestDiagnosisNamesOnlyEmptyingRouteFilter(t *testing.T) { t.Fatal(err) } r := results[0] - if r.Status != "empty" || !strings.Contains(r.Diagnosis, "match http_route <> ''. Without that filter, 120 do.") { + if r.Status != "empty" || !strings.Contains(r.Diagnosis, "Without http_route <> '', 120 match the remaining filters.") { t.Fatalf("result = %+v", r) } - if strings.Contains(r.Diagnosis, "match service = $service") { + if strings.Contains(r.Diagnosis, "Without service = $service") { t.Fatalf("wrong filter blamed: %s", r.Diagnosis) } } +func TestDiagnosisReportsCombinationWhenEachFilterMatchesAlone(t *testing.T) { + engine, repo := newTestEngine(t) + n := fixtureStart.UnixNano() + commit(t, repo, []telemetry.Span{ + {ServiceName: "checkout", Kind: "SPAN_KIND_SERVER", Name: "PlaceOrder", StartUnixNanos: n, EndUnixNanos: n + 1, IngestedAt: n}, + {ServiceName: "fraud-detection", Kind: "SPAN_KIND_CONSUMER", Name: "orders process", StartUnixNanos: n, EndUnixNanos: n + 1, IngestedAt: n}, + }, nil) + e := NewExecutor(engine, 30) + e.now = func() time.Time { return fixtureStart.Add(time.Hour) } + service, kind := "service = 'checkout'", "kind = 'SPAN_KIND_CONSUMER'" + d := Dashboard{Name: "Diagnosis", Time: Time{Range: "1h"}} + for i, where := range [][]string{{service}, {kind}, {service, kind}} { + d.Panels = append(d.Panels, Panel{ID: fmt.Sprintf("p%d", i), Title: "Spans", Viz: "table", Query: &Query{From: "spans", Measures: []string{"count()"}, By: []string{"service"}, Where: where}}) + } + results, err := e.Run(t.Context(), RunRequest{Dashboard: d}) + if err != nil { + t.Fatal(err) + } + for _, r := range results[:2] { + if r.Status != StatusOK || r.Frame == nil || r.Frame.Rows != 1 { + t.Fatalf("filter alone should match: %+v", r) + } + } + // Removing either filter recovers a row. Author order breaks the tie, + // but checkout is present, so the diagnosis must name the combination. + want := "No spans match the combination of filters: (service = 'checkout') AND (kind = 'SPAN_KIND_CONSUMER'). Without service = 'checkout', 1 match the remaining filters. Values seen: fraud-detection (1)." + if r := results[2]; r.Status != StatusEmpty || r.Diagnosis != want { + t.Fatalf("result = %+v, want diagnosis %q", r, want) + } +} + func TestDiagnosisChoosesMostSelectiveQualifyingFilter(t *testing.T) { e := newFixtureExecutor(t) d := shopDashboard() @@ -83,7 +114,10 @@ func TestDiagnosisChoosesMostSelectiveQualifyingFilter(t *testing.T) { if err != nil { t.Fatal(err) } - if r := results[0]; r.Status != "empty" || !strings.Contains(r.Diagnosis, "match http_route = '/api/cart'. Without that filter, 120 do.") { + want := "No spans match the combination of filters: (service = $service) AND (http_route = '/api/cart'). Without http_route = '/api/cart', 120 match the remaining filters. Values seen: /cart (60), /quote (60)." + // Each filter alone matches spans: checkout has 120 and /api/cart has + // 60. Only their combination is empty; neither filter is absent globally. + if r := results[0]; r.Status != StatusEmpty || r.Diagnosis != want { t.Fatalf("result = %+v", r) } } @@ -107,7 +141,7 @@ func TestDiagnosisSkipsFailingFilterRerun(t *testing.T) { if err != nil { t.Fatal(err) } - if r := results[0]; r.Status != StatusEmpty || !strings.Contains(r.Diagnosis, "match http_route = '/missing'. Without that filter, 1 do.") { + if r := results[0]; r.Status != StatusEmpty || !strings.Contains(r.Diagnosis, "Without http_route = '/missing', 1 match the remaining filters.") { t.Fatalf("result = %+v", r) } } diff --git a/site/src/content/docs/reference/mcp-tools.mdx b/site/src/content/docs/reference/mcp-tools.mdx index dd6440de8..168c8bfda 100644 --- a/site/src/content/docs/reference/mcp-tools.mdx +++ b/site/src/content/docs/reference/mcp-tools.mdx @@ -133,7 +133,7 @@ Read-only. Calling it changes nothing. ## get_service_performance -**Service performance explorer** — Display separate latency, error rate and request rate panels plus slow endpoints for one service or the system. +**Service performance explorer** — Display separate latency, error rate and request rate panels plus slow operations (HTTP, gRPC and consumers) for one service or the system. Read-only. Calling it changes nothing. @@ -142,7 +142,7 @@ Read-only. Calling it changes nothing. | Input | Type | Required | Means | |---|---|---|---| | `from` | `string` | no | Absolute start, RFC3339Nano; requires to and excludes window | -| `limit` | `integer` | no | Maximum endpoints to return, from 1 to 500 | +| `limit` | `integer` | no | Maximum operations to return, from 1 to 500 | | `namespace` | `string` | no | OpenTelemetry service namespace; empty queries all namespaces | | `service` | `string` | no | Optional exact OpenTelemetry service name; omit for the whole system | | `to` | `string` | no | Absolute end, RFC3339Nano; requires from and excludes window | diff --git a/ui/host/src/dashboards/fragment-interactions.test.tsx b/ui/host/src/dashboards/fragment-interactions.test.tsx index 2b8227978..1e2ad47b9 100644 --- a/ui/host/src/dashboards/fragment-interactions.test.tsx +++ b/ui/host/src/dashboards/fragment-interactions.test.tsx @@ -146,7 +146,7 @@ it("shares one zoom group and batches all performance panels when brushing a sib expect(latency.group).toBe(errors.group); expect(errors.group).toBe(requests.group); await act(async () => { latency.onZoom!(100000, 200000); errors.onZoom!(100000, 200000); }); expect(view.onQuery).toHaveBeenCalledTimes(1); - expect(view.onQuery.mock.lastCall![0].dashboard.panels.map((p: { id: string }) => p.id)).toEqual(["latency", "errors", "requests", "endpoints"]); + expect(view.onQuery.mock.lastCall![0].dashboard.panels.map((p: { id: string }) => p.id)).toEqual(["latency", "errors", "requests", "operations"]); for (const id of ["latency", "errors", "requests"]) expect(ui.cards[id].zoomed).toBe(true); await act(async () => ui.cards.requests.onZoomReset!()); expect(view.onQuery.mock.lastCall![0].time).toEqual(f.dashboard.time); diff --git a/ui/host/src/dashboards/fragment-view.test.tsx b/ui/host/src/dashboards/fragment-view.test.tsx index fffedbac8..e323e7fdc 100644 --- a/ui/host/src/dashboards/fragment-view.test.tsx +++ b/ui/host/src/dashboards/fragment-view.test.tsx @@ -121,7 +121,7 @@ it("keeps performance siblings visible with only one focused visualization", asy await act(async () => view.el.querySelector('[aria-label="p95 latency menu"]')!.click()); await act(async () => [...document.body.querySelectorAll('[role="menuitem"]')].find(el => el.textContent === "View")!.click()); expect(view.el.querySelector('[data-panel="latency"]')?.textContent).toContain("Shown in full-screen"); - expect(view.el.querySelector('[data-panel="endpoints"]')?.textContent).toContain("/cart"); + expect(view.el.querySelector('[data-panel="operations"]')?.textContent).toContain("GET cart"); expect(document.body.querySelectorAll('[data-panel="latency"]')).toHaveLength(2); expect(document.body.querySelectorAll('[data-panel]')).toHaveLength(5); expect(view.onQuery).not.toHaveBeenCalled(); @@ -167,7 +167,7 @@ it.each(["service_map", "table"] as const)("names the %s dialog and returns focu await act(async () => [...document.querySelectorAll('[role="menuitem"]')].find(el => el.textContent === "View")!.click()); const dialog = document.querySelector('[role="dialog"]')!; expect(dialog.getAttribute("aria-label")).toBe(menu.getAttribute("aria-label")!.replace(/ menu$/, "")); - expect(dialog.textContent).toContain(viz === "table" ? "/cart" : "checkout"); + expect(dialog.textContent).toContain(viz === "table" ? "GET cart" : "checkout"); await act(async () => dialog.querySelector('[aria-label="Close panel view"]')!.dispatchEvent(new KeyboardEvent("keydown", {key:"Escape",bubbles:true}))); await vi.waitFor(() => expect(document.querySelector('[role="dialog"]')).toBeNull()); await vi.waitFor(() => expect(document.activeElement).toBe(menu)); diff --git a/ui/host/tests/fixtures.ts b/ui/host/tests/fixtures.ts index 57a35d0bc..64afd78d8 100644 --- a/ui/host/tests/fixtures.ts +++ b/ui/host/tests/fixtures.ts @@ -26,7 +26,7 @@ export function presetFixture(preset: typeof presets[number]): PanelFragment { } export function assertPresetData(node: HTMLElement, preset: typeof presets[number]) { expect(node.textContent).not.toMatch(/Explain|fix it|Duplicate|Remove panel|Copy link/); - if (preset === "performance") expect(node.textContent).toContain("/cart"); + if (preset === "performance") expect(node.textContent).toContain("GET cart"); else if (preset === "logs") expect(node.textContent).toContain("timeout"); else if (preset === "trace") { expect(node.querySelector('[data-trace-id="trace-1"]')?.textContent).toBe("trace-1"); diff --git a/ui/host/tests/go-fragments/performance.json b/ui/host/tests/go-fragments/performance.json index 4be5aa0e8..467e37c0c 100644 --- a/ui/host/tests/go-fragments/performance.json +++ b/ui/host/tests/go-fragments/performance.json @@ -1,7 +1,7 @@ { "view": { "kind": "preset", - "key": "fa7c95c69601faab1058f0577d8429987d4df9a77bfd478c2696518c3cd591f7" + "key": "c21eb2595c4e2f51f3112f98f0fba1d7783a3a61fe0d0b88f9a767b9d23ff890" }, "dashboard": { "version": 1, @@ -73,8 +73,8 @@ "drill": "traces" }, { - "id": "endpoints", - "title": "Slow endpoints", + "id": "operations", + "title": "Slow operations", "viz": "table", "width": 12, "height": "m", @@ -82,13 +82,13 @@ "from": "spans", "where": [ "namespace = 'shop'", - "http_route \u003c\u003e ''" + "kind IN ('SPAN_KIND_SERVER','SPAN_KIND_CONSUMER')" ], "measures": [ "p95(duration_ms)" ], "by": [ - "http_route" + "operation" ], "limit": 400 }, @@ -228,12 +228,12 @@ "better": "higher" }, { - "id": "endpoints", + "id": "operations", "status": "ok", "frame": { "columns": [ { - "name": "http_route", + "name": "operation", "type": "string", "role": "dimension" }, @@ -246,7 +246,7 @@ ], "values": [ [ - "/cart" + "GET cart" ], [ 100 @@ -254,7 +254,7 @@ ], "rows": 1 }, - "sql": "WITH base AS (SELECT * FROM spans WHERE \"start_time\" \u003e= ?::TIMESTAMP_NS::TIMESTAMPTZ_NS AND \"start_time\" \u003c ?::TIMESTAMP_NS::TIMESTAMPTZ_NS AND ((namespace = 'shop')) AND ((http_route != ''))) SELECT coalesce(\"http_route\", '') AS \"http_route\", quantile_cont(\"duration_ms\", 0.95)::DOUBLE AS \"p95\" FROM base GROUP BY \"http_route\" ORDER BY \"p95\" DESC NULLS LAST LIMIT 400", + "sql": "WITH base AS (SELECT * FROM spans WHERE \"start_time\" \u003e= ?::TIMESTAMP_NS::TIMESTAMPTZ_NS AND \"start_time\" \u003c ?::TIMESTAMP_NS::TIMESTAMPTZ_NS AND ((namespace = 'shop')) AND ((kind IN ('SPAN_KIND_SERVER', 'SPAN_KIND_CONSUMER')))) SELECT coalesce(\"operation\", '') AS \"operation\", quantile_cont(\"duration_ms\", 0.95)::DOUBLE AS \"p95\" FROM base GROUP BY \"operation\" ORDER BY \"p95\" DESC NULLS LAST LIMIT 400", "elapsed_ms": 0, "from_ms": 1791398700000, "to_ms": 1791402300000, diff --git a/ui/host/tests/go-fragments/performance.summary.txt b/ui/host/tests/go-fragments/performance.summary.txt index 4a78a2bef..abe58d1bb 100644 --- a/ui/host/tests/go-fragments/performance.summary.txt +++ b/ui/host/tests/go-fragments/performance.summary.txt @@ -4,5 +4,5 @@ errors: status=ok rows=1 truncated=false time=2026-10-07T19:15:00Z, error_rate=100% requests: status=ok rows=1 truncated=false time=2026-10-07T19:15:00Z, rate=1/s -endpoints: status=ok rows=1 truncated=false - http_route=/cart, p95=100 ms +operations: status=ok rows=1 truncated=false + operation=GET cart, p95=100 ms