-
Notifications
You must be signed in to change notification settings - Fork 1
Updates to add observability using open telemetry (otel) #50
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds comprehensive OpenTelemetry (OTEL) support to the go-client library, enabling distributed tracing and observability for HTTP clients and servers. The changes include a new pkg/otel package with span helpers, tracer provider initialization, and HTTP middleware, along with updates to integrate tracing throughout the codebase.
Changes:
- Added OpenTelemetry tracing infrastructure with support for OTLP exporters over HTTP and gRPC
- Integrated context.Context throughout API client methods to support trace propagation
- Refactored command-line tool to use Kong framework with OTEL environment variable support
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/otel/span.go | New file providing span creation helpers and HTTP client instrumentation |
| pkg/otel/provider.go | New file for tracer provider initialization with OTLP endpoint configuration |
| pkg/otel/middleware.go | New file providing HTTP server middleware for automatic span creation |
| client.go | Integrated tracer support and fixed span lifecycle, plus spelling correction |
| clientopts.go | Added OptTracer option for setting OpenTelemetry tracer |
| requestopts.go | Added OptSpan option (currently unused) |
| transport.go | Updated to use centralized RedactedURL function |
| pkg/homeassistant/*.go | Added context.Context parameters to all API methods |
| pkg/homeassistant/*_test.go | Updated tests to pass context.Background() |
| pkg/ipify/client.go | Added GetWithContext method |
| cmd/api/main.go | Refactored to Kong framework with OTEL initialization, but has file extension bug |
| cmd/api/ha.go | New file replacing homeassistant.go with Kong-based command structure |
| cmd/api/ipify.go | Updated to Kong-based command structure |
| README.md | Added comprehensive OpenTelemetry documentation with examples |
| go.mod | Updated Go version to 1.24.0 and added OTEL dependencies |
| go.sum | Added dependency checksums for new packages |
Comments suppressed due to low confidence (1)
cmd/api/main.go:123
- The file extension check at line 118 is incorrect. It uses
strings.ToLower(ctx.Path)which converts the entire path to lowercase, but then compares it against extensions like "csv" and "tsv". This will never match unless the entire path is exactly "csv" or "tsv". It should usepath.Ext(ctx.Path)orfilepath.Ext(ctx.Path)to extract the extension, then remove the leading dot and convert to lowercase.
ext := strings.ToLower(ctx.Path)
switch ext {
case "csv":
opts = append(opts, tablewriter.OptOutputCSV())
case "tsv":
opts = append(opts, tablewriter.OptOutputTSV())
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 25 out of 27 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request adds comprehensive OpenTelemetry (OTEL) support to the go-client library, enabling distributed tracing and observability for HTTP clients and servers. The changes include a new pkg/otel package with span helpers, tracer provider initialization, and HTTP middleware, along with updates to integrate tracing throughout the codebase.
Changes: