-
Notifications
You must be signed in to change notification settings - Fork 4
XRayRecorder
X-Ray tracer.
public class XRayRecorder
XRayRecorder
allows to create new XRayRecorder.Segment
s and sends them using provided XRayEmitter
.
Creates an instance of XRayRecorder
.
public convenience init(emitter: XRayEmitter, config: Config = Config())
- emitter: - emitter: emitter used to send
XRayRecorder.Segment
s. - config: - config: configuration, overrides enviromental variables.
Creates an instance of XRayRecorder
with XRayUDPEmitter
.
public convenience init(eventLoopGroupProvider: XRayUDPEmitter.EventLoopGroupProvider = .createNew, config: Config = Config())
- eventLoopGroupProvider: - eventLoopGroupProvider: specifies how the
EventLoopGroup
used byXRayUDPEmitter
will be created and establishes lifecycle ownership. - config: - config: configuration, overrides enviromental variables.
Creates new segment.
@inlinable public func segment<T>(name: String, context: TraceContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: (XRayRecorder.Segment) throws -> T) rethrows -> T
Records thrown Error
.
- name: - name: segment name
- context: - context: the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Creates new segment.
@inlinable public func segment<T>(name: String, baggage: BaggageContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: (XRayRecorder.Segment) throws -> T) rethrows -> T
Records thrown Error
.
Extracts the trace context from the baggage.
Creates new one if the baggage does not contain a valid XRayContext
.
Depending on the context missing strategy configuration will log an error or fail if the context is missing.
- name: - name: segment name
- baggage: - baggage: baggage with the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Creates new segment.
@inlinable public func segment<T, E>(name: String, context: TraceContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: (XRayRecorder.Segment) throws -> Result<T, E>) rethrows -> Result<T, E>
Records thrown Error
and .failure
.
- name: - name: segment name
- context: - context: the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Creates new segment.
@inlinable public func segment<T, E>(name: String, baggage: BaggageContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: (XRayRecorder.Segment) throws -> Result<T, E>) rethrows -> Result<T, E>
Records thrown Error
and .failure
.
Extracts the trace context from the baggage.
Creates new one if the baggage does not contain a valid XRayContext
.
Depending on the context missing strategy configuration will log an error or fail if the context is missing.
- name: - name: segment name
- baggage: - baggage: baggage with the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Flushes the emitter in SwiftNIO
future.
public func flush(on eventLoop: EventLoop) -> EventLoopFuture<Void>
- eventLoop: - eventLoop:
EventLoop
used to "do the flushing".
Creates new segment.
@inlinable public func segment<T>(name: String, context: TraceContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: () -> EventLoopFuture<T>) -> EventLoopFuture<T>
Records Error
.
- name: - name: segment name
- context: - context: the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Creates new segment.
@inlinable public func segment<T>(name: String, baggage: BaggageContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: () -> EventLoopFuture<T>) -> EventLoopFuture<T>
Records Error
.
- name: - name: segment name
- baggage: - baggage: baggage with the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
- body: - body: segment body
Creates new segment.
public func beginSegment(name: String, context: TraceContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil) -> XRayRecorder.Segment
- name: - name: segment name
- context: - context: the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
new segment
Creates new segment.
public func beginSegment(name: String, baggage: BaggageContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil) -> XRayRecorder.Segment
Extracts the trace context from the baggage.
Creates new one if the baggage does not contain a valid XRayContext
.
Depending on the context missing strategy configuration will log an error or fail if the context is missing.
- name: - name: segment name
- baggage: - baggage: baggage with the trace context
- startTime: - startTime: start time, defaults to now
- metadata: - metadata: segment metadata
new segment
Flushes the emitter. May be blocking.
public func wait(_ callback: ((Error?) -> Void)? = nil)
- callback: - callback: callback with error if the operation failed.
Flushes the emitter. May be blocking.
public func shutdown(_ callback: ((Error?) -> Void)? = nil)
XRayRecorder.Segment
s after shutdown
are NOT recorded.
- callback: - callback: callback with error if the operation failed.
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