-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
OpenTelemetry integration #292
Comments
One approach is to make the gem more extendable. The HTTP gem does a great job at this. Here’s some examples: https://github.com/httprb/http/tree/main/lib/http/features If this gem would have the right hooks, it allow anyone anyone to more easily build features like telemetry on top of it. |
@jamiemccarthy - v6.3 allows you to add custom Faraday middleware - see README - I think this could be used to link to OpenTelemetry? |
Info on this - https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-faraday/v0.16.0/ - could be nice to add instructions to the README if people would find it useful |
Cool, I'll see about giving this a try in my project shortly, thanks for the suggestion |
I'm writing an app with
ruby-openai
and it gives me a bit of a worry that I don't know how much I'm spending on OpenAI. I would like a pane on my Honeycomb.ai dashboard measuring how much data I'm sending and receiving. Adding alerting to my dashboard for unexpectedly high usage would give me peace of mind. And if latency of OpenAI's servers was also instrumented, so I could see that latency in traces, that would help me understand what performance I should expect as well.OpenTelemetry seems like the natural way to instrument this. Here's a list of existing libraries. I'd love to add
to my
config/initializers/opentelemetry.rb
and have myruby-openai
usage magically become available on my Honeycomb dashboard. Or of course it would work for whatever other provider people are using.My suggested implementation would be to make the telemetry class a separate gem, and add a check whether the gem's class is defined in
OpenAI::HTTP#json_post
and related methods. If so, wrap the methods' functionality in a tracing block. But I'm open to alternatives. I haven't actually written a telemetry module before, so maybe thinking it's easy is hubris on my part.Alternatively, I could add a similar wrapper in my own app and just use it for personal use. But this seems like something that would benefit the community and might as well be shared.
The text was updated successfully, but these errors were encountered: