You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(server): Send metrics via the global endpoint (#2902)
Introduces an option `http.global_metrics`. When enabled and not in
processing mode, Relay sends metrics to the global batch endpoint at
`/api/0/relays/metrics/` instead of envelopes. This endpoint allows for
batched submission of metrics from multiple projects, which should
reduce the overall number of requests.
# Bug Fixes
This change contains additional bug fixes that were discoverd during
implementation:
- The batch metrics endpoint no longer requires the `emit_outcomes`
outcomes flag to be set. This was invalid copy & paste from the
outcomes endpoint.
- Requests with HTTP encoding received a signature computed from the
compressed body. However, Relay requires the signature on the
uncompressed body.
# Details
Building the request occurs in the `EnvelopeProcessor` in place of
building envelopes in the following steps:
1. Iterate buckets from all projects and stream them into partitions.
2. While collecting, check the size of the partition. As soon as a
partition reaches the batch size limit, flush the partition eagerly.
Buckets at the border may be split.
3. At the end flush all remaining partitions with data.
4. To flush a partition, JSON-encode the list of buckets and optionally
apply HTTP encoding (compression).
5. Submit the `SendMetricsRequest` with the payload and outcome
metadata directly to the upstream.
6. In the response callback, log outcomes directly. Therefore, the
request does not have to be awaited.
In processing mode, Relay still produces to Kafka. The configuration
option does not have an effect in processing mode.
A note on stability: This endpoint and functionality is meant for
operation at scale within a distributed Sentry installation. At this
moment, it is not recommended to enable this option for external Relays.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@
11
11
- Use a Lua script and in-memory cache for the cardinality limiting to reduce load on Redis. ([#2849](https://github.com/getsentry/relay/pull/2849))
12
12
- Extract metrics for file spans. ([#2874](https://github.com/getsentry/relay/pull/2874))
13
13
- Add an internal endpoint that allows Relays to submit metrics from multiple projects in a single request. ([#2869](https://github.com/getsentry/relay/pull/2869))
14
+
- Introduce the configuration option `http.global_metrics`. When enabled, Relay submits metric buckets not through regular project-scoped Envelopes, but instead through the global endpoint. When this Relay serves a high number of projects, this can reduce the overall request volume. ([#2902](https://github.com/getsentry/relay/pull/2902))
14
15
- Emit a `processor.message.duration` metric to assess the throughput of the internal CPU pool. ([#2877](https://github.com/getsentry/relay/pull/2877))
0 commit comments