Copyright | (c) Ian Duncan 2021 |
---|---|
License | BSD-3 |
Maintainer | Ian Duncan |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
An Attribute is a key-value pair, which MUST have the following properties:
- The attribute key MUST be a non-null and non-empty string.
- The attribute value is either:
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
- An array of primitive type values. The array MUST be homogeneous, i.e., it MUST NOT contain values of different types. For protocols that do not natively support array values such values SHOULD be represented as JSON strings.
- Attribute values expressing a numerical value of zero, an empty string, or an empty array are considered meaningful and MUST be stored and passed on to processors / exporters.
Synopsis
- data Attributes
- emptyAttributes :: Attributes
- addAttribute :: ToAttribute a => AttributeLimits -> Attributes -> Text -> a -> Attributes
- addAttributes :: ToAttribute a => AttributeLimits -> Attributes -> HashMap Text a -> Attributes
- getAttributes :: Attributes -> (Int, HashMap Text Attribute)
- lookupAttribute :: Attributes -> Text -> Maybe Attribute
- data Attribute
- class ToAttribute a where
- toAttribute :: a -> Attribute
- data PrimitiveAttribute
- class ToPrimitiveAttribute a where
- data AttributeLimits = AttributeLimits {}
- defaultAttributeLimits :: AttributeLimits
- unsafeAttributesFromListIgnoringLimits :: [(Text, Attribute)] -> Attributes
- unsafeMergeAttributesIgnoringLimits :: Attributes -> Attributes -> Attributes
Documentation
data Attributes Source #
Instances
addAttribute :: ToAttribute a => AttributeLimits -> Attributes -> Text -> a -> Attributes Source #
addAttributes :: ToAttribute a => AttributeLimits -> Attributes -> HashMap Text a -> Attributes Source #
getAttributes :: Attributes -> (Int, HashMap Text Attribute) Source #
lookupAttribute :: Attributes -> Text -> Maybe Attribute Source #
An attribute represents user-provided metadata about a span, link, or event.
Telemetry tools may use this data to support high-cardinality querying, visualization in waterfall diagrams, trace sampling decisions, and more.
AttributeValue PrimitiveAttribute | An attribute representing a single primitive value |
AttributeArray [PrimitiveAttribute] | An attribute representing an array of primitive values. All values in the array MUST be of the same primitive attribute type. |
Instances
class ToAttribute a where Source #
Convert a Haskell value to an Attribute
value.
For most values, you can define an instance of ToPrimitiveAttribute
and use the default toAttribute
implementation:
data Foo = Foo instance ToPrimitiveAttribute Foo where toPrimitiveAttribute Foo = TextAttribute Foo instance ToAttribute foo
Nothing
toAttribute :: a -> Attribute Source #
default toAttribute :: ToPrimitiveAttribute a => a -> Attribute Source #
Instances
ToAttribute Int64 Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Int64 -> Attribute Source # | |
ToAttribute Attribute Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Attribute -> Attribute Source # | |
ToAttribute PrimitiveAttribute Source # | |
Defined in OpenTelemetry.Attributes | |
ToAttribute Text Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Text -> Attribute Source # | |
ToAttribute Bool Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Bool -> Attribute Source # | |
ToAttribute Double Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Double -> Attribute Source # | |
ToAttribute Int Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: Int -> Attribute Source # | |
ToPrimitiveAttribute a => ToAttribute [a] Source # | |
Defined in OpenTelemetry.Attributes toAttribute :: [a] -> Attribute Source # |
data PrimitiveAttribute Source #
Instances
class ToPrimitiveAttribute a where Source #
Convert a Haskell value to a PrimitiveAttribute
value.
Instances
ToPrimitiveAttribute Int64 Source # | |
Defined in OpenTelemetry.Attributes | |
ToPrimitiveAttribute PrimitiveAttribute Source # | |
Defined in OpenTelemetry.Attributes | |
ToPrimitiveAttribute Text Source # | |
Defined in OpenTelemetry.Attributes | |
ToPrimitiveAttribute Bool Source # | |
Defined in OpenTelemetry.Attributes | |
ToPrimitiveAttribute Double Source # | |
Defined in OpenTelemetry.Attributes | |
ToPrimitiveAttribute Int Source # | |
Defined in OpenTelemetry.Attributes |
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.
AttributeLimits | |
|
Instances
defaultAttributeLimits :: AttributeLimits Source #
Default attribute limits used in the global attribute limit configuration if no environment variables are set.
Values:
attributeCountLimit
:Just 128
attributeLengthLimit
: orNothing
Unsafe utilities
unsafeMergeAttributesIgnoringLimits :: Attributes -> Attributes -> Attributes Source #
Left-biased merge.