ref(metrics): Replace merni with metrics#348
Merged
Conversation
Migrate from the merni crate (which sends metrics directly to the Datadog API) to the metrics ecosystem with a DogStatsD exporter. Our deployment now uses a DogStatsD sidecar, so we emit StatsD to a local socket instead of requiring Datadog API credentials. Introduces `objectstore-metrics`, a thin crate that provides: - `counter!`, `gauge!`, `distribution!` macros preserving the existing call-site syntax with `@s`/`@b` unit annotations for value conversion - `MetricsConfig` with configurable host, prefix, buffer size, and tags - `init()` to wire up the DogStatsD exporter (no-op when host is None) - `with_capturing_test_client()` for asserting on metrics in tests Configuration changes: - `metrics.datadog_key` (API key) → `metrics.host` (StatsD address) - New: `metrics.prefix` (defaults to "objectstore.") - New: `metrics.buffer_size` (optional payload size override) - Explicit flush-on-shutdown removed (exporter flushes periodically) This aligns with how Relay emits metrics, using the same crate versions (metrics 0.24, metrics-exporter-dogstatsd 0.9) and builder configuration.
lcian
approved these changes
Mar 3, 2026
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.
Migrate from the
mernicrate (which sends metrics directly to the DatadogAPI using an API key) to the
metricsecosystem with a DogStatsD exporter.Our deployment has a sidecar with a DataDog agent that is able to handle
these submissions.
New
objectstore-metricscrateThin wrapper that provides:
counter!,gauge!,distribution!macros preserving the existingcall-site syntax with
@s/@bunit annotations for value conversionMetricsConfigstruct with configurable host, prefix, buffer size, and tagsinit()to wire up the DogStatsD exporter (no-op when host isNone)with_capturing_test_client()for asserting on metrics in testsConfiguration changes
metrics.datadog_keymetrics.hostmetrics.prefix"objectstore."metrics.buffer_sizeAll ~30 metric call sites across 11 files are mechanically updated from
merni::counter!→objectstore_metrics::counter!etc. with no changesto metric names, tags, or semantics. Improvements to the macro will come
in a follow-up.
Requires https://github.com/getsentry/ops/pull/19421
Ref FS-278