-
-
Notifications
You must be signed in to change notification settings - Fork 465
feat(metrics): [Trace Metrics 1] Metrics Options #4980
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
base: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- [Trace Metrics 1] Metrics Options ([#4980](https://github.com/getsentry/sentry-java/pull/4980))If none of the above apply, you can opt out of this check by adding |
| public static final class Metrics { | ||
|
|
||
| /** Whether Sentry Metrics feature is enabled and metrics are sent to Sentry. */ | ||
| private boolean enable = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to true in a follow up PR
| */ | ||
| // TODO replace with SentryMetric | ||
| @Nullable | ||
| Object execute(@NotNull Object metric); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature updated in follow-up PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need any kind of hint here? just wondering if it makes sense to add it now to not break this API in the future in case we need it (i'm imagining if we start sending default metrics like Android's AppExitReasons, the hint could be a good place to expose some information along)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO metrics are much more similar to logs where we also do not have a hint. Given that the volume of metrics could be way higher than for events I'm fine with not having hints. We can revisit before unmarking the options as experimental too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're planning to release as non experimental right away. IIRC hints were a bit odd on logs due to batching. I can do a quick experiment whether adding Hint is simple.
| this.logs = logs; | ||
| } | ||
|
|
||
| @ApiStatus.Experimental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New APIs should not be marked Experimental
3513eaa to
857a7aa
Compare
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 33a08cc | 267.08 ms | 340.45 ms | 73.37 ms |
| fc5ccaf | 256.80 ms | 322.36 ms | 65.56 ms |
| fc5ccaf | 276.52 ms | 370.46 ms | 93.93 ms |
| ee747ae | 386.94 ms | 431.43 ms | 44.49 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
| cf708bd | 408.35 ms | 458.98 ms | 50.63 ms |
| b3d8889 | 420.46 ms | 453.71 ms | 33.26 ms |
| ed33deb | 337.52 ms | 484.06 ms | 146.54 ms |
| dba088c | 365.46 ms | 366.31 ms | 0.85 ms |
| 9fbb112 | 361.43 ms | 427.57 ms | 66.14 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 33a08cc | 1.58 MiB | 2.12 MiB | 555.28 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
| cf708bd | 1.58 MiB | 2.11 MiB | 539.71 KiB |
| b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
| ed33deb | 1.58 MiB | 2.13 MiB | 559.52 KiB |
| dba088c | 1.58 MiB | 2.13 MiB | 558.99 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
markushi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a tiny nit about using final for a few method arguments.
| */ | ||
| // TODO replace with SentryMetric | ||
| @Nullable | ||
| Object execute(@NotNull Object metric); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO metrics are much more similar to logs where we also do not have a hint. Given that the volume of metrics could be way higher than for events I'm fine with not having hints. We can revisit before unmarking the options as experimental too.
857a7aa to
e156d3c
Compare

📜 Description
Add options for Metrics to
SentryOptions:SentryOptions.getMetrics().setEnabled(true)SentryOptions.getMetrics().setBeforeSend(...)💡 Motivation and Context
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps