[PR #79] [MERGED] Enhance observability with OTLP timeout and API unification #1142

Closed
opened 2026-07-13 12:36:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/gerbil/pull/79
Author: @marcschaeferger
Created: 5/3/2026
Status: Merged
Merged: 5/3/2026
Merged by: @oschwartz10612

Base: devHead: observability-update


📝 Commits (8)

  • 4a322a4 chore(docs): add OTLP timeout docs and minor fixes
  • f130a7c chore(deps): update OpenTelemetry and related modules
  • bcb5cc4 refactor(metrics): safe initialization and instrument factory
  • 73d4d4d feat(observability): unify backend APIs and harden OTel handling
  • 191b4fa feat(prometheus): robust label validation and registration handling
  • cda6fa6 feat(cli/proxy): add OTLP timeout flag and make proxy metrics resilient
  • 3f95e2d fix(otel): revert semconv version and correct deployment environment attribute
  • 375cb8b Update CODEOWNERS

📊 Changes

20 files changed (+1142 additions, -278 deletions)

View changed files

📝 README.md (+1 -1)
📝 docs/observability.md (+8 -4)
📝 examples/otel-collector-config.yaml (+2 -1)
📝 go.mod (+12 -12)
📝 go.sum (+26 -26)
📝 internal/metrics/metrics.go (+474 -72)
📝 internal/metrics/metrics_test.go (+8 -4)
📝 internal/observability/config.go (+11 -1)
📝 internal/observability/metrics.go (+16 -15)
📝 internal/observability/metrics_test.go (+82 -17)
📝 internal/observability/noop.go (+10 -17)
📝 internal/observability/noop_test.go (+51 -16)
📝 internal/observability/otel/backend.go (+131 -32)
📝 internal/observability/otel/backend_test.go (+39 -5)
📝 internal/observability/otel/exporter.go (+20 -2)
📝 internal/observability/otel/resource.go (+3 -3)
📝 internal/observability/prometheus/backend.go (+154 -29)
📝 internal/observability/prometheus/backend_test.go (+68 -10)
📝 main.go (+16 -1)
📝 proxy/proxy.go (+10 -10)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description (generated by Copilot)

This pull request introduces several improvements and updates to the observability and metrics subsystem, focusing on OpenTelemetry (OTel) configuration, validation, and documentation. It also includes dependency updates, minor test improvements, and a new code ownership assignment.

Key highlights:

  • Adds a configurable timeout for OTel exporter initialization, with documentation and validation.
  • Updates the OTel Go dependencies to the latest versions.
  • Improves the validation logic for metrics backends.
  • Updates documentation and examples for clarity and correctness.
  • Refactors metric backend interfaces for better error handling.

Observability & Metrics Configuration

  • Added a Timeout field to the OTelConfig struct, allowing configuration of the OTLP exporter connection setup timeout (default 10s). Updated all related documentation, CLI flags, and environment variable references to include this new option. [1] [2] [3] [4] [5] [6] [7]
  • Enhanced validation logic for the metrics backend: now requires a non-empty backend when metrics are enabled, and validates that the OTel timeout is positive. Added corresponding test cases for invalid configurations. [1] [2] [3] [4]

Dependency & Interface Updates

  • Updated Go OpenTelemetry dependencies and related libraries to the latest versions (1.43.0), ensuring compatibility and bug fixes. [1] [2]
  • Changed the metrics backend interface methods (NewCounter, NewUpDownCounter, etc.) to return errors, propagating error handling from the underlying implementations. [1] [2] [3]

Documentation & Examples

  • Improved documentation for OTel metrics, including new timeout configuration, correct CLI flag defaults, and fixed example commands for Prometheus and OTel backends. [1] [2]
  • Added a missing file_format field to the example OTel collector config.

Testing Improvements

  • Improved test setup and coverage for metrics initialization, shutdown, and validation, including new cases for OTel timeout and backend validation. [1] [2] [3] [4]

Miscellaneous

  • Added code ownership for the internal/observability/** directory. (.github/CODEOWNERS)

How to test?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/gerbil/pull/79 **Author:** [@marcschaeferger](https://github.com/marcschaeferger) **Created:** 5/3/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `dev` ← **Head:** `observability-update` --- ### 📝 Commits (8) - [`4a322a4`](https://github.com/fosrl/gerbil/commit/4a322a436bd0502231cbce1dbe26ba5ed4425018) chore(docs): add OTLP timeout docs and minor fixes - [`f130a7c`](https://github.com/fosrl/gerbil/commit/f130a7cdb80ac50f1bf806f8febfa597cc4294db) chore(deps): update OpenTelemetry and related modules - [`bcb5cc4`](https://github.com/fosrl/gerbil/commit/bcb5cc4746b64e1d8969ef92a9076b898a32672c) refactor(metrics): safe initialization and instrument factory - [`73d4d4d`](https://github.com/fosrl/gerbil/commit/73d4d4d37cbc8a108dc66a10cc99f158d1b33ca5) feat(observability): unify backend APIs and harden OTel handling - [`191b4fa`](https://github.com/fosrl/gerbil/commit/191b4fa26a390b3d5651ed8fe7eb9b5dce76174b) feat(prometheus): robust label validation and registration handling - [`cda6fa6`](https://github.com/fosrl/gerbil/commit/cda6fa677295aa48ce1781092675b78c35b793b7) feat(cli/proxy): add OTLP timeout flag and make proxy metrics resilient - [`3f95e2d`](https://github.com/fosrl/gerbil/commit/3f95e2da255c4592a932b3297ed4e256a7bb7aa6) fix(otel): revert semconv version and correct deployment environment attribute - [`375cb8b`](https://github.com/fosrl/gerbil/commit/375cb8b0bae6c0a8e2bf50ec7355cce4e1ab8c6a) Update CODEOWNERS ### 📊 Changes **20 files changed** (+1142 additions, -278 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `docs/observability.md` (+8 -4) 📝 `examples/otel-collector-config.yaml` (+2 -1) 📝 `go.mod` (+12 -12) 📝 `go.sum` (+26 -26) 📝 `internal/metrics/metrics.go` (+474 -72) 📝 `internal/metrics/metrics_test.go` (+8 -4) 📝 `internal/observability/config.go` (+11 -1) 📝 `internal/observability/metrics.go` (+16 -15) 📝 `internal/observability/metrics_test.go` (+82 -17) 📝 `internal/observability/noop.go` (+10 -17) 📝 `internal/observability/noop_test.go` (+51 -16) 📝 `internal/observability/otel/backend.go` (+131 -32) 📝 `internal/observability/otel/backend_test.go` (+39 -5) 📝 `internal/observability/otel/exporter.go` (+20 -2) 📝 `internal/observability/otel/resource.go` (+3 -3) 📝 `internal/observability/prometheus/backend.go` (+154 -29) 📝 `internal/observability/prometheus/backend_test.go` (+68 -10) 📝 `main.go` (+16 -1) 📝 `proxy/proxy.go` (+10 -10) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description (generated by Copilot) This pull request introduces several improvements and updates to the observability and metrics subsystem, focusing on OpenTelemetry (OTel) configuration, validation, and documentation. It also includes dependency updates, minor test improvements, and a new code ownership assignment. **Key highlights:** - Adds a configurable timeout for OTel exporter initialization, with documentation and validation. - Updates the OTel Go dependencies to the latest versions. - Improves the validation logic for metrics backends. - Updates documentation and examples for clarity and correctness. - Refactors metric backend interfaces for better error handling. --- ### Observability & Metrics Configuration * Added a `Timeout` field to the `OTelConfig` struct, allowing configuration of the OTLP exporter connection setup timeout (default 10s). Updated all related documentation, CLI flags, and environment variable references to include this new option. [[1]](diffhunk://#diff-f15bc6b1df5b569f21d2272a8907a7b37ab63bc15afedd93441d3b88f51fb38bR63-R66) [[2]](diffhunk://#diff-f15bc6b1df5b569f21d2272a8907a7b37ab63bc15afedd93441d3b88f51fb38bR82) [[3]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9R86) [[4]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9R101) [[5]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9L111-R114) [[6]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9R170) [[7]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9R183) * Enhanced validation logic for the metrics backend: now requires a non-empty backend when metrics are enabled, and validates that the OTel timeout is positive. Added corresponding test cases for invalid configurations. [[1]](diffhunk://#diff-f15bc6b1df5b569f21d2272a8907a7b37ab63bc15afedd93441d3b88f51fb38bL91-R99) [[2]](diffhunk://#diff-f15bc6b1df5b569f21d2272a8907a7b37ab63bc15afedd93441d3b88f51fb38bR110-R112) [[3]](diffhunk://#diff-6db6cfa58292e1fbd4c09181104b8ca56cdc7fa58dd66f470a8a961eacb2f1aaL42-R56) [[4]](diffhunk://#diff-6db6cfa58292e1fbd4c09181104b8ca56cdc7fa58dd66f470a8a961eacb2f1aaR75-R104) ### Dependency & Interface Updates * Updated Go OpenTelemetry dependencies and related libraries to the latest versions (1.43.0), ensuring compatibility and bug fixes. [[1]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L9-R14) [[2]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L40-R48) * Changed the metrics backend interface methods (`NewCounter`, `NewUpDownCounter`, etc.) to return errors, propagating error handling from the underlying implementations. [[1]](diffhunk://#diff-9584d1f568dead35ed0e52047630cd702fd74803c407c97e356f406a96905999L46-R59) [[2]](diffhunk://#diff-9584d1f568dead35ed0e52047630cd702fd74803c407c97e356f406a96905999L113-R126) [[3]](diffhunk://#diff-9584d1f568dead35ed0e52047630cd702fd74803c407c97e356f406a96905999L136-R149) ### Documentation & Examples * Improved documentation for OTel metrics, including new timeout configuration, correct CLI flag defaults, and fixed example commands for Prometheus and OTel backends. [[1]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9L259-R263) [[2]](diffhunk://#diff-9d00dc5bdea981219f46e2b98ed6b89fbccb252cc2fd53e6f7ce820baaa3e9f9L268-R272) * Added a missing `file_format` field to the example OTel collector config. ### Testing Improvements * Improved test setup and coverage for metrics initialization, shutdown, and validation, including new cases for OTel timeout and backend validation. [[1]](diffhunk://#diff-8ea0d64df378dd743e9e7106592591a8568f325916af29bf4980054b6373b370R92-R94) [[2]](diffhunk://#diff-8ea0d64df378dd743e9e7106592591a8568f325916af29bf4980054b6373b370R174) [[3]](diffhunk://#diff-8ea0d64df378dd743e9e7106592591a8568f325916af29bf4980054b6373b370L219-R226) [[4]](diffhunk://#diff-6db6cfa58292e1fbd4c09181104b8ca56cdc7fa58dd66f470a8a961eacb2f1aaR5-R6) ### Miscellaneous * Added code ownership for the `internal/observability/**` directory. (.github/CODEOWNERS) ## How to test? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-13 12:36:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gerbil#1142