feat(go): Go SDK with OpenAI instrumentor#166
Open
pmady wants to merge 5 commits intofuture-agi:mainfrom
Open
Conversation
Scaffold the Go SDK with OTel TracerProvider setup, GenAI semantic convention keys, and the Instrumentor interface. Signed-off-by: pmady <pavan4devops@gmail.com>
HTTP middleware that intercepts chat/completion/embedding calls and records them as OTel spans with GenAI semconv attributes. Signed-off-by: pmady <pavan4devops@gmail.com>
Covers chat completion happy path, non-AI endpoint passthrough, error response handling, and content capture toggle. Signed-off-by: pmady <pavan4devops@gmail.com>
Signed-off-by: pmady <pavan4devops@gmail.com>
Signed-off-by: pmady <pavan4devops@gmail.com>
Author
|
this covers finding 7 from #164. middleware approach means no hard dep on the openai-go library -- any HTTP client hitting their API paths gets traced. the module structure mirrors what python does (core + per-framework packages) so adding anthropic/cohere later is straightforward. cc @niaborowy @JayaSurya-27 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a Go SDK for traceAI. Two modules:
go/traceai— core setup (TracerProvider config, GenAI semconv keys, env-based defaults)go/traceai_openai— HTTP middleware for theopenai-goclient that captures chat/completion/embedding calls as OTel spansWhy?
Go SDK was listed on the roadmap (#164 finding 7). Lots of Go services calling LLM APIs directly or through gateways, and there was no Go instrumentation path.
How was it tested?
go test ./...passes in both modules (4 tests covering happy path, passthrough, error, content capture toggle)go vet ./...cleanChecklist
mainNotes for reviewers
5 commits over ~9 days. The middleware operates on
net/httptypes so it doesn't pull in the openai-go library as a dependency — works with any HTTP client that hits the OpenAI API path patterns.Related: #164, #165