-
Notifications
You must be signed in to change notification settings - Fork 167
Add spanCustomization callback to Trace URLSession tracking #2741
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
Open
mariusc83
wants to merge
9
commits into
develop
Choose a base branch
from
mconstantin/1649/request-based-span-tags
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0adc6a8
Add spanCustomization callback to Trace URLSession tracking
mariusc83 aed358d
Add response and error parameters to SpanCustomization for Android pa…
mariusc83 fc36c9e
Fix swiftlint: move default parameter to end of parameter list
mariusc83 aab4d5e
Fix argument order in TracingURLSessionHandler init call
mariusc83 fb1a5dd
Fix argument order in TracingURLSessionHandler test call sites
mariusc83 b728e34
Address PR review feedback
mariusc83 71b7078
Use ImmutableRequest instead of unsafeOriginal in SpanCustomization
mariusc83 ae9e142
[RUM-1649] Replace ImmutableRequest with InterceptedRequest in SpanCu…
mariusc83 c43eacd
[RUM-1649] Fix lint: expand guard-else onto multiple lines
mariusc83 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ artifacts/ | |
|
|
||
| # AI files | ||
| .claude/settings.local.json | ||
| .rum-analysis/ | ||
|
|
||
| # GSD planning files (local only) | ||
| .planning/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||
| /* | ||||||||||
| * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||||||||||
| * This product includes software developed at Datadog (https://www.datadoghq.com/). | ||||||||||
| * Copyright 2019-Present Datadog, Inc. | ||||||||||
| */ | ||||||||||
|
|
||||||||||
| import Foundation | ||||||||||
| import DatadogInternal | ||||||||||
|
|
||||||||||
| extension Trace.Configuration { | ||||||||||
| /// An immutable snapshot of a network request, passed to ``SpanCustomization`` callbacks. | ||||||||||
| /// | ||||||||||
| /// Properties are copied from the original `URLRequest` at interception time and are safe to read | ||||||||||
| /// from any thread. | ||||||||||
| public struct InterceptedRequest { | ||||||||||
| /// The URL of the request. | ||||||||||
| public let url: URL? | ||||||||||
| /// The HTTP method of the request (e.g. `"GET"`, `"POST"`). | ||||||||||
| public let httpMethod: String? | ||||||||||
| /// The body data of the request. | ||||||||||
| public let httpBody: Data? | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| internal extension Trace.Configuration.InterceptedRequest { | ||||||||||
| init(from request: ImmutableRequest) { | ||||||||||
| self.url = request.url | ||||||||||
| self.httpMethod = request.httpMethod | ||||||||||
| // httpBody is Data? — safe to access; the thread-safety concern in ImmutableRequest | ||||||||||
| // applies only to allHTTPHeaderFields (bridged NSMutableDictionary). | ||||||||||
| self.httpBody = request.unsafeOriginal.httpBody | ||||||||||
|
Comment on lines
+29
to
+31
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit/ This comment seems to be agent's own reflection on this work, rather than sth useful in this context.
Suggested change
|
||||||||||
| } | ||||||||||
| } | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit/ Seems to be leftover from personal setup: