From 3c0db741f88bb8b6f13cf234e6cbcb8caf85ba3c Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 19 Jan 2024 17:04:01 +0100 Subject: [PATCH 1/3] sanitize value --- src/Sentry/Protocol/Metrics/Metric.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry/Protocol/Metrics/Metric.cs b/src/Sentry/Protocol/Metrics/Metric.cs index 7a9a5ca737..801f3c9173 100644 --- a/src/Sentry/Protocol/Metrics/Metric.cs +++ b/src/Sentry/Protocol/Metrics/Metric.cs @@ -97,7 +97,7 @@ public async Task SerializeAsync(Stream stream, IDiagnosticLogger? logger, Cance { await Write(","); } - await Write($"{key}:SanitizeValue(value)"); + await Write($"{key}:{MetricHelper.SanitizeValue(value)}"); } } From 81f593e9c642abf2477fec0db3451417100083cb Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Tue, 23 Jan 2024 15:13:14 +0100 Subject: [PATCH 2/3] verify --- ...erializeAsync_WritesMetric_metric=CounterMetric.verified.txt | 2 +- ...izeAsync_WritesMetric_metric=DistributionMetric.verified.txt | 2 +- ....SerializeAsync_WritesMetric_metric=GaugeMetric.verified.txt | 2 +- ...ts.SerializeAsync_WritesMetric_metric=SetMetric.verified.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=CounterMetric.verified.txt b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=CounterMetric.verified.txt index 07089ed3ee..ea8d4682d7 100644 --- a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=CounterMetric.verified.txt +++ b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=CounterMetric.verified.txt @@ -1 +1 @@ -my.counter@counters:5|c|#tag1:SanitizeValue(value),tag2:SanitizeValue(value)|T1577836800 +my.counter@counters:5|c|#tag1:value1,tag2:value2|T1577836800 diff --git a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=DistributionMetric.verified.txt b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=DistributionMetric.verified.txt index f6a5cd69e2..6b7993edbb 100644 --- a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=DistributionMetric.verified.txt +++ b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=DistributionMetric.verified.txt @@ -1 +1 @@ -my.distribution@distributions:5:7:13|d|#tag1:SanitizeValue(value),tag2:SanitizeValue(value)|T1577836800 +my.distribution@distributions:5:7:13|d|#tag1:value1,tag2:value2|T1577836800 diff --git a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=GaugeMetric.verified.txt b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=GaugeMetric.verified.txt index ed798ecca2..75933143c7 100644 --- a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=GaugeMetric.verified.txt +++ b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=GaugeMetric.verified.txt @@ -1 +1 @@ -my.gauge@gauges:7:5:7:12:2|g|#tag1:SanitizeValue(value),tag2:SanitizeValue(value)|T1577836800 +my.gauge@gauges:7:5:7:12:2|g|#tag1:value1,tag2:value2|T1577836800 diff --git a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=SetMetric.verified.txt b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=SetMetric.verified.txt index d147d1fc26..ef8c8ebd3b 100644 --- a/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=SetMetric.verified.txt +++ b/test/Sentry.Tests/MetricTests.SerializeAsync_WritesMetric_metric=SetMetric.verified.txt @@ -1 +1 @@ -my.set@sets:5:7|s|#tag1:SanitizeValue(value),tag2:SanitizeValue(value)|T1577836800 +my.set@sets:5:7|s|#tag1:value1,tag2:value2|T1577836800 From 8d0c9d028917bca3add87afcbf06bbd13df4cd57 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 24 Jan 2024 15:16:38 +0100 Subject: [PATCH 3/3] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf8393806..10e946e9ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ If you have conflicts, you can opt-out by adding the following to your `csproj`: ### Fixes +- Fixed an issue with tag values in metrics not being properly serialized ([#3065](https://github.com/getsentry/sentry-dotnet/pull/3065)) - Moved the binding to MAUI events for breadcrumb creation from `WillFinishLaunching` to `FinishedLaunching`. This delays the initial instantiation of `app`. ([#3057](https://github.com/getsentry/sentry-dotnet/pull/3057)) - The SDK no longer adds the `WinUIUnhandledExceptionIntegration` on non Windows platforms ([#3055](https://github.com/getsentry/sentry-dotnet/pull/3055))