-
Notifications
You must be signed in to change notification settings - Fork 4
XRayRecorder_TraceContext
X-Ray Trace Context propagated in a tracing header.
public struct TraceContext
All requests are traced, up to a configurable minimum.
After reaching that minimum, a percentage of requests are traced to avoid unnecessary cost.
The sampling decision and trace ID are added to HTTP requests in tracing headers named X-Amzn-Trace-Id
.
The first X-Ray-integrated service that the request hits adds a tracing header, which is read by the X-Ray SDK and included in the response.
X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Sampled=1
A tracing header can originate from the X-Ray SDK, an AWS service, or the client request.
Your application can remove X-Amzn-Trace-Id
from incoming requests to avoid issues caused by users adding trace IDs
or sampling decisions to their requests.
The tracing header can also contain a parent segment ID if the request originated from an instrumented application. For example, if your application calls a downstream HTTP web API with an instrumented HTTP client, the X-Ray SDK adds the segment ID for the original request to the tracing header of the downstream request. An instrumented application that serves the downstream request can record the parent segment ID to connect the two requests.
X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1
Creates new Trace Context.
public init(traceId: TraceID = .init(), parentId: Segment.ID? = nil, sampled: Bool = true)
- traceId: - traceId: root trace ID
- parentId: - parentId: parent segment ID
- sampled: - sampled: sampling decision
Parses and validates string with Tracing Header.
public init(tracingHeader: String) throws
- string: - string: string with
TraceContext
.
may throw XRayRecorder.TraceError
if the value is invalid.
Root trace ID.
let traceId: TraceID
Parent segment ID.
var parentId: Segment.ID?
sampled
flag.
var isSampled: Bool
Tracing header value.
var tracingHeader: String
Generated at 2020-08-17T04:20:53+0000 using swift-doc 1.0.0-beta.4.
Types
- AnyCodable
- AnyDecodable
- AnyEncodable
- XRayLogEmitter
- XRayNoOpEmitter
- XRayNoOpRecorder
- XRayRecorder
- XRayRecorder.Config
- XRayRecorder.Config.ContextMissingStrategy
- XRayRecorder.Segment
- XRayRecorder.Segment.ID
- XRayRecorder.Timestamp
- XRayRecorder.TraceContext
- XRayRecorder.TraceID
- XRayUDPEmitter
- XRayUDPEmitter.Config
- XRayUDPEmitter.EventLoopGroupProvider
- XRayUDPEmitter.SegmentEncoding