diff --git a/sentry/src/main/java/io/sentry/metrics/MetricsHelper.java b/sentry/src/main/java/io/sentry/metrics/MetricsHelper.java index 7b5714230d..cb6981fe50 100644 --- a/sentry/src/main/java/io/sentry/metrics/MetricsHelper.java +++ b/sentry/src/main/java/io/sentry/metrics/MetricsHelper.java @@ -23,7 +23,7 @@ public final class MetricsHelper { private static final Pattern INVALID_KEY_CHARACTERS_PATTERN = Pattern.compile("[^a-zA-Z0-9_/.-]+"); private static final Pattern INVALID_VALUE_CHARACTERS_PATTERN = - Pattern.compile("[^\\w\\d_:/@\\.\\{\\}\\[\\]$-]+"); + Pattern.compile("[^\\w\\d\\s_:/@\\.\\{\\}\\[\\]$-]+"); // See // https://docs.sysdig.com/en/docs/sysdig-monitor/integrations/working-with-integrations/custom-integrations/integrate-statsd-metrics/#characters-allowed-for-statsd-metric-names private static final Pattern INVALID_METRIC_UNIT_CHARACTERS_PATTERN = diff --git a/sentry/src/test/java/io/sentry/metrics/MetricsHelperTest.kt b/sentry/src/test/java/io/sentry/metrics/MetricsHelperTest.kt index fb1817f235..9b92548380 100644 --- a/sentry/src/test/java/io/sentry/metrics/MetricsHelperTest.kt +++ b/sentry/src/test/java/io/sentry/metrics/MetricsHelperTest.kt @@ -70,6 +70,7 @@ class MetricsHelperTest { assertEquals("\$foo", MetricsHelper.sanitizeValue("%\$foo")) assertEquals("blah{}", MetricsHelper.sanitizeValue("blah{}")) assertEquals("snwmn", MetricsHelper.sanitizeValue("snöwmän")) + assertEquals("j e n g a", MetricsHelper.sanitizeValue("j e n g a!")) } @Test