Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for performance metrics #811

Merged
merged 12 commits into from
Jan 8, 2024

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jan 5, 2024

Closes #803

To enable metrics, you follow the same instructions as for node in the main process:

import * as Sentry from '@sentry/electron/main';

Sentry.init({
  dsn: '__DSN__',
  _experiments: {
    metricsAggregator: true,
  },
});

Sentry.metrics.increment('hits', 6);

In the renderer, no metric specific config is required:

import * as Sentry from '@sentry/electron/renderer';

Sentry.init();

Sentry.metrics.increment('hits', 6);

@timfish timfish marked this pull request as ready for review January 5, 2024 19:05
@AbhiPrasad
Copy link
Member

Let's avoid having the user configure a MetricsAggregator for the renderer. We did this for treeshaking purposes in browser, but I think we can get away from that here.

The renderer can just configure it's metrics aggregator on init.

@timfish
Copy link
Collaborator Author

timfish commented Jan 6, 2024

The renderer can just configure it's metrics aggregator on init.

Currently the main/renderer inits just call their respective node/browser inits with options. We'd need an Electron client to set aggregator.

It's probably more flexible to just add the MetricsAggregator integration to the default renderer integrations. This would also mean that if users copy the browser instructions and use new Sentry.metrics.MetricsAggregator(), one integration will get dropped and they don't end up using the browser implementation by mistake.

@timfish timfish enabled auto-merge (squash) January 8, 2024 00:18
@timfish timfish merged commit 1bf073f into getsentry:master Jan 8, 2024
32 checks passed
@timfish timfish deleted the feat/metrics branch April 16, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Sentry Developer Metrics
2 participants