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

Metrics Part 1 - Add Counter Metric API #1940

Merged
merged 16 commits into from Apr 9, 2024
Merged

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Mar 19, 2024

📜 Description

Add Sentry Metrics to Dart SDK.
Implemented features

💡 Motivation and Context

Implements first part of #1876

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

This is an overview of the following PRs:

  1. Add sets, gauges and distributions metrics, with overweight logic -> Add other metric types and weight (part 2) #1949
  2. Add timing metric with span auto start and beforeEmitMetric option-> Add timing metric and beforeMetric callback (part 3) #1954
  3. Span metrics summary -> Feat/metrics span summary p4 #1958
  4. Add docs
  5. Code location (currently blocked)

Also, we should add a proper changelog

added Metric Aggregation, with hub/client integration and close
added metric tag normalization
added send of statsd envelope type
Copy link
Contributor

github-actions bot commented Mar 19, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6dac9d6

Copy link
Contributor

github-actions bot commented Mar 19, 2024

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 405.23 ms 470.62 ms 65.38 ms
Size 6.34 MiB 7.28 MiB 968.41 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
90db9ff 334.86 ms 388.14 ms 53.28 ms
5e8d2b3 342.17 ms 375.83 ms 33.66 ms
a775d3f 359.58 ms 436.68 ms 77.10 ms
0be962b 325.54 ms 382.83 ms 57.29 ms
ef6466d 373.96 ms 443.17 ms 69.21 ms
30c1193 349.00 ms 438.20 ms 89.20 ms
5aab4c5 326.12 ms 378.82 ms 52.70 ms
521cfbf 332.78 ms 376.04 ms 43.26 ms
9928a74 375.26 ms 456.30 ms 81.04 ms
fe4aa56 356.06 ms 428.67 ms 72.61 ms

App size

Revision Plain With Sentry Diff
90db9ff 6.06 MiB 7.10 MiB 1.04 MiB
5e8d2b3 6.15 MiB 7.13 MiB 1000.11 KiB
a775d3f 6.27 MiB 7.20 MiB 957.75 KiB
0be962b 6.06 MiB 7.03 MiB 990.29 KiB
ef6466d 6.34 MiB 7.28 MiB 967.79 KiB
30c1193 6.27 MiB 7.20 MiB 958.74 KiB
5aab4c5 6.06 MiB 7.10 MiB 1.04 MiB
521cfbf 5.94 MiB 6.97 MiB 1.03 MiB
9928a74 5.94 MiB 6.96 MiB 1.02 MiB
fe4aa56 6.06 MiB 7.10 MiB 1.04 MiB

Previous results on branch: feat/metrics_counter_p1

Startup times

Revision Plain With Sentry Diff
2fd72c4 356.20 ms 421.38 ms 65.18 ms
e9d9441 403.79 ms 461.21 ms 57.42 ms
64e1732 375.53 ms 438.52 ms 62.99 ms
2c4e01f 370.35 ms 443.67 ms 73.33 ms
61bec38 372.04 ms 436.22 ms 64.18 ms
aa40a3f 352.29 ms 409.80 ms 57.51 ms

App size

Revision Plain With Sentry Diff
2fd72c4 6.34 MiB 7.29 MiB 969.37 KiB
e9d9441 6.34 MiB 7.29 MiB 969.36 KiB
64e1732 6.34 MiB 7.29 MiB 969.18 KiB
2c4e01f 6.34 MiB 7.29 MiB 969.18 KiB
61bec38 6.34 MiB 7.29 MiB 969.36 KiB
aa40a3f 6.34 MiB 7.29 MiB 969.43 KiB

Copy link
Contributor

github-actions bot commented Mar 19, 2024

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1248.16 ms 1271.74 ms 23.58 ms
Size 8.33 MiB 9.40 MiB 1.07 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f2db4ec 1244.14 ms 1259.79 ms 15.65 ms
8932ece 1234.31 ms 1238.90 ms 4.59 ms
24f71aa 1267.47 ms 1272.00 ms 4.53 ms
86d4841 1225.69 ms 1241.12 ms 15.43 ms
31b2afb 1244.90 ms 1261.37 ms 16.47 ms
f79eecf 1210.25 ms 1221.65 ms 11.40 ms
d783424 1265.71 ms 1277.00 ms 11.29 ms
6957bfd 1283.80 ms 1289.00 ms 5.20 ms
f6f3d25 1253.80 ms 1258.39 ms 4.59 ms
3de8b9b 1234.22 ms 1251.94 ms 17.72 ms

App size

Revision Plain With Sentry Diff
f2db4ec 8.10 MiB 9.16 MiB 1.07 MiB
8932ece 8.29 MiB 9.36 MiB 1.07 MiB
24f71aa 8.10 MiB 9.16 MiB 1.07 MiB
86d4841 8.29 MiB 9.36 MiB 1.07 MiB
31b2afb 8.33 MiB 9.40 MiB 1.07 MiB
f79eecf 8.29 MiB 9.36 MiB 1.07 MiB
d783424 8.29 MiB 9.38 MiB 1.09 MiB
6957bfd 8.15 MiB 9.15 MiB 1020.71 KiB
f6f3d25 8.28 MiB 9.34 MiB 1.06 MiB
3de8b9b 8.28 MiB 9.34 MiB 1.06 MiB

Previous results on branch: feat/metrics_counter_p1

Startup times

Revision Plain With Sentry Diff
e9d9441 1243.94 ms 1271.35 ms 27.41 ms
61bec38 1225.20 ms 1247.78 ms 22.58 ms
2c4e01f 1237.79 ms 1249.65 ms 11.85 ms
aa40a3f 1247.52 ms 1262.85 ms 15.33 ms
64e1732 1244.82 ms 1263.19 ms 18.37 ms
2fd72c4 1253.27 ms 1275.60 ms 22.34 ms

App size

Revision Plain With Sentry Diff
e9d9441 8.33 MiB 9.40 MiB 1.07 MiB
61bec38 8.33 MiB 9.40 MiB 1.07 MiB
2c4e01f 8.33 MiB 9.40 MiB 1.07 MiB
aa40a3f 8.33 MiB 9.40 MiB 1.07 MiB
64e1732 8.33 MiB 9.40 MiB 1.07 MiB
2fd72c4 8.33 MiB 9.40 MiB 1.07 MiB

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome progress! 🚀

dart/lib/src/metrics/metric.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metrics_api.dart Show resolved Hide resolved
dart/lib/src/sentry_client.dart Show resolved Hide resolved
@stefanosiano stefanosiano marked this pull request as ready for review March 21, 2024 15:08
Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nitpicks, suggestions & questions.

dart/lib/src/metrics/metric.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metric.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metric.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metric.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metrics_aggregator.dart Outdated Show resolved Hide resolved
dart/lib/src/metrics/metrics_aggregator.dart Show resolved Hide resolved
dart/lib/src/sentry.dart Show resolved Hide resolved
dart/lib/src/sentry_envelope_item.dart Show resolved Hide resolved
dart/test/hub_test.dart Outdated Show resolved Hide resolved
dart/test/sentry_envelope_item_test.dart Show resolved Hide resolved
stefanosiano and others added 8 commits March 26, 2024 16:03
renamed a test
* added crc32_utils.dart, taken from archive library
* added Gauge, Distribution and Set metrics
* added weight to Metrics and auto flush when weight is too much

* Add timing metric and beforeMetric callback (part 3) (#1954)
* added SentryOptions.beforeMetricCallback
* added beforeMetricCallback logic in metrics_aggregator.dart
* added timing metric api with span auto start
* timing api uses span duration as value for the emitted metric if possible

* Feat/metrics span summary p4 (#1958)
* added local_metrics_aggregator.dart to spans
* metrics_aggregator.dart now adds to current span's localMetricsAggregator
* added metric_summary.dart
* added metricSummary to spans and transaction JSONs
* updated metric normalization rules
* added rate limit for metrics
@stefanosiano stefanosiano merged commit 84bc635 into main Apr 9, 2024
123 checks passed
@stefanosiano stefanosiano deleted the feat/metrics_counter_p1 branch April 9, 2024 15:12
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.

None yet

3 participants