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

OpenTelemetry instrumentation for go-openai #634

Open
nirga opened this issue Jan 9, 2024 · 5 comments
Open

OpenTelemetry instrumentation for go-openai #634

nirga opened this issue Jan 9, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@nirga
Copy link

nirga commented Jan 9, 2024

Is your feature request related to a problem? Please describe.
I'm the maintainer of OpenLLMetry where we built a set of extensions of OpenTelemetry for GenAI applications. We currently support Python and Typescript (where we can easily monkey-patch the libraries within our instrumentations) and want to extend this to Go. Because there isn't a way to easily monkey-patch code in Go, we currently force our users to do it manually and I'd love to add this natively to your SDK so it will happen automagically.

Describe the solution you'd like
An ability for a user to turn on go opentelemetry instrumentation which uses our semantic convention. Then, the user can connect it to any observability tools they want - Datadog, Honeycomb, Traceloop, etc.

Additional context
Willing to do the PR and the work, just wanted a buy-in from the team before starting to work.

@nirga nirga added the enhancement New feature or request label Jan 9, 2024
@sashabaranov
Copy link
Owner

Hey @nirga, that sounds like a really nice-to-have feature! Before we go to the implementation stage, what's your vision on how end-user API could look like?

@nirga
Copy link
Author

nirga commented Jan 11, 2024

@sashabaranov that's a good question! I was thinking to have the user enable tracing by calling some function on the openai client object like -

client := openai.NewClient("token")
tracer := traceloop.NewTracer()
client.enableTracing(tracer)

Or it can even be when creating the client

@sashabaranov
Copy link
Owner

@nirga sounds good! Let's just make sure that the tracer is passed as an interface so it would be possible to instrument with other libraries, too.

@nirga
Copy link
Author

nirga commented Jan 22, 2024

I'll get to work on this this week @sashabaranov
Is it ok if I use our DTO for describing messages / prompts / etc.?

@sashabaranov
Copy link
Owner

sashabaranov commented Jan 23, 2024

@nirga Sorry, I'm not sure I 100% understand the question.

I think that the client<->tracer interface should not lose any information and be ergonomic at the same time.

In terms of "not losing information", — we can pass complete requests (JSON-encoded strings?) and a tracer can take all the information it needs. We can even use HTTP tracing https://go.dev/blog/http-tracing — it's possible to specify custom HTTP client/transport with this library (see proxying example in the README).

But I'm not sure whether this would be useful and ergonomic for tracers to use — would love your input here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants