#otel go plumbing

1 messages ยท Page 1 of 1 (latest)

bronze moat
#

easiest way is to use github.com/dagger/otel-go since it automates all the setup. in main(), do ctx = daggerotel.InitEmbedded(ctx, nil) and defer daggerotel.Close(), from then on just use otel sdk "like normal"

sick fjord
#

FYI this is what the LLM landed on, after me telling it to simplify several times:

   import (
    telemetry "github.com/dagger/otel-go"
   )

   func main() {
    ctx := telemetry.Init(context.Background(), telemetry.Config{Detect: true})
    defer telemetry.Close()
   }
bronze moat
sick fjord
#

@bronze moat also for starting a new thread, should I create my own Tracer() wrapper function?

#

currently:

daggerotel.Tracer(ctx, "my-thing").Start(ctx, "my span')

#

possibly wrapped by: myTracer(ctx).Start(ctx, "my span")

#

which kind of makes me want to collapse further to startSpan(ctx, "my span") ๐Ÿ˜›