Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Vendor integration for Honeycomb.
This lets you link to traces. You don't need this to send data to Honeycomb,
for which hs-opentelemetry-exporter-otlp
is suitable.
Synopsis
- newtype HoneycombTeam = HoneycombTeam {}
- newtype EnvironmentName = EnvironmentName {}
- getOrInitializeHoneycombTargetInContext :: MonadIO m => NominalDiffTime -> m (Maybe HoneycombTarget)
- getHoneycombTargetInContext :: MonadIO m => m (Maybe HoneycombTarget)
- getConfigPartsFromEnv :: MonadIO m => TracerProvider -> m (Maybe (Text, DatasetName))
- getHoneycombData :: MonadIO m => Config -> m (HoneycombTeam, Maybe EnvironmentName)
- resolveHoneycombTarget :: MonadIO m => TracerProvider -> Config -> m (Maybe HoneycombTarget)
- data DatasetInfo
- data HoneycombTarget = HoneycombTarget {}
- makeDirectTraceLink :: HoneycombTarget -> UTCTime -> TraceId -> ByteString
- getHoneycombLink :: MonadIO m => m (Maybe ByteString)
- getHoneycombLink' :: MonadIO m => HoneycombTarget -> m (Maybe ByteString)
- module Honeycomb.API.Auth
- module Honeycomb.Config
Types
newtype HoneycombTeam Source #
Honeycomb team name; generally appears in the URL after ui.honeycomb.io/
.
Instances
IsString HoneycombTeam Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb fromString :: String -> HoneycombTeam # | |
Show HoneycombTeam Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb showsPrec :: Int -> HoneycombTeam -> ShowS # show :: HoneycombTeam -> String # showList :: [HoneycombTeam] -> ShowS # | |
Eq HoneycombTeam Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb (==) :: HoneycombTeam -> HoneycombTeam -> Bool # (/=) :: HoneycombTeam -> HoneycombTeam -> Bool # |
newtype EnvironmentName Source #
Environment name in the Environments & Services data model (referred to as "Current" in this package).
See https://docs.honeycomb.io/honeycomb-classic/ for more details.
Instances
IsString EnvironmentName Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb fromString :: String -> EnvironmentName # | |
Show EnvironmentName Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb showsPrec :: Int -> EnvironmentName -> ShowS # show :: EnvironmentName -> String # showList :: [EnvironmentName] -> ShowS # | |
Eq EnvironmentName Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb (==) :: EnvironmentName -> EnvironmentName -> Bool # (/=) :: EnvironmentName -> EnvironmentName -> Bool # |
Getting the Honeycomb target dataset/team name
getOrInitializeHoneycombTargetInContext Source #
:: MonadIO m | |
=> NominalDiffTime | Timeout for the operation before assuming Honeycomb is inaccessible |
-> m (Maybe HoneycombTarget) |
Gets or initializes the Honeycomb target in the thread-local
Context
.
This should be called inside the root span at application startup in order to ensure that this context is the parent of all child contexts in which you might want to get the target (for instance to generate Honeycomb links).
getHoneycombTargetInContext :: MonadIO m => m (Maybe HoneycombTarget) Source #
Simple function to get the Honeycomb target out of the global context.
At application startup, run getOrInitializeHoneycombTargetInContext
before
calling this, or else you will get Nothing
.
This is the right function for most use cases.
Detailed API
getConfigPartsFromEnv :: MonadIO m => TracerProvider -> m (Maybe (Text, DatasetName)) Source #
Gets the Honeycomb configuration from the environment.
This does not do any HTTP.
FIXME(jadel): This should ideally fetch this from the tracer provider, but it's nonobvious how to architect being able to do that (requires changes in hs-opentelemetry-api). For now let's take a Tracer such that we can fix it later, then do it the obvious way.
getHoneycombData :: MonadIO m => Config -> m (HoneycombTeam, Maybe EnvironmentName) Source #
Gets the team name and environment name for the OTLP exporter using the API key from the environment.
This calls Honeycomb.
N.B. Use config
to construct a config from getConfigPartsFromEnv
.
N.B. The EnvironmentName will be Nothing if the API key is for a Honeycomb Classic instance.
resolveHoneycombTarget :: MonadIO m => TracerProvider -> Config -> m (Maybe HoneycombTarget) Source #
Takes a Config
and pokes around both Honeycomb HTTP API and the
trace environment to figure out where events will land in Honeycomb.
data DatasetInfo Source #
Either a current-Honeycomb environment+dataset pair, or a Honeycomb Classic dataset
Instances
Show DatasetInfo Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb showsPrec :: Int -> DatasetInfo -> ShowS # show :: DatasetInfo -> String # showList :: [DatasetInfo] -> ShowS # | |
Eq DatasetInfo Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb (==) :: DatasetInfo -> DatasetInfo -> Bool # (/=) :: DatasetInfo -> DatasetInfo -> Bool # |
data HoneycombTarget Source #
A fully qualified Honeycomb dataset, possibly with environment.
Instances
Show HoneycombTarget Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb showsPrec :: Int -> HoneycombTarget -> ShowS # show :: HoneycombTarget -> String # showList :: [HoneycombTarget] -> ShowS # | |
Eq HoneycombTarget Source # | |
Defined in OpenTelemetry.Vendor.Honeycomb (==) :: HoneycombTarget -> HoneycombTarget -> Bool # (/=) :: HoneycombTarget -> HoneycombTarget -> Bool # |
Making trace links
makeDirectTraceLink :: HoneycombTarget -> UTCTime -> TraceId -> ByteString Source #
Formats a direct link to a trace.
See https://docs.honeycomb.io/api/direct-trace-links/ for more details.
The URLs generated will look like the following:
Honeycomb Current:
https://ui.honeycomb.io/<team>/environments/<environment>/datasets/<dataset>/trace ?trace_id=<traceId> &trace_start_ts=<ts> &trace_end_ts=<ts>
Honeycomb Classic:
https://ui.honeycomb.io/<team>/datasets/<dataset>/trace ?trace_id=<traceId> &trace_start_ts=<ts> &trace_end_ts=<ts>
getHoneycombLink :: MonadIO m => m (Maybe ByteString) Source #
Gets a trace link for the current trace.
Needs to have the thread-local target initialized; see
getOrInitializeHoneycombTargetInContext
.
getHoneycombLink' :: MonadIO m => HoneycombTarget -> m (Maybe ByteString) Source #
Gets a trace link for the current trace with an explicitly provided target.
Performing manual Honeycomb requests
module Honeycomb.API.Auth
module Honeycomb.Config