Skip to content

IdGenerator and Propagator for hs-opentelemetry-sdk that generates and propagates TraceId and SpanId values that are compatible with AWS X-Ray

License

Notifications You must be signed in to change notification settings

freckle/hs-opentelemetry-awsxray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS X-Ray Support for hs-opentelemetry

CI

An IdGenerator and Propagator for hs-opentelemetry-sdk that generates and propagates TraceId and SpanId values that are compatible with AWS X-Ray.

Usage

The API currently exposed by the hs-opentelemetry-sdk package lacks a convenient way to modify the TracerProviderOptions (to tell it to use our generator/propagator) as part of initialization. You basically have to re-implement the internals of initializeTracerProvider to do so.

While we plan to open a PR upstream to address the lack of API here, the workaround approach has at least been been encapsulated in a module of this library for convenience:

import OpenTelemetry.AWSXRay
import OpenTelemetry.Trace
import OpenTelemetry.Trace.Setup
import OpenTelemetry.Trace.Setup.Lens

main :: IO ()
main = do
  withTracerProvider modifyTracerProviderOptions $ \tracerProvider -> do
    let tracer = makeTracer tracerProvider "my-app" tracerOptions

    -- do something with tracer

modifyTracerProviderOptions :: TracerProviderOptions -> TracerProviderOptions
modifyTracerProviderOptions =
  idGeneratorL .~ awsXRayIdGenerator
    . propagatorL <>~ awsXRayContextPropagator

This example uses lens, but you certainly don't have to.

Additional References


CHANGELOG | LICENSE

About

IdGenerator and Propagator for hs-opentelemetry-sdk that generates and propagates TraceId and SpanId values that are compatible with AWS X-Ray

Topics

Resources

License

Stars

Watchers

Forks