Skip to content

Conversation

@djthorpe
Copy link
Member

@djthorpe djthorpe commented Jan 10, 2026

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

@djthorpe djthorpe self-assigned this Jan 10, 2026
Copilot AI review requested due to automatic review settings January 10, 2026 10:44
Copy link
Contributor

Copilot AI left a 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 use path.Ext(ctx.Path) or filepath.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.

Copy link
Contributor

Copilot AI left a 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.

@djthorpe djthorpe merged commit bb3ce4c into main Jan 10, 2026
3 checks passed
@djthorpe djthorpe deleted the djt-1108/observability branch January 10, 2026 11:24
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 this pull request may close these issues.

2 participants