Skip to content

Commit

Permalink
Allow instrument names to contain a forward slash (#5824)
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk authored Sep 15, 2023
1 parent e3cc1f0 commit 9b081e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ final class SdkMeter implements Meter {
* <li>They are not null or empty strings.
* <li>They are case-insensitive, ASCII strings.
* <li>The first character must be an alphabetic character.
* <li>Subsequent characters must belong to the alphanumeric characters, '_', '.', and '-'.
* <li>Subsequent characters must belong to the alphanumeric characters, '_', '.', '/', and '-'.
* <li>They can have a maximum length of 255 characters.
* </ul>
*/
private static final Pattern VALID_INSTRUMENT_NAME_PATTERN =
Pattern.compile("([A-Za-z]){1}([A-Za-z0-9\\_\\-\\.]){0,254}");
Pattern.compile("([A-Za-z]){1}([A-Za-z0-9\\_\\-\\./]){0,254}");

private static final Meter NOOP_METER = MeterProvider.noop().get("noop");
private static final String NOOP_INSTRUMENT_NAME = "noop";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void checkValidInstrumentNameTest() {
assertThat(checkValidInstrumentName("a1234567890")).isTrue();
assertThat(checkValidInstrumentName("a_-.")).isTrue();
assertThat(checkValidInstrumentName(new String(new char[255]).replace('\0', 'a'))).isTrue();
assertThat(checkValidInstrumentName("a/b")).isTrue();

// Empty and null not allowed
assertThat(checkValidInstrumentName(null)).isFalse();
Expand Down

0 comments on commit 9b081e1

Please sign in to comment.