| Stability | experimental |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
OpenTelemetry.SemanticsConfig
Description
Values are typically derived from OTEL_SEMCONV_STABILITY_OPT_IN via
getSemanticsOptions and queried per signal area with lookupStability.
Synopsis
- data SemanticsOptions
- data StabilityOpt
- = Stable
- | StableAndOld
- | Old
- type HttpOption = StabilityOpt
- lookupStability :: Text -> SemanticsOptions -> StabilityOpt
- httpOption :: SemanticsOptions -> StabilityOpt
- databaseOption :: SemanticsOptions -> StabilityOpt
- codeOption :: SemanticsOptions -> StabilityOpt
- getSemanticsOptions :: IO SemanticsOptions
- getSemanticsOptions' :: IO SemanticsOptions
Documentation
data SemanticsOptions Source #
Parsed representation of OTEL_SEMCONV_STABILITY_OPT_IN.
This is opaque: use lookupStability with any signal key (e.g. "http",
"database", "messaging") to query whether stable, old, or both conventions
should be emitted. Well-known accessors httpOption and databaseOption are
provided for convenience; third-party instrumentation libraries can query
arbitrary keys without modifying this module.
Since: 0.4.0.0
data StabilityOpt Source #
Stability setting for a particular semantic convention area.
Stable: emit only the new stable conventions.StableAndOld: emit both old and stable conventions (migration/dup mode).Old: emit only the legacy conventions (default when unset).
Since: 0.4.0.0
Constructors
| Stable | |
| StableAndOld | |
| Old |
Instances
| Show StabilityOpt Source # | |
Defined in OpenTelemetry.SemanticsConfig Methods showsPrec :: Int -> StabilityOpt -> ShowS # show :: StabilityOpt -> String # showList :: [StabilityOpt] -> ShowS # | |
| Eq StabilityOpt Source # | |
Defined in OpenTelemetry.SemanticsConfig | |
type HttpOption = StabilityOpt Source #
Backward-compatible alias.
Since: 0.4.0.0
lookupStability :: Text -> SemanticsOptions -> StabilityOpt Source #
Look up the stability setting for an arbitrary signal key.
Given a key like "http", "database", "messaging", etc., returns:
StableAndOldif<key>/dupis present in the env varStableif<key>is presentOldotherwise
opts <- getSemanticsOptions case lookupStability "messaging" opts of Stable -> emitStableAttrs StableAndOld -> emitStableAttrs >> emitOldAttrs Old -> emitOldAttrs
Since: 0.4.0.0
Well-known stability keys
httpOption :: SemanticsOptions -> StabilityOpt Source #
Stability setting for HTTP semantic conventions ("http" / "http/dup").
Since: 0.4.0.0
databaseOption :: SemanticsOptions -> StabilityOpt Source #
Stability setting for database semantic conventions ("database" / "database/dup").
Since: 0.4.0.0
codeOption :: SemanticsOptions -> StabilityOpt Source #
Stability setting for code source-location conventions ("code" / "code/dup").
Controls whether code.function.name, code.file.path, code.line.number (stable)
or code.function, code.namespace, code.filepath, code.lineno (legacy) are emitted.
Since: 0.5.0.0
Reading from the environment
getSemanticsOptions :: IO SemanticsOptions Source #
Retrieves OTEL_SEMCONV_STABILITY_OPT_IN and parses it into SemanticsOptions.
This uses the
global IORef trick
to memoize the settings for efficiency. Note that getSemanticsOptions stores
and returns the value of the first time it was called and will not change when
OTEL_SEMCONV_STABILITY_OPT_IN is updated. Use getSemanticsOptions' to read
the env var every time the function is called.
Since: 0.4.0.0
getSemanticsOptions' :: IO SemanticsOptions Source #
Version of getSemanticsOptions that is not memoized. It is recommended to
use getSemanticsOptions for efficiency purposes unless it is necessary to
retrieve the value of OTEL_SEMCONV_STABILITY_OPT_IN every time
getSemanticsOptions' is called.
Since: 0.4.0.0