这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@hgiasac
Copy link
Collaborator

@hgiasac hgiasac commented Nov 11, 2025

This pull request introduces a comprehensive example setup for OpenTelemetry instrumentation and logging, including new middleware for HTTP tracing, example configuration files, and improvements to logging utilities. The changes provide a ready-to-use demonstration environment and enhance observability features in the codebase.

New Example and Observability Infrastructure:

  • Added a complete example environment in the example/ directory, including a compose.yaml for running OpenTelemetry Collector, Prometheus, and Jaeger, configuration files for each service, and a sample server.go demonstrating HTTP tracing and logging integration. [1] [2] [3] [4] [5]

Tracing and Metrics Middleware:

  • Introduced a new middleware.go implementing HTTP middleware for OpenTelemetry tracing, metrics, and structured logging. This middleware supports options for controlling cardinality, debug paths, and allowed headers.

Logging Utility Enhancements:

  • Improved logger context handling in logger.go by refactoring context logger retrieval and adding support for extracting loggers directly from HTTP requests. Also renamed NewContextLogger to NewContextWithLogger for clarity. [1] [2] [3]

Dependency Updates:

  • Updated dependencies in go.mod to newer versions for several packages, including prometheus/common, prometheus/procfs, and go.opentelemetry.io/proto/otlp. Added github.com/google/uuid as a direct dependency. [1] [2]

Linting Configuration:

  • Enabled the varnamelen linter in .golangci.yml to enforce variable name length standards.

@hgiasac hgiasac merged commit 0af9e5f into main Nov 11, 2025
1 check passed
@hgiasac hgiasac deleted the add-tracing-middleware branch November 11, 2025 17:42
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.

1 participant