Skip to content

Add server runtime metrics aggregator #9797

Closed
@AbhiPrasad

Description

@AbhiPrasad

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.

https://github.com/getsentry/sentry-javascript/blob/develop/packages/core/src/server-runtime-client.ts

Instead of requiring the Metrics integration, this should instead gate functionality under an _experiments flag passed into client options. See

/**
* Options which are in beta, or otherwise not guaranteed to be stable.
*/
_experiments?: {
[key: string]: any;
};

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

  1. 10 Second Bucketing: The SimpleMetricsAggregator has no timestamp based bucketing system - this needs to be introduced.
  2. 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).
  3. Force flush: The SimpleMetricsAggregator does not have any weight-based force flush mechanisms, this needs to be added
  4. 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:

  1. metric summaries: https://github.com/getsentry/rfcs/blob/main/text/0123-metrics-correlation.md
  2. code locations: https://develop.sentry.dev/sdk/metrics/#meta-data

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions