Skip to content

The only tool you need to know what is happening and how to fix it.

feat: otel 404 to unmatched

dduxfb7453bb7580
diff --git a/backend/app/controllers/clientcontrollers/client.controller.go b/backend/app/controllers/clientcontrollers/client.controller.go
index d6b9fe2a..98e6ddc7 100644
--- a/backend/app/controllers/clientcontrollers/client.controller.go
+++ b/backend/app/controllers/clientcontrollers/client.controller.go
@@ -81,6 +81,9 @@ func (e clientController) Report(c *gin.Context) {
} else {
e := ct.ToEndpoint(request.AppVersion, request.ServerName)
e.ProjectId = projectId
+ if e.StatusCode == 404 {
+ e.Endpoint = "UNMATCHED"
+ }
endpointsToInsert = append(endpointsToInsert, e)
}
diff --git a/backend/app/controllers/otelcontrollers/trace_converter.go b/backend/app/controllers/otelcontrollers/trace_converter.go
index c97bbc3f..6c1565eb 100644
--- a/backend/app/controllers/otelcontrollers/trace_converter.go
+++ b/backend/app/controllers/otelcontrollers/trace_converter.go
@@ -132,6 +132,10 @@ func buildEndpoint(
statusCode = int16(code)
}
+ if statusCode == 404 {
+ endpoint = "UNMATCHED"
+ }
+
bodySize := int32(0)
if size, ok := getIntAttribute(attrs, "http.response.body.size"); ok {
bodySize = int32(size)
diff --git a/backend/app/repositories/endpoint.repository.go b/backend/app/repositories/endpoint.repository.go
index a230792e..08aed441 100644
--- a/backend/app/repositories/endpoint.repository.go
+++ b/backend/app/repositories/endpoint.repository.go
@@ -145,7 +145,7 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectI
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 8000000000, 0.75,
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 6000000000, 0.50,
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 3000000000, 0.25, 0.0),
- if(total_count > 10,
+ if(endpoint != 'UNMATCHED' AND total_count > 10,
multiIf(
client_error_count / total_count > 0.50, 0.75,
client_error_count / total_count > 0.25, 0.50, 0.0),
@@ -216,7 +216,7 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectI
s.P95Duration = time.Duration(p95)
s.P99Duration = time.Duration(p99)
s.AvgDuration = time.Duration(avg)
- s.ImpactReason = computeImpactReason(s.Count, satisfiedCount, toleratingCount, badCount, clientErrorCount, p99, offsetMs)
+ s.ImpactReason = computeImpactReason(s.Endpoint, s.Count, satisfiedCount, toleratingCount, badCount, clientErrorCount, p99, offsetMs)
stats = append(stats, s)
}
@@ -488,7 +488,7 @@ func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId u
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 8000000000, 0.75,
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 6000000000, 0.50,
toFloat64(p99_duration) - toFloat64(offset_ms) * 1000000 > 3000000000, 0.25, 0.0),
- if(total_count > 10,
+ if(endpoint != 'UNMATCHED' AND total_count > 10,
multiIf(
client_error_count / total_count > 0.50, 0.75,
client_error_count / total_count > 0.25, 0.50, 0.0),
@@ -556,7 +556,7 @@ func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId u
s.P95Duration = time.Duration(p95)
s.P99Duration = time.Duration(p99)
s.AvgDuration = time.Duration(avg)
- s.ImpactReason = computeImpactReason(s.Count, satisfiedCount, toleratingCount, badCount, clientErrorCount, p99, offsetMs)
+ s.ImpactReason = computeImpactReason(s.Endpoint, s.Count, satisfiedCount, toleratingCount, badCount, clientErrorCount, p99, offsetMs)
stats = append(stats, s)
}
diff --git a/backend/app/repositories/impact.go b/backend/app/repositories/impact.go
index 2ab6ae95..7ef19a92 100644
--- a/backend/app/repositories/impact.go
+++ b/backend/app/repositories/impact.go
@@ -7,6 +7,7 @@ import (
)
func computeImpactReason(
+ endpoint string,
total, satisfiedCount, toleratingCount, badCount, clientErrorCount uint64,
p99Ns float64,
offsetMs uint32,
@@ -47,9 +48,9 @@ func computeImpactReason(
p99Score = 0.25
}
- // 4. Client Error Floor (only when count > 10)
+ // 4. Client Error Floor (only when count > 10, skip for UNMATCHED)
var clientErrorScore float64
- if total > 10 {
+ if endpoint != "UNMATCHED" && total > 10 {
clientRate := clientF / totalF
switch {
case clientRate > 0.50: