Skip to content

Commit

Permalink
Allow whitespace in metric tag values (#3235)
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi authored Mar 1, 2024
1 parent c7addb9 commit ff8471a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/metrics/MetricsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff8471a

Please sign in to comment.