diff --git a/app/vtselect/traces/tempo/tempo.go b/app/vtselect/traces/tempo/tempo.go index a07b015d3..c4396e7f4 100644 --- a/app/vtselect/traces/tempo/tempo.go +++ b/app/vtselect/traces/tempo/tempo.go @@ -81,6 +81,9 @@ func RequestHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) processQueryRequest(ctx, w, r) tempoQueryDuration.UpdateDuration(startTime) return true + } else if path == "/select/tempo/api/v2/traces/diff" { + http.Error(w, "trace diff support is unavailable as this feature is experimental", http.StatusNotFound) + return true } else if strings.HasPrefix(path, "/select/tempo/api/v2/traces/") && len(path) > len("/select/tempo/api/v2/traces/") { tempoQueryV2Requests.Inc() processQueryV2Request(ctx, w, r) diff --git a/app/vtselect/traces/tempo/tempo_test.go b/app/vtselect/traces/tempo/tempo_test.go index 4fe3190ee..ad72f7d03 100644 --- a/app/vtselect/traces/tempo/tempo_test.go +++ b/app/vtselect/traces/tempo/tempo_test.go @@ -4,12 +4,33 @@ import ( "bytes" "context" "encoding/json" + "net/http" + "net/http/httptest" "slices" "testing" otelpb "github.com/VictoriaMetrics/VictoriaTraces/lib/protoparser/opentelemetry/pb" ) +func TestRequestHandlerTraceDiffNotSupported(t *testing.T) { + f := func(method, rawURL string) { + t.Helper() + r := httptest.NewRequest(method, rawURL, nil) + w := httptest.NewRecorder() + if !RequestHandler(context.Background(), w, r) { + t.Fatalf("%s %s must be handled", method, rawURL) + } + if w.Code != http.StatusNotFound { + t.Fatalf("unexpected status code for %s %s; got %d; want %d", + method, rawURL, w.Code, http.StatusNotFound) + } + } + + f(http.MethodGet, "/select/tempo/api/v2/traces/diff") + f(http.MethodPost, "/select/tempo/api/v2/traces/diff") + f(http.MethodPost, "/select/tempo/api/v2/traces/diff?start=1&end=2") +} + // Intrinsic span fields have no attribute prefix, so they are not discovered by // the field_names scan. They must be advertised explicitly under the "intrinsic" // scope of /api/v2/search/tags, otherwise they never appear in the Grafana diff --git a/docs/victoriatraces/changelog/CHANGELOG.md b/docs/victoriatraces/changelog/CHANGELOG.md index 81101e005..bfdb86762 100644 --- a/docs/victoriatraces/changelog/CHANGELOG.md +++ b/docs/victoriatraces/changelog/CHANGELOG.md @@ -16,6 +16,7 @@ The following `tip` changes can be tested by building VictoriaTraces components * BUGFIX: [Single-node VictoriaTraces](https://docs.victoriametrics.com/victoriatraces/) and vtselect in [VictoriaTraces cluster](https://docs.victoriametrics.com/victoriatraces/cluster/): return correct results for TraceQL filters with `||` in the Tempo API, such as `{ status = error || duration > 5s }`. Previously, such a filter could count extra spans, or the search failed with `cannot parse in()`, depending on the order of the conditions. Thank @ZeXi0308 for [the issue #319](https://github.com/VictoriaMetrics/VictoriaTraces/issues/319) and [the pull request #320](https://github.com/VictoriaMetrics/VictoriaTraces/pull/320). * BUGFIX: [Single-node VictoriaTraces](https://docs.victoriametrics.com/victoriatraces/) and vtselect in [VictoriaTraces cluster](https://docs.victoriametrics.com/victoriatraces/cluster/): match attribute values that look like durations in TraceQL filters of the Tempo API, such as `{ span.cache.ttl = "30s" }`. Previously, such a value was converted to nanoseconds and the filter matched nothing. The conversion now applies to `duration` and `traceDuration` filters only. Thank @ZeXi0308 for [the issue #321](https://github.com/VictoriaMetrics/VictoriaTraces/issues/321) and [the pull request #322](https://github.com/VictoriaMetrics/VictoriaTraces/pull/322). +* BUGFIX: [Single-node VictoriaTraces](https://docs.victoriametrics.com/victoriatraces/) and vtselect in [VictoriaTraces cluster](https://docs.victoriametrics.com/victoriatraces/cluster/): return status code `404` for requests to `/select/tempo/api/v2/traces/diff` without searching storage. Previously the `/select/tempo/api/v2/traces/` handler treated `diff` as a trace ID and performed an unnecessary scan, and returned status code `200` with an empty trace. Thank @mastersans for [the pull request #315](https://github.com/VictoriaMetrics/VictoriaTraces/pull/315). ## [v0.13.0](https://github.com/VictoriaMetrics/VictoriaTraces/releases/tag/v0.13.0)