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

Add support for Sentry Developer Metrics #803

Closed
AbhiPrasad opened this issue Dec 22, 2023 · 4 comments · Fixed by #811
Closed

Add support for Sentry Developer Metrics #803

AbhiPrasad opened this issue Dec 22, 2023 · 4 comments · Fixed by #811

Comments

@AbhiPrasad
Copy link
Member

Problem Statement

Sentry is introducing support for a metrics product.

Spec: https://develop.sentry.dev/sdk/metrics/

This was already implemented in the JavaScript SDK:

Min required JS SDK version: 7.91.0

Solution Brainstorm

Let's add this to the Electron SDK!

This should be similar to the Node SDK, so we gate the usage by metricsAggregator experiment.

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

I think the Electron Client can just use the server-runtime metrics aggregator, the renderer can just forward to the main process, and the main process client is in charge of the aggregation.

@timfish

This comment was marked as outdated.

@timfish
Copy link
Collaborator

timfish commented Dec 30, 2023

the renderer can just forward to the main process, and the main process client is in charge of the aggregation

How important is it that aggregation occurs between the multiple processes?

We can intercept the metrics envelopes sent from the renderers and pull out the array of MetricBucketItem, but there's no simple way to then add those to the MetricsAggregator since the metrics have been serialised at this point. We'd either need to parse the serialised metrics or add a beforeMetricAdd hook so that they could be passed via IPC and added in main process individually.

My guess is that it wouldn't be that common to submit the same metrics from different processes anyway and we could just pass the metric envelopes straight through the main process, much like we do already for replay envelopes.

@AbhiPrasad
Copy link
Member Author

How important is it that aggregation occurs between the multiple processes?

I think this is required, given we want to minimize the amount of envelopes sent to Sentry as much as possible. I think beforeMetricAdd + IPC seems reasonable as an approach to use, and rely completely on the main process to flush.

Does an interval flushing mechanism work fine for electron?

@timfish
Copy link
Collaborator

timfish commented Jan 4, 2024

Actually I don't think we need to add a beforeMetricAdd hook to the client. We can replace the eventAggregator in the render/browser and when add is called we can forward over IPC.

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 a pull request may close this issue.

2 participants