@hackage hs-opentelemetry-vendor-honeycomb1.0.0.0

Optional OpenTelemetry integration for Honeycomb

Honeycomb Utilities

hs-opentelemetry-vendor-honeycomb

Utilities for deriving Honeycomb-specific constructs from OpenTelemetry instrumentation.

Usage

For example, the following will print the URL for the Honeycomb trace visualization associated with the current span:

do
  config <- getConfigPartsFromEnv >>= \case
    Nothing -> throwIO $ userError "invalid Honeycomb config"
    Just (teamWriteKey, datasetName) -> pure $ HoneyComb.config teamWriteKey datasetName
  provider <- getGlobalTracerProvider
  target <- resolveHoneycombTarget provider config

  timestamp <- Data.Time.Clock.getCurrentTime

  context <- OpenTelemetry.Context.ThreadLocal.lookupContext >>= \case
    Nothing -> throwIO $ userError "no trace context available"
    Just context -> pure context
  spanContext <- OpenTelemetry.Context.lookupSpan context >>= \case
    Nothing -> throwIO $ userError "no span in trace context"
    Just span -> getSpanContext span

  print $ makeDirectTraceLink target timestamp spanContext.traceId