The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
fix: slightly better 404 handling for otel
narrow-adventurec3d5b3e9ba49
diff --git a/backend/app/controllers/otelcontrollers/trace_converter.go b/backend/app/controllers/otelcontrollers/trace_converter.goindex 5caf5eb4..b82df875 100644--- a/backend/app/controllers/otelcontrollers/trace_converter.go+++ b/backend/app/controllers/otelcontrollers/trace_converter.go@@ -366,7 +366,13 @@ func buildEndpoint(statusCode = int16(code)}- if statusCode == 404 {+ // A 404 collapses to UNMATCHED only when no real route matched: http.route+ // is missing/invalid, or a catch-all made of only slashes and wildcards+ // ("/", "/*", "/**", "*/*") — what Express middleware, Spring resource+ // handlers and not-found handlers report for unmatched requests. A concrete+ // matched route returning 404 is a deliberate response and keeps its identity.+ route := getStringAttribute(attrs, "http.route")+ if statusCode == 404 && (!strings.HasPrefix(route, "/") || strings.Trim(route, "/*") == "") {endpoint = "UNMATCHED"}diff --git a/backend/app/controllers/otelcontrollers/trace_converter_test.go b/backend/app/controllers/otelcontrollers/trace_converter_test.goindex b7b934ff..7d6daa3a 100644--- a/backend/app/controllers/otelcontrollers/trace_converter_test.go+++ b/backend/app/controllers/otelcontrollers/trace_converter_test.go@@ -8,6 +8,7 @@ import ("sort""strings""testing"+ "time""github.com/google/uuid""github.com/tracewayapp/traceway/backend/app/controllers/clientcontrollers"@@ -266,6 +267,64 @@ func TestGetHTTPEndpoint(t *testing.T) {}}+func TestBuildEndpoint404Unmatched(t *testing.T) {+ tests := []struct {+ name string+ attrs []*commonpb.KeyValue+ want string+ }{+ {"matched route keeps identity on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/users/:id"),+ intKV("http.response.status_code", 404),+ }, "GET /users/:id"},+ {"no route collapses on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("url.path", "/wp-admin.php"),+ intKV("http.response.status_code", 404),+ }, "UNMATCHED"},+ {"invalid route collapses on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "no-slash"),+ intKV("http.response.status_code", 404),+ }, "UNMATCHED"},+ {"express middleware root route collapses on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/"),+ intKV("http.response.status_code", 404),+ }, "UNMATCHED"},+ {"wildcard route collapses on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/*"),+ intKV("http.response.status_code", 404),+ }, "UNMATCHED"},+ {"spring resource handler route collapses on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/**"),+ intKV("http.response.status_code", 404),+ }, "UNMATCHED"},+ {"scoped wildcard route kept on 404", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/api/*"),+ intKV("http.response.status_code", 404),+ }, "GET /api/*"},+ {"matched route on 200 unaffected", []*commonpb.KeyValue{+ strKV("http.request.method", "GET"),+ strKV("http.route", "/users/:id"),+ intKV("http.response.status_code", 200),+ }, "GET /users/:id"},+ }+ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ span := &tracepb.Span{Name: "fallback"}+ ep := buildEndpoint(uuid.New(), testProjectId, span, tt.attrs, nil, time.Time{}, 0, "", "")+ if ep.Endpoint != tt.want {+ t.Errorf("buildEndpoint().Endpoint = %q, want %q", ep.Endpoint, tt.want)+ }+ })+ }+}+func TestFilterNonStandardAiAttrs(t *testing.T) {input := map[string]string{"gen_ai.request.model": "gpt-4",@@ -668,6 +727,13 @@ func strKV(key, val string) *commonpb.KeyValue {}}+func intKV(key string, val int64) *commonpb.KeyValue {+ return &commonpb.KeyValue{+ Key: key,+ Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: val}},+ }+}+func strArrayKV(key string, vals ...string) *commonpb.KeyValue {items := make([]*commonpb.AnyValue, len(vals))for i, v := range vals {