getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.99k stars 1.57k forks source link

Metrics SDK v0 #9691

Closed AbhiPrasad closed 10 months ago

AbhiPrasad commented 11 months ago

Problem Statement

Sentry is adding support for metrics! See https://github.com/getsentry/sentry/discussions/58584 for more details.

This GH issue tracks the progress for metrics in the SDK

Solution Brainstorm

First less establish the core interfaces that make up the metrics SDK

### Core
- [ ] https://github.com/getsentry/sentry-javascript/pull/9304
- [ ] https://github.com/getsentry/sentry-javascript/pull/9698

Then let's build a simple metrics aggregator that is meant to be used in the browser. It does not have any jitter mechanisms via a rollup window because it's meant to be used on the FE - we try to minimize bundle size.

### Browser
- [ ] https://github.com/getsentry/sentry-javascript/pull/9794
- [ ] Add integration tests for metrics
- [x] Make sure metrics APIS are exported from nextjs, sveltekit, remix

When this is ready, we can cut a release and test this on the Sentry frontend. Also an opportunity for us to revisits API, and do bundle size optimizations.

After let's create a more complex metrics aggregator that will take into account rollup windows - we can just this for all of our server runtimes.

### Server runtime
- [ ] https://github.com/getsentry/sentry-javascript/issues/9797
- [ ] Add code locations support
- [ ] Add metrics summary support
### Testing
- [x] Test with https://github.com/getsentry/chartcuterie
- [ ] Test with https://github.com/getsentry/session-replay-analyzer
AbhiPrasad commented 11 months ago

The current plan is for there to be a MetricsAggregator object/class that lives on the client.

The browser will have this as an optional implementation, while it will always be implemented for server runtime client.

AbhiPrasad commented 10 months ago

Given we have https://github.com/getsentry/sentry-javascript/discussions/9938 and https://github.com/getsentry/sentry-javascript/discussions/9973, closing this issue for v0