-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add Traceparent to Outgoing Requests #172
base: main
Are you sure you want to change the base?
Conversation
Found an issue while debugging the failing unit test: Do not review yet. |
The unit tests are still failing, but I wanted to get this proposed solution in before I leave for vacation. The data task unit test succeeds if you run it by itself. If this direction is something we're good with, I will fix the unit tests (and bugs, and lint errors) when I return. |
I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
Adds the traceparent to the header of outgoing HTTP requests.
Unfortunately, the request object is get-only where we were creating spans, requiring us to swizzle the task functions in URLSessionTask. This solution was adapted, and heavily modified, from opentelemetry-swift: https://github.com/open-telemetry/opentelemetry-swift/blob/8d6fa745c186e3b7556f330b5236da25fa7c9d62/Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift
The proposed solution swizzles urlsession tasks that take in (or requests) a request object, and passes through a modified request object with the added traceparent header.
Also includes a new variable in SplunkRumOptions, allowing users to enable. It is false by default.