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

ref: Improve isSentryRequestUrl #636

Merged
merged 4 commits into from May 8, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions otel/internal/utils/sentryrequest.go
Expand Up @@ -38,6 +38,10 @@
return false
}

dsn, _ := sentry.NewDsn(client.Options().Dsn)
return strings.Contains(url, dsn.GetHost()) && strings.Contains(url, dsn.GetProjectID())
dsn, err := sentry.NewDsn(client.Options().Dsn)
if err != nil {
return false
}

Check warning on line 44 in otel/internal/utils/sentryrequest.go

View check run for this annotation

Codecov / codecov/patch

otel/internal/utils/sentryrequest.go#L43-L44

Added lines #L43 - L44 were not covered by tests

return strings.Contains(url, dsn.GetAPIURL().String())
}
2 changes: 1 addition & 1 deletion otel/span_processor_test.go
Expand Up @@ -313,7 +313,7 @@ func TestOnEndDoesNotFinishSentryRequests(t *testing.T) {
emptyContextWithSentry(),
"POST to Sentry",
// Hostname is same as in Sentry DSN
trace.WithAttributes(attribute.String("http.url", "https://example.com/123")),
trace.WithAttributes(attribute.String("http.url", "https://example.com/api/123/envelope/")),
)
sentrySpan, _ := sentrySpanMap.Get(otelSpan.SpanContext().SpanID())
otelSpan.End()
Expand Down