Open wrenix opened 1 month ago
Since Fuego is fully compatible with net/http
, I believe the oficial otel lib is already compatible https://pkg.go.dev/go.opentelemetry.io/otel.
But if you want to integrate this into the framework we might keep this issue.
Thanks for raising these issues!
yes needs integrating. or in caddy proxy perhaps.
There's really no need to implement anything unless you want the OTEL initialisation process to be a fuego.WithOTEL()
config option, but that would just be wrapping OTEL which needs to be configured specifically for each project anyway.
As @EwenQuim mentioned, to attach OTEL to the router you just need to apply the middleware like this:
fuego.Use(s, otelhttp.NewMiddleware("",
otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string {
return fmt.Sprintf("%s %s", r.Method, r.URL.Path)
}),
otelhttp.WithFilter(filters.Not(filters.Path("/ping"))),
))
In this setup I use fuego in a k8s pod, so I don't want my telemetry to be spammed by the health check endpoint /ping
This middleware with handle auto-instrumentation of the incoming requests as well as context parsing for multi-service tracing.
You still need to properly initialise an OTEL tracer docs here and pass the context around from c.Context()
, adding new spans where necessary, but no web router will do that for you, as it shouldn't be the router's responsibility.
To store and evaluate in Tempo and/or Jaeger.
https://opentelemetry.io/docs/languages/go/