-
-
Notifications
You must be signed in to change notification settings - Fork 375
feat(metrics): Add public API to collect count, distribution and gauge #6957
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: philprime/metrics-envelope
Are you sure you want to change the base?
feat(metrics): Add public API to collect count, distribution and gauge #6957
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## philprime/metrics-envelope #6957 +/- ##
=================================================================
+ Coverage 7.044% 84.973% +77.928%
=================================================================
Files 430 468 +38
Lines 26644 28110 +1466
Branches 10356 12500 +2144
=================================================================
+ Hits 1877 23886 +22009
+ Misses 24754 4184 -20570
- Partials 13 40 +27
... and 442 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
7158dfc to
87379ed
Compare
4c30f13 to
02c3573
Compare
02c3573 to
1ab754c
Compare
|
@sentry review |
…add corresponding unit test
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
…lprime/metrics-public-api
…ison - Updated the test for protocol-based conversion of Float arrays to Double arrays to use accuracy for floating-point comparisons. - Added explanatory comments regarding the nature of Float literals and the importance of tolerance in comparisons.
- Changed the metrics enablement check to reference the experimental options in SentrySDKInternal. - Adjusted the return statement for metrics integration to improve clarity and consistency.
The test was failing because it created a span without setting its traceId. Since the fix now uses span.traceId when a span is active, the test needs to set the span's traceId to match the propagationContext traceId for consistency.
- Eliminated the isMetricsEnabled property from the SentryMetricsApiDependencies protocol, simplifying the dependency structure. - Updated related code to ensure metrics integration is nullable, enhancing clarity on metrics availability. - Adjusted tests to reflect the removal of isMetricsEnabled, ensuring they accurately simulate scenarios where metrics are disabled.
This PR is part of a merge-chain and should be merged one-by-one into
mainas soon as all of them are ready to be merged:This PR must also wait for #7077 to be merged
📜 Description
This pull request introduces a new metrics API to the codebase, allowing clients to record custom metrics such as counts, distributions, and gauges. The API is exposed via the
SentrySDK.metricsproperty and is designed for future extensibility, though the current implementation is a no-op.This PR also adds an example UI to manually collect metrics in iOS-Swift.
💡 Motivation and Context
Closes #6949
💚 How did you test it?
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.TODO
AttributableandAttributeValueto support type-safe bool, string, int, float, double literal values and variablesAddAttributeArrayValueto support type-safe arrays without mixed types