| Copyright | (c) Ian Duncan 2021-2026 |
|---|---|
| License | BSD-3 |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
OpenTelemetry.Attributes
Description
Overview
Attributes are key-value pairs attached to spans, events, links, and
resources. Keys are Text strings; values are one of the OpenTelemetry
primitive types: Text, Bool, Int64, Double, or arrays thereof.
Quick example
import OpenTelemetry.Attributes -- On a span: addAttribute span "http.request.method" (toAttribute GET) addAttribute span "http.response.status_code" (toAttribute (200 :: Int)) addAttributes span [ ("user.id", toAttribute "abc123") , ("user.role", toAttribute "admin") ] -- Using the builder API: let attrs = buildAttrs $ attr "http.request.method" (GET :: Text) <> attr "http.response.status_code" (200 :: Int)
Typed attribute keys
For type-safe attribute access, use AttributeKey:
import OpenTelemetry.Attributes.Key (AttributeKey(..), unkey) import qualified OpenTelemetry.SemanticConventions as SC let attrs' = addAttributeByKey defaultAttributeLimits attrs SC.http_request_method GET lookupAttributeByKey attrs' SC.http_response_statusCode -- Maybe Int64
Attribute limits
The SDK enforces limits on attribute count and value length, configured via
OTEL_ATTRIBUTE_COUNT_LIMIT and OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT
environment variables. When limits are exceeded, attributes are dropped
(tracked by getDropped).
Spec reference
Synopsis
- data Attributes
- emptyAttributes :: Attributes
- unsafeAttributesFromMap :: AttributeLimits -> AttributeMap -> Attributes
- addAttribute :: ToAttribute a => AttributeLimits -> Attributes -> Text -> a -> Attributes
- addAttributeByKey :: ToAttribute a => AttributeLimits -> Attributes -> AttributeKey a -> a -> Attributes
- addAttributes :: ToAttribute a => AttributeLimits -> Attributes -> HashMap Text a -> Attributes
- addAttributesFromBuilder :: AttributeLimits -> Attributes -> AttrsBuilder -> Attributes
- lookupAttribute :: Attributes -> Text -> Maybe Attribute
- lookupAttributeByKey :: FromAttribute a => Attributes -> AttributeKey a -> Maybe a
- getAttributeMap :: Attributes -> AttributeMap
- getCount :: Attributes -> Int
- getDropped :: Attributes -> Int
- data Attribute
- class ToAttribute a where
- toAttribute :: a -> Attribute
- class FromAttribute a where
- fromAttribute :: Attribute -> Maybe a
- data PrimitiveAttribute
- class ToPrimitiveAttribute a where
- class FromPrimitiveAttribute a where
- type AttributeMap = HashMap Text Attribute
- newtype AttributeKey a = AttributeKey {}
- newtype AttributeKey a = AttributeKey {}
- forget :: AttributeKey a -> AttributeKey Attribute
- data AttrsBuilder
- attr :: ToAttribute a => Text -> a -> AttrsBuilder
- optAttr :: ToAttribute a => Text -> Maybe a -> AttrsBuilder
- (.@) :: ToAttribute a => AttributeKey a -> a -> AttrsBuilder
- (.@?) :: ToAttribute a => AttributeKey a -> Maybe a -> AttrsBuilder
- buildAttrs :: AttrsBuilder -> AttributeMap
- data AttributeLimits = AttributeLimits {}
- defaultAttributeLimits :: AttributeLimits
- unsafeAttributesFromListIgnoringLimits :: [(Text, Attribute)] -> Attributes
- unsafeAttributesFromMapIgnoringLimits :: HashMap Text Attribute -> Attributes
- unsafeMergeAttributesIgnoringLimits :: Attributes -> Attributes -> Attributes
Documentation
data Attributes Source #
Since: 0.0.1.0
Instances
emptyAttributes :: Attributes Source #
Since: 0.0.1.0
unsafeAttributesFromMap :: AttributeLimits -> AttributeMap -> Attributes Source #
Build Attributes directly from a pre-built AttributeMap, applying
count and length limits. Faster than addAttributes limits emptyAttributes map
because it skips the per-key membership check against an empty base map.
Since: 0.4.0.0
addAttribute :: ToAttribute a => AttributeLimits -> Attributes -> Text -> a -> Attributes Source #
Since: 0.0.1.0
addAttributeByKey :: ToAttribute a => AttributeLimits -> Attributes -> AttributeKey a -> a -> Attributes Source #
Since: 0.0.1.0
addAttributes :: ToAttribute a => AttributeLimits -> Attributes -> HashMap Text a -> Attributes Source #
Since: 0.0.1.0
addAttributesFromBuilder :: AttributeLimits -> Attributes -> AttrsBuilder -> Attributes Source #
Like addAttributes, but consumes an AttrsBuilder instead of a HashMap.
Folds each attribute directly into the existing Attributes without allocating
an intermediate collection.
Since: 0.4.0.0
lookupAttribute :: Attributes -> Text -> Maybe Attribute Source #
Since: 0.0.1.0
lookupAttributeByKey :: FromAttribute a => Attributes -> AttributeKey a -> Maybe a Source #
Since: 0.0.1.0
getAttributeMap :: Attributes -> AttributeMap Source #
Since: 0.0.1.0
getCount :: Attributes -> Int Source #
Since: 0.0.1.0
getDropped :: Attributes -> Int Source #
Since: 0.0.1.0
Constructors
| AttributeValue PrimitiveAttribute | |
| AttributeArray [PrimitiveAttribute] |
Instances
| Data Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Attribute -> c Attribute # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Attribute # toConstr :: Attribute -> Constr # dataTypeOf :: Attribute -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Attribute) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attribute) # gmapT :: (forall b. Data b => b -> b) -> Attribute -> Attribute # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attribute -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attribute -> r # gmapQ :: (forall d. Data d => d -> u) -> Attribute -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Attribute -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Attribute -> m Attribute # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Attribute -> m Attribute # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Attribute -> m Attribute # | |||||
| IsString Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods fromString :: String -> Attribute # | |||||
| Generic Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Associated Types
| |||||
| Read Attribute | |||||
| Show Attribute | |||||
| Eq Attribute | |||||
| Ord Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute | |||||
| Hashable Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute | |||||
| FromAttribute Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Attribute # | |||||
| ToAttribute Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Attribute -> Attribute # | |||||
| Lift Attribute | |||||
| type Rep Attribute | |||||
Defined in OpenTelemetry.Attributes.Attribute type Rep Attribute = D1 ('MetaData "Attribute" "OpenTelemetry.Attributes.Attribute" "hs-opentelemetry-api-types-1.0.0.0-inplace" 'False) (C1 ('MetaCons "AttributeValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 PrimitiveAttribute)) :+: C1 ('MetaCons "AttributeArray" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [PrimitiveAttribute]))) | |||||
class ToAttribute a where #
Minimal complete definition
Nothing
Methods
toAttribute :: a -> Attribute #
Instances
| ToAttribute Int64 | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Int64 -> Attribute # | |
| ToAttribute Attribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Attribute -> Attribute # | |
| ToAttribute PrimitiveAttribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| ToAttribute Text | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Text -> Attribute # | |
| ToAttribute Bool | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Bool -> Attribute # | |
| ToAttribute Double | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Double -> Attribute # | |
| ToAttribute Int | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: Int -> Attribute # | |
| ToPrimitiveAttribute a => ToAttribute [a] | |
Defined in OpenTelemetry.Attributes.Attribute Methods toAttribute :: [a] -> Attribute # | |
class FromAttribute a where #
Minimal complete definition
Nothing
Methods
fromAttribute :: Attribute -> Maybe a #
Instances
| FromAttribute Int64 | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Int64 # | |
| FromAttribute Attribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Attribute # | |
| FromAttribute PrimitiveAttribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| FromAttribute Text | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Text # | |
| FromAttribute Bool | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Bool # | |
| FromAttribute Double | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Double # | |
| FromAttribute Int | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe Int # | |
| FromPrimitiveAttribute a => FromAttribute [a] | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromAttribute :: Attribute -> Maybe [a] # | |
data PrimitiveAttribute #
Constructors
| TextAttribute Text | |
| BoolAttribute Bool | |
| DoubleAttribute !Double | |
| IntAttribute !Int64 |
Instances
| Data PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrimitiveAttribute -> c PrimitiveAttribute # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PrimitiveAttribute # toConstr :: PrimitiveAttribute -> Constr # dataTypeOf :: PrimitiveAttribute -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PrimitiveAttribute) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PrimitiveAttribute) # gmapT :: (forall b. Data b => b -> b) -> PrimitiveAttribute -> PrimitiveAttribute # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrimitiveAttribute -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrimitiveAttribute -> r # gmapQ :: (forall d. Data d => d -> u) -> PrimitiveAttribute -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PrimitiveAttribute -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrimitiveAttribute -> m PrimitiveAttribute # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimitiveAttribute -> m PrimitiveAttribute # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrimitiveAttribute -> m PrimitiveAttribute # | |||||
| IsString PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods fromString :: String -> PrimitiveAttribute # | |||||
| Generic PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Associated Types
Methods from :: PrimitiveAttribute -> Rep PrimitiveAttribute x # to :: Rep PrimitiveAttribute x -> PrimitiveAttribute # | |||||
| Read PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods readsPrec :: Int -> ReadS PrimitiveAttribute # readList :: ReadS [PrimitiveAttribute] # | |||||
| Show PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods showsPrec :: Int -> PrimitiveAttribute -> ShowS # show :: PrimitiveAttribute -> String # showList :: [PrimitiveAttribute] -> ShowS # | |||||
| Eq PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods (==) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # (/=) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # | |||||
| Ord PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods compare :: PrimitiveAttribute -> PrimitiveAttribute -> Ordering # (<) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # (<=) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # (>) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # (>=) :: PrimitiveAttribute -> PrimitiveAttribute -> Bool # max :: PrimitiveAttribute -> PrimitiveAttribute -> PrimitiveAttribute # min :: PrimitiveAttribute -> PrimitiveAttribute -> PrimitiveAttribute # | |||||
| Hashable PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute | |||||
| FromAttribute PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods | |||||
| FromPrimitiveAttribute PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe PrimitiveAttribute # | |||||
| ToAttribute PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods | |||||
| ToPrimitiveAttribute PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods toPrimitiveAttribute :: PrimitiveAttribute -> PrimitiveAttribute # | |||||
| Lift PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute Methods lift :: Quote m => PrimitiveAttribute -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PrimitiveAttribute -> Code m PrimitiveAttribute # | |||||
| type Rep PrimitiveAttribute | |||||
Defined in OpenTelemetry.Attributes.Attribute type Rep PrimitiveAttribute = D1 ('MetaData "PrimitiveAttribute" "OpenTelemetry.Attributes.Attribute" "hs-opentelemetry-api-types-1.0.0.0-inplace" 'False) ((C1 ('MetaCons "TextAttribute" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "BoolAttribute" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :+: (C1 ('MetaCons "DoubleAttribute" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Double)) :+: C1 ('MetaCons "IntAttribute" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Int64)))) | |||||
class ToPrimitiveAttribute a where #
Methods
toPrimitiveAttribute :: a -> PrimitiveAttribute #
Instances
| ToPrimitiveAttribute Int64 | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| ToPrimitiveAttribute PrimitiveAttribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods toPrimitiveAttribute :: PrimitiveAttribute -> PrimitiveAttribute # | |
| ToPrimitiveAttribute Text | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| ToPrimitiveAttribute Bool | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| ToPrimitiveAttribute Double | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
| ToPrimitiveAttribute Int | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
class FromPrimitiveAttribute a where #
Methods
Instances
| FromPrimitiveAttribute Int64 | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe Int64 # | |
| FromPrimitiveAttribute PrimitiveAttribute | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe PrimitiveAttribute # | |
| FromPrimitiveAttribute Text | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe Text # | |
| FromPrimitiveAttribute Bool | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe Bool # | |
| FromPrimitiveAttribute Double | |
Defined in OpenTelemetry.Attributes.Attribute Methods fromPrimitiveAttribute :: PrimitiveAttribute -> Maybe Double # | |
| FromPrimitiveAttribute Int | |
Defined in OpenTelemetry.Attributes.Attribute Methods | |
newtype AttributeKey a #
Constructors
| AttributeKey | |
Instances
| IsString (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods fromString :: String -> AttributeKey a # | |||||
| Generic (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Associated Types
Methods from :: AttributeKey a -> Rep (AttributeKey a) x # to :: Rep (AttributeKey a) x -> AttributeKey a # | |||||
| Show (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods showsPrec :: Int -> AttributeKey a -> ShowS # show :: AttributeKey a -> String # showList :: [AttributeKey a] -> ShowS # | |||||
| Eq (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods (==) :: AttributeKey a -> AttributeKey a -> Bool # (/=) :: AttributeKey a -> AttributeKey a -> Bool # | |||||
| Ord (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods compare :: AttributeKey a -> AttributeKey a -> Ordering # (<) :: AttributeKey a -> AttributeKey a -> Bool # (<=) :: AttributeKey a -> AttributeKey a -> Bool # (>) :: AttributeKey a -> AttributeKey a -> Bool # (>=) :: AttributeKey a -> AttributeKey a -> Bool # max :: AttributeKey a -> AttributeKey a -> AttributeKey a # min :: AttributeKey a -> AttributeKey a -> AttributeKey a # | |||||
| type Rep (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key type Rep (AttributeKey a) = D1 ('MetaData "AttributeKey" "OpenTelemetry.Attributes.Key" "hs-opentelemetry-api-types-1.0.0.0-inplace" 'True) (C1 ('MetaCons "AttributeKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |||||
newtype AttributeKey a #
Constructors
| AttributeKey | |
Instances
| IsString (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods fromString :: String -> AttributeKey a # | |||||
| Generic (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Associated Types
Methods from :: AttributeKey a -> Rep (AttributeKey a) x # to :: Rep (AttributeKey a) x -> AttributeKey a # | |||||
| Show (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods showsPrec :: Int -> AttributeKey a -> ShowS # show :: AttributeKey a -> String # showList :: [AttributeKey a] -> ShowS # | |||||
| Eq (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods (==) :: AttributeKey a -> AttributeKey a -> Bool # (/=) :: AttributeKey a -> AttributeKey a -> Bool # | |||||
| Ord (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key Methods compare :: AttributeKey a -> AttributeKey a -> Ordering # (<) :: AttributeKey a -> AttributeKey a -> Bool # (<=) :: AttributeKey a -> AttributeKey a -> Bool # (>) :: AttributeKey a -> AttributeKey a -> Bool # (>=) :: AttributeKey a -> AttributeKey a -> Bool # max :: AttributeKey a -> AttributeKey a -> AttributeKey a # min :: AttributeKey a -> AttributeKey a -> AttributeKey a # | |||||
| type Rep (AttributeKey a) | |||||
Defined in OpenTelemetry.Attributes.Key type Rep (AttributeKey a) = D1 ('MetaData "AttributeKey" "OpenTelemetry.Attributes.Key" "hs-opentelemetry-api-types-1.0.0.0-inplace" 'True) (C1 ('MetaCons "AttributeKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |||||
forget :: AttributeKey a -> AttributeKey Attribute #
Attribute builder
data AttrsBuilder Source #
Church-encoded left fold over attribute key-value pairs. Avoids allocating
intermediate tuples, list spines, or HashMaps when adding multiple
attributes to a span.
Construct individual entries with attr / .@ and combine with <>.
GHC can inline and fuse static builder expressions, eliminating all
intermediate allocation.
addAttributes'span $ SC.http_request_method.@method <> SC.url_full.@url <> SC.server_port.@?mPort
Since: 0.4.0.0
Instances
| Monoid AttrsBuilder Source # | |
Defined in OpenTelemetry.Attributes Methods mempty :: AttrsBuilder # mappend :: AttrsBuilder -> AttrsBuilder -> AttrsBuilder # mconcat :: [AttrsBuilder] -> AttrsBuilder # | |
| Semigroup AttrsBuilder Source # | |
Defined in OpenTelemetry.Attributes Methods (<>) :: AttrsBuilder -> AttrsBuilder -> AttrsBuilder # sconcat :: NonEmpty AttrsBuilder -> AttrsBuilder # stimes :: Integral b => b -> AttrsBuilder -> AttrsBuilder # | |
attr :: ToAttribute a => Text -> a -> AttrsBuilder Source #
optAttr :: ToAttribute a => Text -> Maybe a -> AttrsBuilder Source #
Build an optional attribute entry. Nothing contributes nothing
to the builder (zero cost).
Since: 0.4.0.0
(.@) :: ToAttribute a => AttributeKey a -> a -> AttrsBuilder infixl 8 Source #
Build an attribute entry from a typed AttributeKey. Type-safe:
the value type must match the key's phantom type.
SC.http_request_method .@ (GET :: Text)
Since: 0.4.0.0
(.@?) :: ToAttribute a => AttributeKey a -> Maybe a -> AttrsBuilder infixl 8 Source #
Build an optional attribute entry from a typed AttributeKey.
Nothing contributes nothing to the builder.
Since: 0.4.0.0
buildAttrs :: AttrsBuilder -> AttributeMap Source #
Materialize a builder into an AttributeMap. Useful when a raw
HashMap is needed (e.g. for NewEvent attributes or SpanArguments).
Since: 0.4.0.0
Attribute limits
data AttributeLimits Source #
It is possible when adding attributes that a programming error might cause too many
attributes to be added to an event. Thus, Attributes use the limits set here as a safeguard
against excessive memory consumption.
Since: 0.0.1.0
Constructors
| AttributeLimits | |
Fields
| |
Instances
| Data AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AttributeLimits -> c AttributeLimits # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AttributeLimits # toConstr :: AttributeLimits -> Constr # dataTypeOf :: AttributeLimits -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AttributeLimits) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AttributeLimits) # gmapT :: (forall b. Data b => b -> b) -> AttributeLimits -> AttributeLimits # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AttributeLimits -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AttributeLimits -> r # gmapQ :: (forall d. Data d => d -> u) -> AttributeLimits -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> AttributeLimits -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AttributeLimits -> m AttributeLimits # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeLimits -> m AttributeLimits # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeLimits -> m AttributeLimits # | |||||
| Generic AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Associated Types
Methods from :: AttributeLimits -> Rep AttributeLimits x # to :: Rep AttributeLimits x -> AttributeLimits # | |||||
| Read AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Methods readsPrec :: Int -> ReadS AttributeLimits # readList :: ReadS [AttributeLimits] # | |||||
| Show AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Methods showsPrec :: Int -> AttributeLimits -> ShowS # show :: AttributeLimits -> String # showList :: [AttributeLimits] -> ShowS # | |||||
| Eq AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Methods (==) :: AttributeLimits -> AttributeLimits -> Bool # (/=) :: AttributeLimits -> AttributeLimits -> Bool # | |||||
| Ord AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes Methods compare :: AttributeLimits -> AttributeLimits -> Ordering # (<) :: AttributeLimits -> AttributeLimits -> Bool # (<=) :: AttributeLimits -> AttributeLimits -> Bool # (>) :: AttributeLimits -> AttributeLimits -> Bool # (>=) :: AttributeLimits -> AttributeLimits -> Bool # max :: AttributeLimits -> AttributeLimits -> AttributeLimits # min :: AttributeLimits -> AttributeLimits -> AttributeLimits # | |||||
| Hashable AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes | |||||
| type Rep AttributeLimits Source # | |||||
Defined in OpenTelemetry.Attributes type Rep AttributeLimits = D1 ('MetaData "AttributeLimits" "OpenTelemetry.Attributes" "hs-opentelemetry-api-1.0.0.0-inplace" 'False) (C1 ('MetaCons "AttributeLimits" 'PrefixI 'True) (S1 ('MetaSel ('Just "attributeCountLimit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "attributeLengthLimit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)))) | |||||
defaultAttributeLimits :: AttributeLimits Source #
Default attribute limits used in the global attribute limit configuration if no environment variables are set.
Values:
attributeCountLimit:Just 128attributeLengthLimit: orNothing
Since: 0.0.1.0
Unsafe utilities
unsafeAttributesFromListIgnoringLimits :: [(Text, Attribute)] -> Attributes Source #
Since: 0.0.1.0
unsafeAttributesFromMapIgnoringLimits :: HashMap Text Attribute -> Attributes Source #
Wrap a pre-built HashMap directly into Attributes with zero conversion.
No limit enforcement. Used by filterAttributesByKeys to avoid
a HashMap -> list -> HashMap roundtrip.
Since: 0.0.1.0
unsafeMergeAttributesIgnoringLimits :: Attributes -> Attributes -> Attributes Source #
Left-biased merge.
Since: 0.0.1.0