| Crates.io | statsdproxy |
| lib.rs | statsdproxy |
| version | 0.4.1 |
| created_at | 2024-01-10 13:01:53.231676+00 |
| updated_at | 2025-06-17 11:56:55.48541+00 |
| description | A proxy for transforming, pre-aggregating and routing statsd metrics |
| homepage | |
| repository | https://github.com/getsentry/statsdproxy |
| max_upload_size | |
| id | 1095221 |
| size | 90,775 |
A proxy for transforming, pre-aggregating and routing statsd metrics, like Veneur, Vector or Brubeck.
Currently supports the following transformations:
See example.yml for details.
A major goal is minimal overhead and no loss of information due to unnecessarily strict parsing. Statsdproxy intends to orient itself around dogstatsd protocol but should gracefully degrade for other statsd dialects, in that those metrics and otherwise unparseable bytes will be forwarded as-is.
This is not a Sentry product, but internal tooling used in some components (Relay, Snuba's Rust consumer)
Run a "statsd server" on port 8081 that just prints metrics
socat -u UDP-RECVFROM:8081,fork SYSTEM:"cat; echo"
Copy example.yaml to config.yaml and edit it
Run statsdproxy to read metrics from port 8080, transform them using the
middleware in config.yaml and forward the new metrics to port 8081:
cargo run --release -- --listen 127.0.0.1:8080 --upstream 127.0.0.1:8081 -c config.yaml
Send metrics to statsdproxy:
yes 'users.online:1|c|@0.5' | nc -u 127.0.0.1 8080
You should see new metrics in socat with your middlewares applied.
Patch the following settings in snuba/settings/__init__.py:
DOGSTATSD_HOST = "127.0.0.1"
DOGSTATSD_PORT = "8080"
This will send metrics to port 8080.
This is the processing model used by the provided server. It should be respected by any usage of this software as a library.
\n.poll method of the topmost
middleware.
poll method of the next
middleware, if any.poll returns, the server invokes the submit method of the topmost
middleware with a mutable reference to the current metric.
submit the processed metric to the next middleware, returning
the result of this call.Overloaded.submit again with the same metric. (If an overload is
indicated too many times, maybe drop the metric?)poll method of the topmost middleware. This invocation of poll
should be handled the same as above.