feat(scaler): add observability (metrics + tracing) to the external scaler#1634
Open
Fedosin wants to merge 1 commit into
Open
feat(scaler): add observability (metrics + tracing) to the external scaler#1634Fedosin wants to merge 1 commit into
Fedosin wants to merge 1 commit into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
b55975d to
6121c89
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds OpenTelemetry-based observability to the external scaler by introducing metric instruments/exporters and distributed tracing, plus wiring them into the scaler’s startup and queue polling logic.
Changes:
- Added an OTEL metrics provider + instruments for queue pinger fetch duration/errors and endpoint count, with Prometheus and optional OTLP/HTTP export.
- Added OTEL tracing SDK setup and enabled automatic gRPC server span instrumentation via
otelgrpcwhen tracing is enabled. - Wired metrics/tracing configuration into scaler config and main startup, including a
/metricsHTTP endpoint.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scaler/tracing/tracing.go | Adds OTEL tracing SDK setup and exporter selection for the scaler. |
| scaler/metrics/provider.go | Introduces an OTEL MeterProvider with Prometheus and optional OTLP metric export. |
| scaler/metrics/instruments.go | Defines metric instruments and recording helpers for queue pinger metrics. |
| scaler/queue_pinger.go | Records pinger fetch metrics on each polling cycle. |
| scaler/queue_pinger_test.go | Updates pinger construction in tests for the new instruments parameter. |
| scaler/main.go | Initializes metrics/tracing, adds Prometheus /metrics server, and instruments gRPC when enabled. |
| scaler/config.go | Adds env-configurable metrics and tracing settings for the scaler. |
| go.mod | Adds otelgrpc dependency for gRPC tracing instrumentation. |
| go.sum | Updates sums for added/updated dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6f6d5f4 to
1b8f62f
Compare
…caler Add OpenTelemetry-based metrics and distributed tracing to the external scaler component, which previously had no observability instrumentation. Metrics: - scaler.pinger.fetch.duration (histogram) - scaler.pinger.fetch.errors (counter) - scaler.pinger.endpoints (gauge) - Prometheus /metrics endpoint on port 2224 (configurable) - Optional OTLP HTTP metrics export Tracing: - OTEL tracing SDK with console, HTTP/protobuf, and gRPC exporters - otelgrpc stats handler for automatic gRPC server span instrumentation - W3C TraceContext + Baggage propagation Relates to: kedacore#965 Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
1b8f62f to
744e536
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add OpenTelemetry-based metrics and distributed tracing to the external
scaler component, which previously had no observability instrumentation.
Metrics:
scaler.pinger.fetch.duration(histogram) — duration of each queue pinger fetch cyclescaler.pinger.fetch.errors(counter) — total failed pinger fetch cyclesscaler.pinger.endpoints(gauge) — number of interceptor endpoints being polled/metricsendpoint on port 2224 (configurable viaOTEL_PROM_EXPORTER_PORT)OTEL_EXPORTER_OTLP_METRICS_ENABLED)Tracing:
otelgrpcstats handler for automatic gRPC server span instrumentationConfiguration env vars (same convention as the interceptor):
OTEL_PROM_EXPORTER_ENABLED(default:true)OTEL_PROM_EXPORTER_PORT(default:2224)OTEL_EXPORTER_OTLP_METRICS_ENABLED(default:false)OTEL_EXPORTER_OTLP_TRACES_ENABLED(default:false)OTEL_EXPORTER_OTLP_TRACES_PROTOCOL(default:console)Checklist
README.mdFixes #965 (partial — scaler component)