| Stability | experimental |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
OpenTelemetry.Internal.Trace.Id
Description
Synopsis
- data TraceId = TraceId !Word64 !Word64
- newTraceId :: MonadIO m => IdGenerator -> m TraceId
- isEmptyTraceId :: TraceId -> Bool
- traceIdBytes :: TraceId -> ByteString
- bytesToTraceId :: ByteString -> Either String TraceId
- baseEncodedToTraceId :: Base -> ByteString -> Either String TraceId
- traceIdBaseEncodedBuilder :: Base -> TraceId -> Builder
- traceIdBaseEncodedByteString :: Base -> TraceId -> ByteString
- traceIdBaseEncodedText :: Base -> TraceId -> Text
- data SpanId = SpanId !Word64
- newSpanId :: MonadIO m => IdGenerator -> m SpanId
- newTraceAndSpanId :: MonadIO m => IdGenerator -> m (TraceId, SpanId)
- isEmptySpanId :: SpanId -> Bool
- spanIdBytes :: SpanId -> ByteString
- bytesToSpanId :: ByteString -> Either String SpanId
- data Base = Base16
- baseEncodedToSpanId :: Base -> ByteString -> Either String SpanId
- spanIdBaseEncodedBuilder :: Base -> SpanId -> Builder
- spanIdBaseEncodedByteString :: Base -> SpanId -> ByteString
- spanIdBaseEncodedText :: Base -> SpanId -> Text
- nilTraceId :: TraceId
- nilSpanId :: SpanId
- decodeTraceparent :: ByteString -> Maybe (Word8, TraceId, SpanId, Word8)
- encodeTraceparent :: Word8 -> TraceId -> SpanId -> Word8 -> ByteString
Documentation
A valid trace identifier is a 16-byte array with at least one non-zero byte.
Stored as two machine-word Word64 values in native byte order.
When UNPACKed into a containing record (e.g. SpanContext), both
words are stored inline. No separate heap object, no pointer chase.
Since: 0.0.1.0
Instances
newTraceId :: MonadIO m => IdGenerator -> m TraceId Source #
Generate a TraceId using the provided IdGenerator.
Since: 0.1.0.0
isEmptyTraceId :: TraceId -> Bool Source #
Since: 0.1.0.0
traceIdBytes :: TraceId -> ByteString Source #
Since: 0.1.0.0
bytesToTraceId :: ByteString -> Either String TraceId Source #
Convert a ByteString to a TraceId. Will fail if the ByteString
is not exactly 16 bytes long.
Since: 0.1.0.0
baseEncodedToTraceId :: Base -> ByteString -> Either String TraceId Source #
Convert a hex-encoded ByteString into a TraceId.
Since: 0.1.0.0
traceIdBaseEncodedByteString :: Base -> TraceId -> ByteString Source #
SIMD-accelerated hex encoding (SSSE3 on x86_64, NEON on aarch64).
Since: 0.1.0.0
A valid span identifier is an 8-byte array with at least one non-zero byte.
Stored as a single machine-word Word64 in native byte order.
Since: 0.0.1.0
Instances
| IsString SpanId Source # | |||||
Defined in OpenTelemetry.Internal.Trace.Id Methods fromString :: String -> SpanId # | |||||
| Generic SpanId Source # | |||||
Defined in OpenTelemetry.Internal.Trace.Id Associated Types
| |||||
| Show SpanId Source # | |||||
| Eq SpanId Source # | |||||
| Ord SpanId Source # | |||||
| Hashable SpanId Source # | |||||
Defined in OpenTelemetry.Internal.Trace.Id | |||||
| type Rep SpanId Source # | |||||
Defined in OpenTelemetry.Internal.Trace.Id | |||||
newSpanId :: MonadIO m => IdGenerator -> m SpanId Source #
Generate a SpanId using the provided IdGenerator.
Since: 0.1.0.0
newTraceAndSpanId :: MonadIO m => IdGenerator -> m (TraceId, SpanId) Source #
Generate both a TraceId and SpanId. For DefaultIdGenerator, this is a
single FFI call (3 xoshiro steps) instead of 3 separate calls. Used for
root spans where both IDs need generating.
isEmptySpanId :: SpanId -> Bool Source #
Since: 0.1.0.0
spanIdBytes :: SpanId -> ByteString Source #
Since: 0.1.0.0
bytesToSpanId :: ByteString -> Either String SpanId Source #
Since: 0.1.0.0
baseEncodedToSpanId :: Base -> ByteString -> Either String SpanId Source #
Since: 0.1.0.0
spanIdBaseEncodedByteString :: Base -> SpanId -> ByteString Source #
Since: 0.1.0.0
Nil (all-zero) IDs
nilTraceId :: TraceId Source #
All-zero TraceId.
Since: 0.0.1.0
Traceparent codec (C FFI)
decodeTraceparent :: ByteString -> Maybe (Word8, TraceId, SpanId, Word8) Source #
Parse a W3C traceparent header in a single SIMD-accelerated C call.
Returns the version, trace ID, span ID, and flags byte, or Nothing
on any format error (bad hex, wrong length, missing dashes, all-zero IDs).
Since: 0.4.0.0
encodeTraceparent :: Word8 -> TraceId -> SpanId -> Word8 -> ByteString Source #
Encode a traceparent header (55 bytes) in a single SIMD-accelerated C call.
Since: 0.4.0.0