mirror of
https://github.com/fosrl/gerbil.git
synced 2026-07-15 21:26:46 -05:00
[PR #67] [MERGED] Integrate OpenTelemetry and Prometheus metrics across services #249
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/gerbil/pull/67
Author: @marcschaeferger
Created: 4/3/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @oschwartz10612
Base:
dev← Head:metrics📝 Commits (5)
f322b4cAdd OpenTelemetry and Prometheus metrics infrastructure4357ddfIntegrate metrics instrumentation across core servicese47a57cEnhance metrics tracking in SNIProxy connection handling652d9c5Add metrics tracking for UDP packet handling and session managementf07c83fUpdate Go version to 1.25.0 and add gRPC dependency📊 Changes
22 files changed (+2958 additions, -47 deletions)
View changed files
📝
README.md(+18 -0)➕
docs/observability.md(+269 -0)➕
examples/otel-collector-config.yaml(+46 -0)➕
examples/prometheus.yml(+24 -0)📝
go.mod(+33 -6)📝
go.sum(+79 -10)➕
internal/metrics/metrics.go(+506 -0)➕
internal/metrics/metrics_test.go(+258 -0)➕
internal/observability/config.go(+119 -0)➕
internal/observability/metrics.go(+152 -0)➕
internal/observability/metrics_test.go(+198 -0)➕
internal/observability/noop.go(+71 -0)➕
internal/observability/noop_test.go(+67 -0)➕
internal/observability/otel/backend.go(+210 -0)➕
internal/observability/otel/backend_test.go(+141 -0)➕
internal/observability/otel/exporter.go(+50 -0)➕
internal/observability/otel/resource.go(+25 -0)➕
internal/observability/prometheus/backend.go(+185 -0)➕
internal/observability/prometheus/backend_test.go(+173 -0)📝
main.go(+207 -13)...and 2 more files
📄 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
This pull request introduces comprehensive OpenTelemetry-based observability and metrics instrumentation for Gerbil, supporting both Prometheus-native and OTel/OTLP metrics export. It includes a pluggable backend architecture, detailed documentation, example configurations for both Prometheus and OTel Collector, and a full test suite for the metrics subsystem. The changes also add new dependencies for OpenTelemetry and Prometheus clients.
Observability and Metrics Architecture:
Documentation and Examples:
docs/observability.mddetailing the observability design, configuration (CLI, env vars), metric catalog, and backend selection guidance.README.mdto summarize observability features and direct users to the new documentation.examples/prometheus.ymlfor Prometheus scraping andexamples/otel-collector-config.yamlfor OTel Collector pipelines, demonstrating both pull and push-based metric flows. [1] [2]Testing and Validation:
internal/metrics/metrics_test.gocovering backend initialization, metric recording, and HTTP scraping for Prometheus, as well as validation for noop and invalid backends.Dependency Updates:
go.modto include OpenTelemetry and Prometheus client libraries, plus their transitive dependencies, enabling the new observability features.How to test?
See docs/observability.md
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.