hs-opentelemetry-vendor-honeycomb-0.0.1.2: Optional OpenTelemetry integration for Honeycomb
Safe HaskellSafe-Inferred
LanguageHaskell2010

OpenTelemetry.Vendor.Honeycomb

Description

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

Types

newtype HoneycombTeam Source #

Honeycomb team name; generally appears in the URL after ui.honeycomb.io/.

Constructors

HoneycombTeam 

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.

Constructors

EnvironmentName 

Getting the Honeycomb target dataset/team name

getOrInitializeHoneycombTargetInContext Source #

Arguments

:: 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

Instances details
Show DatasetInfo Source # 
Instance details

Defined in OpenTelemetry.Vendor.Honeycomb

Eq DatasetInfo Source # 
Instance details

Defined in OpenTelemetry.Vendor.Honeycomb

data HoneycombTarget Source #

A fully qualified Honeycomb dataset, possibly with environment.

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