hs-opentelemetry-api
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

OpenTelemetry.Internal.Trace.Id

Description

 
Synopsis

Documentation

data TraceId Source #

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

Constructors

TraceId !Word64 !Word64 

Instances

Instances details
IsString TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

fromString :: String -> TraceId #

Generic TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Associated Types

type Rep TraceId 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

type Rep TraceId = D1 ('MetaData "TraceId" "OpenTelemetry.Internal.Trace.Id" "hs-opentelemetry-api-1.0.0.0-inplace" 'False) (C1 ('MetaCons "TraceId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64)))

Methods

from :: TraceId -> Rep TraceId x #

to :: Rep TraceId x -> TraceId #

Show TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Eq TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

(==) :: TraceId -> TraceId -> Bool #

(/=) :: TraceId -> TraceId -> Bool #

Ord TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Hashable TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

hashWithSalt :: Int -> TraceId -> Int #

hash :: TraceId -> Int #

type Rep TraceId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

type Rep TraceId = D1 ('MetaData "TraceId" "OpenTelemetry.Internal.Trace.Id" "hs-opentelemetry-api-1.0.0.0-inplace" 'False) (C1 ('MetaCons "TraceId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64)))

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

data SpanId Source #

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

Constructors

SpanId !Word64 

Instances

Instances details
IsString SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

fromString :: String -> SpanId #

Generic SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Associated Types

type Rep SpanId 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

type Rep SpanId = D1 ('MetaData "SpanId" "OpenTelemetry.Internal.Trace.Id" "hs-opentelemetry-api-1.0.0.0-inplace" 'False) (C1 ('MetaCons "SpanId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64)))

Methods

from :: SpanId -> Rep SpanId x #

to :: Rep SpanId x -> SpanId #

Show SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Eq SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

(==) :: SpanId -> SpanId -> Bool #

(/=) :: SpanId -> SpanId -> Bool #

Ord SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Hashable SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

hashWithSalt :: Int -> SpanId -> Int #

hash :: SpanId -> Int #

type Rep SpanId Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

type Rep SpanId = D1 ('MetaData "SpanId" "OpenTelemetry.Internal.Trace.Id" "hs-opentelemetry-api-1.0.0.0-inplace" 'False) (C1 ('MetaCons "SpanId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64)))

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

data Base Source #

Base encoding scheme. Only Base16 (hexadecimal) is supported.

Since: 0.0.1.0

Constructors

Base16 

Instances

Instances details
Show Base Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

showsPrec :: Int -> Base -> ShowS #

show :: Base -> String #

showList :: [Base] -> ShowS #

Eq Base Source # 
Instance details

Defined in OpenTelemetry.Internal.Trace.Id

Methods

(==) :: Base -> Base -> Bool #

(/=) :: Base -> Base -> Bool #

spanIdBaseEncodedText :: Base -> SpanId -> Text Source #

Since: 0.1.0.0

Nil (all-zero) IDs

nilTraceId :: TraceId Source #

All-zero TraceId.

Since: 0.0.1.0

nilSpanId :: SpanId Source #

All-zero SpanId.

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