-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(cloudflare): Improve http span data #16232
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
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
0aa0999
to
52b7884
Compare
*/ | ||
export function getHttpSpanDetailsFromUrlObject( | ||
urlObject: URLObject | undefined, | ||
kind: 'server' | 'client', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know during our bikeshedding session we said we wanted to get rid of this, but I had to add it back so that we could generate the name correctly.
See the getHttpSpanNameFromUrlObject
implementation.
@@ -53,7 +61,7 @@ export function isURLObjectRelative(url: URLObject): url is RelativeURL { | |||
* @returns The parsed URL object or undefined if the URL is invalid | |||
*/ | |||
export function parseStringToURLObject(url: string, urlBase?: string | URL | undefined): URLObject | undefined { | |||
const isRelative = url.startsWith('/'); | |||
const isRelative = url.indexOf('://') <= 0 && url.indexOf('//') !== 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is now much more robust. I've added way more tests for this as well.
While helping debug work in https://github.com/getsentry/sentry-mcp, I noticed that we didn't attach
url.path
to the http fetch spans, which made using the trace explorer harder to use.This PR updates the cloudflare http instrumentation (fetch handlers for regular workers and durable objects) to use a new
getHttpSpanDetailsFromUrlObject
abstraction I built.getHttpSpanDetailsFromUrlObject
returns the http span name and it's associated attributes, taking care to handle source, route names, and handling both relative and full URLs.This is related to all the #15767 work I've been doing.