Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sending OTEL metrics and spans from KrakenD plugins #21

Open
adigiorgi-clickup opened this issue May 4, 2024 · 1 comment · May be fixed by #28
Open

Support sending OTEL metrics and spans from KrakenD plugins #21

adigiorgi-clickup opened this issue May 4, 2024 · 1 comment · May be fixed by #28

Comments

@adigiorgi-clickup
Copy link
Contributor

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 call state.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!

@rassmate
Copy link

rassmate commented May 6, 2024

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!

@adigiorgi-clickup adigiorgi-clickup linked a pull request May 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants