The otelstack package provides an easy to use pop-up OTEL testcontainers stack for use in go
Usage
stack := New()
shutdownFunc, err := stack.Start(t.Context())
require.NotNil(t, err, "the stack must start up")
// be sure to defer shutdown of the stack
t.Cleanup(func() {
if err := shutdownFunc(context.Background()); err != nil {
t.Logf("error shutting down stack: %v", err)
}
})
// For optionally setting OTEL_EXPORTER_OTLP_INSECURE and OTEL_EXPORTER_OTLP_ENDPOINT
stack.SetTestEnv(t)
// ports can be accessed as such
t.Logf("Seq ui: http://localhost:%d", stack.Seq.Ports[80].Int())
t.Logf("Jaeger ui: http://localhost:%d", stack.Seq.Ports[16686].Int())
// Continue to initialise your own otel setup here
// Your telemetry will now be sent to the stack