Open adigiorgi-clickup opened 5 months ago
Good suggestion! We would also like to use this feature. We have hijacked the metrics call to achieve this but this approach would be way better.
I've prepared a different pr for adding custom labels to already created metrics but I think it is not appropriate in your case.
But it is in the same area of customizing metrics so it would be good to do the above!
Hi! I have a request modifier plugin that uses go-redis, and I'd like to instrument it via https://pkg.go.dev/github.com/redis/go-redis/extra/redisotel/v9.
To be able to send custom metrics and spans from a plugin, I need access to the OTEL meter and tracer providers, but AFAIK krakend-otel never calls https://pkg.go.dev/go.opentelemetry.io/otel#SetMeterProvider and https://pkg.go.dev/go.opentelemetry.io/otel#SetTracerProvider, which means the only way to get them from a plugin is to import
github.com/krakend/krakend-otel/state
and callstate.GlobalState()
.This works, but I think it would be better if plugins didn't have to depend on krakend-otel directly 😄
I can prepare a PR to make these calls in https://github.com/krakend/krakend-otel/blob/main/state/global.go, if you want. Thanks!