Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-2.0] Fix OTEL HTTP exclusion detection #1691

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/internal/request/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (s *Span) isMetricsExportURL() bool {
case EventTypeGRPCClient:
return strings.HasPrefix(s.Path, grpcMetricsDetectPattern)
case EventTypeHTTPClient:
return strings.HasPrefix(s.Path, metricsDetectPattern)
return strings.HasSuffix(s.Path, metricsDetectPattern)
default:
return false
}
Expand All @@ -501,7 +501,7 @@ func (s *Span) isTracesExportURL() bool {
case EventTypeGRPCClient:
return strings.HasPrefix(s.Path, grpcTracesDetectPattern)
case EventTypeHTTPClient:
return strings.HasPrefix(s.Path, tracesDetectPattern)
return strings.HasSuffix(s.Path, tracesDetectPattern)
default:
return false
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/internal/request/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,15 @@ func TestDetectsOTelExport(t *testing.T) {
exports: false,
},
{
name: "Successfull HTTP /v1/metrics spans export",
name: "Successful HTTP /v1/metrics spans export",
span: Span{Type: EventTypeHTTPClient, Method: "GET", Path: "/v1/metrics", RequestStart: 100, End: 200, Status: 200},
exports: true,
},
{
name: "Successful HTTP /prefix/v1/metrics spans export",
span: Span{Type: EventTypeHTTPClient, Method: "GET", Path: "/prefix/v1/metrics", RequestStart: 100, End: 200, Status: 200},
exports: true,
},
{
name: "GRPC server spans don't export",
span: Span{Type: EventTypeGRPC, Method: "GET", Path: "/opentelemetry.proto.collector.metrics.v1.MetricsService/Export", RequestStart: 100, End: 200, Status: 0},
Expand Down
Loading