-
-
Notifications
You must be signed in to change notification settings - Fork 279
feat: trace connected metrics #3450
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
Open
buenaflor
wants to merge
46
commits into
main
Choose a base branch
from
feat/metrics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
1a4b78b
Add TelemetryProcessor for span and log buffering
buenaflor 3897122
Remove SpanV2 and TraceLifecycle dependencies
buenaflor 2c617bb
Remove span-related tests from sentry_client_test
buenaflor 6ef8c3c
Remove span-related processor tests
buenaflor 3ca4c08
Remove span import from Flutter mocks
buenaflor 9b34042
Fix wiring up
buenaflor e0b564c
Update
buenaflor 6da49c8
Update
buenaflor 1b97198
Update CHANGELOG
buenaflor 82a4374
Update
buenaflor 1a48756
Update
buenaflor 1081ca3
Update
buenaflor ffd9fc7
Update
buenaflor b56a272
Update
buenaflor 586ae3d
Update
buenaflor 26d0577
Merge branch 'main' into feat/metrics
buenaflor 1f7ba8f
Merge branch 'main' into feat/metrics
buenaflor 33f991f
feat: integrate telemetry metrics into Sentry options and core functiโฆ
buenaflor b6bff0d
feat: implement SentryMetrics with Default and NoOp implementations
buenaflor 95fb48d
Merge branch 'main' into feat/metrics
buenaflor 435917d
feat: enhance telemetry metrics with MetricCapturePipeline and defaulโฆ
buenaflor 07b5051
Add more tests
buenaflor 875ca84
feat: enhance metric capturing and logging in MetricCapturePipeline aโฆ
buenaflor b5eee19
feat: enhance Sentry attribute formatting and replay integration
buenaflor 61bb4bc
feat: include unit in DefaultSentryMetrics and update tests
buenaflor 5b55d0a
fix: update metric logging to use processed metrics
buenaflor 264f72b
Fix missing spec
buenaflor f49e371
Update CHANGELOG
buenaflor 5cfeba6
Add examples
buenaflor ee01dbb
Merge branch 'main' into feat/metrics
buenaflor fbfcc74
Update doc
buenaflor c7ca90c
Update doc
buenaflor 7f3b491
Update
buenaflor c4221aa
Update
buenaflor 2a553a2
Update docs
buenaflor ba9930c
Add support for 'trace_metric' category in RateLimitParser and corresโฆ
buenaflor e3e55a5
Update comments
buenaflor e92efaf
Add SentryMetricUnit constants
buenaflor d530afc
Fix compilation
buenaflor eb2cad9
Fix analyze
buenaflor 3282f7a
Update
buenaflor 71e67b7
Refactor SentryMetrics handling in SentryOptions to use a private varโฆ
buenaflor cd836b5
Refactor SentryMetrics in SentryOptions to use a late variable for imโฆ
buenaflor 2648213
Add close
buenaflor 98f48fd
Add close test
buenaflor 747259d
Update SentryMetrics initialization in SentryOptions to use a constanโฆ
buenaflor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,30 +104,29 @@ class SentryEnvelope { | |
| factory SentryEnvelope.fromLogsData( | ||
| List<List<int>> encodedLogs, | ||
| SdkVersion sdkVersion, | ||
| ) { | ||
| // Create the payload in the format expected by Sentry | ||
| // Format: {"items": [log1, log2, ...]} | ||
| final builder = BytesBuilder(copy: false); | ||
| builder.add(utf8.encode('{"items":[')); | ||
| for (int i = 0; i < encodedLogs.length; i++) { | ||
| if (i > 0) { | ||
| builder.add(utf8.encode(',')); | ||
| } | ||
| builder.add(encodedLogs[i]); | ||
| } | ||
| builder.add(utf8.encode(']}')); | ||
|
|
||
| return SentryEnvelope( | ||
| SentryEnvelopeHeader( | ||
| null, | ||
| sdkVersion, | ||
| ), | ||
| [ | ||
| SentryEnvelopeItem.fromLogsData( | ||
| builder.takeBytes(), encodedLogs.length), | ||
| ], | ||
| ); | ||
| } | ||
| ) => | ||
| SentryEnvelope( | ||
| SentryEnvelopeHeader(null, sdkVersion), | ||
| [ | ||
| SentryEnvelopeItem.fromLogsData( | ||
| _buildItemsPayload(encodedLogs), encodedLogs.length) | ||
| ], | ||
| ); | ||
|
|
||
| /// Create a [SentryEnvelope] containing raw metric data payload. | ||
| /// This is used by the log batcher to send pre-encoded metric batches. | ||
| @internal | ||
| factory SentryEnvelope.fromMetricsData( | ||
| List<List<int>> encodedMetrics, | ||
| SdkVersion sdkVersion, | ||
| ) => | ||
| SentryEnvelope( | ||
| SentryEnvelopeHeader(null, sdkVersion), | ||
| [ | ||
| SentryEnvelopeItem.fromMetricsData( | ||
| _buildItemsPayload(encodedMetrics), encodedMetrics.length) | ||
| ], | ||
| ); | ||
|
|
||
| /// Stream binary data representation of `Envelope` file encoded. | ||
| Stream<List<int>> envelopeStream(SentryOptions options) async* { | ||
|
|
@@ -160,6 +159,20 @@ class SentryEnvelope { | |
| } | ||
| } | ||
|
|
||
| /// Builds a payload in the format {"items": [item1, item2, ...]} | ||
| static Uint8List _buildItemsPayload(List<List<int>> encodedItems) { | ||
buenaflor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| final builder = BytesBuilder(copy: false); | ||
| builder.add(utf8.encode('{"items":[')); | ||
| for (int i = 0; i < encodedItems.length; i++) { | ||
| if (i > 0) { | ||
| builder.add(utf8.encode(',')); | ||
| } | ||
| builder.add(encodedItems[i]); | ||
| } | ||
| builder.add(utf8.encode(']}')); | ||
| return builder.takeBytes(); | ||
| } | ||
|
Comment on lines
+162
to
+174
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is taken from the span-first branch |
||
|
|
||
| /// Add an envelope item containing client report data. | ||
| void addClientReport(ClientReport? clientReport) { | ||
| if (clientReport != null) { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
All other types are called like the raw value, so in this case it should be 'traceMetric'
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 should keep it as metrics as per spec: