Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype TraceId = TraceId ShortByteString
- 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
- newtype SpanId = SpanId ShortByteString
- newSpanId :: MonadIO m => IdGenerator -> m 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
Documentation
A valid trace identifier is a 16-byte array with at least one non-zero byte.
Instances
IsString TraceId Source # | |
Defined in OpenTelemetry.Internal.Trace.Id fromString :: String -> TraceId # | |
Generic TraceId Source # | |
Show TraceId Source # | |
Eq TraceId Source # | |
Ord TraceId Source # | |
Defined in OpenTelemetry.Internal.Trace.Id | |
Hashable TraceId Source # | |
Defined in OpenTelemetry.Internal.Trace.Id | |
type Rep TraceId Source # | |
Defined in OpenTelemetry.Internal.Trace.Id type Rep TraceId = D1 ('MetaData "TraceId" "OpenTelemetry.Internal.Trace.Id" "hs-opentelemetry-api-0.0.3.8-AoTII5Ku3MbK0rXg3KwxuX" 'True) (C1 ('MetaCons "TraceId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) |
newTraceId :: MonadIO m => IdGenerator -> m TraceId Source #
Generate a TraceId
using the provided IdGenerator
This function is generally called by the hs-opentelemetry-sdk
,
but may be useful in some testing situations.
Since: 0.1.0.0
isEmptyTraceId :: TraceId -> Bool Source #
Check whether all bytes in the TraceId
are zero.
Since: 0.1.0.0
traceIdBytes :: TraceId -> ByteString Source #
Access the byte-level representation of the provided TraceId
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 ByteString
of a specified base-encoding into a TraceId
.
Will fail if the decoded value is not exactly 16 bytes long.
Since: 0.1.0.0
traceIdBaseEncodedByteString :: Base -> TraceId -> ByteString Source #
Output a TraceId
into a base-encoded ByteString
.
Since: 0.1.0.0
A valid span identifier is an 8-byte array with at least one non-zero byte.
newSpanId :: MonadIO m => IdGenerator -> m SpanId Source #
Generate a SpanId
using the provided IdGenerator
This function is generally called by the hs-opentelemetry-sdk
,
but may be useful in some testing situations.
Since: 0.1.0.0
isEmptySpanId :: SpanId -> Bool Source #
Check whether all bytes in the SpanId
are zero.
Since: 0.1.0.0
spanIdBytes :: SpanId -> ByteString Source #
Access the byte-level representation of the provided SpanId
Since: 0.1.0.0
bytesToSpanId :: ByteString -> Either String SpanId Source #
Convert a ByteString
of a specified base-encoding into a SpanId
.
Will fail if the decoded value is not exactly 8 bytes long.
Since: 0.1.0.0
The different bases that can be used.
See RFC4648 for details. In particular, Base64 can be standard or URL-safe. URL-safe encoding is often used in other specifications without padding characters.
RFC 2045 defines a separate Base64 encoding, which is not supported. This format requires a newline at least every 76 encoded characters, which works around limitations of older email programs that could not handle long lines. Be aware that other languages, such as Ruby, encode the RFC 2045 version by default. To decode their output, remove all newlines before decoding.
Examples
A quick example to show the differences:
>>>
let input = "Is 3 > 2?" :: ByteString
>>>
let convertedTo base = convertToBase base input :: ByteString
>>>
convertedTo Base16
"49732033203e20323f">>>
convertedTo Base32
"JFZSAMZAHYQDEPY=">>>
convertedTo Base64
"SXMgMyA+IDI/">>>
convertedTo Base64URLUnpadded
"SXMgMyA-IDI_">>>
convertedTo Base64OpenBSD
"QVKeKw.8GBG9"
Base16 | similar to hexadecimal |
baseEncodedToSpanId :: Base -> ByteString -> Either String SpanId Source #
Convert a ByteString
of a specified base-encoding into a SpanId
.
Will fail if the decoded value is not exactly 8 bytes long.
Since: 0.1.0.0
spanIdBaseEncodedByteString :: Base -> SpanId -> ByteString Source #
Output a SpanId
into a base-encoded ByteString
.
Since: 0.1.0.0