feat(cubestore): add OpenTelemetry metrics exporter - #1
Draft
deedubs wants to merge 2 commits into
Draft
Conversation
Add an OTLP metrics backend to the cubestore process as an alternative to the existing StatsD/DogStatsD UDP sink. Selected with `CUBESTORE_METRICS_FORMAT=otel`, it exports all existing `app_metrics` (counters, gauges, histograms) over OTLP/HTTP using a periodic push exporter. - Introduce a `MetricSink` trait so the global metrics sink can be either the StatsD UDP sink or the new OpenTelemetry sink; existing call sites are unchanged. - Add `util/metrics/otel.rs` with `OtelSink`, lazily creating and caching OpenTelemetry instruments by metric name and mapping DogStatsD-style tags to OTLP attributes. - Initialize the exporter inside the Tokio runtime (it is push-based and needs an async runtime), honoring `CUBESTORE_METRICS_OTEL_ENDPOINT` and `CUBESTORE_METRICS_OTEL_INTERVAL_SECS`, and falling back to the standard `OTEL_EXPORTER_OTLP_*` env vars. - Document the new format value and env vars. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KNKdpuR2ibDAX8eWJwUcLm
Describe the fork-maintenance model in the root CLAUDE.md: our organization-specific changes live on the long-running `universe` branch, kept rebased on upstream `cube-js/cube` master, and synced on demand via a `chore: Sync release` PR that carries the upstream sync only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KNKdpuR2ibDAX8eWJwUcLm
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.
Check List
Description of Changes Made (if issue reference is not provided)
Adds an OpenTelemetry (OTLP) metrics exporter to the
cubestoreprocess as analternative to the existing StatsD/DogStatsD UDP sink.
MetricSinktrait so theprocess-wide metrics sink can be either the StatsD UDP sink or the new
OpenTelemetry sink. All existing
app_metricscall sites (counters, gauges,histograms) are unchanged.
util/metrics/otel.rs. NewOtelSinkthat lazily creates and cachesOpenTelemetry instruments by metric name, maps DogStatsD-style
name:valuetags to OTLP attributes, and pushes over OTLP/HTTP via a periodic exporter.
CUBESTORE_METRICS_FORMAT=otelto enable it. Theexporter is initialized inside the Tokio runtime (it is push-based and needs
an async runtime). Endpoint/interval are configurable via
CUBESTORE_METRICS_OTEL_ENDPOINTandCUBESTORE_METRICS_OTEL_INTERVAL_SECS,falling back to the standard
OTEL_EXPORTER_OTLP_*environment variables.otelformat value and env vars in theenvironment-variables reference.
CLAUDE.mddescribing how our organization-specific changes are maintained onthe long-running
universebranch (rebased on upstreamcube-js/cubemaster,synced on demand via a
chore: Sync releasePR).Verification
cargo check -p cubestore --bin cubestoredcompiles cleanly.rustfmtrun on all changed Rust files (clean).parse_tagunit test. The fullcargo testsuite was not run in thisenvironment (network-restricted dependency fetch); reviewers should run the
cubestore test suite in CI.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KNKdpuR2ibDAX8eWJwUcLm
Generated by Claude Code