-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding
traceparent
HTTP requests header (#198)
- Loading branch information
1 parent
18493b0
commit 633a07b
Showing
21 changed files
with
510 additions
and
93 deletions.
There are no files selected for viewing
This file contains 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 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 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
26 changes: 26 additions & 0 deletions
26
Sources/EmbraceCore/Capture/Network/URLSessionCaptureService+Options.swift
This file contains 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,26 @@ | ||
// | ||
// Copyright © 2023 Embrace Mobile, Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension URLSessionCaptureService { | ||
/// Class used to setup a URLSessionCaptureService. | ||
@objc public final class Options: NSObject { | ||
/// Defines wether or not the Embrace SDK should inject the `traceparent` header into all network requests | ||
@objc public let injectTracingHeader: Bool | ||
|
||
/// `URLSessionRequestsDataSource` instance that will manipuate all network requests | ||
/// before the Embrace SDK captures their data. | ||
@objc public let requestsDataSource: URLSessionRequestsDataSource? | ||
|
||
@objc public init(injectTracingHeader: Bool, requestsDataSource: URLSessionRequestsDataSource?) { | ||
self.injectTracingHeader = injectTracingHeader | ||
self.requestsDataSource = requestsDataSource | ||
} | ||
|
||
@objc convenience override init() { | ||
self.init(injectTracingHeader: true, requestsDataSource: nil) | ||
} | ||
} | ||
} |
This file contains 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
15 changes: 15 additions & 0 deletions
15
Sources/EmbraceCore/Capture/Network/URLSessionRequestsDataSource.swift
This file contains 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,15 @@ | ||
// | ||
// Copyright © 2023 Embrace Mobile, Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// This protocol can be used to modify requests before the Embrace SDK | ||
/// captures their data into OTel spans. | ||
/// | ||
/// Example: | ||
/// This could be useful if you need to obfuscate certains parts of a request path | ||
/// if it contains sensitive data. | ||
@objc public protocol URLSessionRequestsDataSource: NSObjectProtocol { | ||
@objc func modifiedRequest(for request: URLRequest) -> URLRequest | ||
} |
Oops, something went wrong.