Description
This task can only be done once #9794 is merged in.
Add a MetricsAggregator
implementation for ServerRuntimeClient
, meant to be used in Node, Deno, Bun, Vercel Edge, etc.
Instead of requiring the Metrics
integration, this should instead gate functionality under an _experiments
flag passed into client options. See
sentry-javascript/packages/types/src/options.ts
Lines 200 to 205 in 93bbeb7
This needs to build off the SimpleMetricsAggregator
, but needs to fully defined the aggregator behaviour defined in https://develop.sentry.dev/sdk/metrics/#aggregator-behavior
- 10 Second Bucketing: The
SimpleMetricsAggregator
has no timestamp based bucketing system - this needs to be introduced. - Flush Shift: The
SimpleMetricsAggregator
flushes every 5 seconds, but introduces no jitter pattern. The server runtime metrics aggregator needs to add jitter to reduce load concerns when a set of SDKs on a fleet of machines are all initialized at once (need to randomly offset flush intervals). - Force flush: The
SimpleMetricsAggregator
does not have any weight-based force flush mechanisms, this needs to be added - Background Aggregation: This doesn't have to be done for the v0, we can come back and add it on later on
Please use https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/metrics.py as a reference implementation.
As a next step, we'll need to add support for:
- metric summaries: https://github.com/getsentry/rfcs/blob/main/text/0123-metrics-correlation.md
- code locations: https://develop.sentry.dev/sdk/metrics/#meta-data