Java Code Examples for io.micrometer.core.instrument.Counter#getId()
The following examples show how to use
io.micrometer.core.instrument.Counter#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysdigStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 6 votes |
@Issue("#970") @Test void sanitizeAllNonAlphaNumericCharacters() { String badCounterName = "\"\';^*()!~`_./?a{counter}:with123 weirdChars"; String badTagName = "\"\';^*()!~`_./?a{tag}:with123 weirdChars"; String badValueName = "\"\';^*()!~`_./?a{value}:with123 weirdChars"; Counter c = registry.counter(badCounterName, badTagName, badValueName); SysdigStatsdLineBuilder lb = new SysdigStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); StringBuilder expected = new StringBuilder(); expected.append("___________.__a_counter__with123_weirdChars") .append("#statistic=count,___________.__a_tag__with123_weirdChars") .append("=___________.__a_value__with123_weirdChars:1|c"); assertThat(lb.line("1", Statistic.COUNT, "c")) .isEqualTo(expected.toString()); }
Example 2
Source File: TelegrafStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#644") @Test void escapeCharactersForTelegraf() { Counter c = registry.counter("hikari.pools", "pool", "poolname = abc,::hikari"); TelegrafStatsdLineBuilder lineBuilder = new TelegrafStatsdLineBuilder(c.getId(), registry.config()); assertThat(lineBuilder.count(1, Statistic.COUNT)).isEqualTo("hikari_pools,statistic=count,pool=poolname_=_abc___hikari:1|c"); }
Example 3
Source File: TelegrafStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void changingNamingConvention() { Counter c = registry.counter("my.counter", "my.tag", "value"); TelegrafStatsdLineBuilder lb = new TelegrafStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my.counter,statistic=count,my.tag=value:1|c"); registry.config().namingConvention(NamingConvention.camelCase); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("myCounter,statistic=count,myTag=value:1|c"); }
Example 4
Source File: TelegrafStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#739") @Test void sanitizeColons() { Counter c = registry.counter("my:counter", "my:tag", "my:value"); TelegrafStatsdLineBuilder lb = new TelegrafStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my_counter,statistic=count,my_tag=my_value:1|c"); }
Example 5
Source File: DatadogStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void changingNamingConvention() { Counter c = registry.counter("my.counter", "my.tag", "value"); DatadogStatsdLineBuilder lb = new DatadogStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my.counter:1|c|#statistic:count,my.tag:value"); registry.config().namingConvention(NamingConvention.camelCase); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("myCounter:1|c|#statistic:count,myTag:value"); }
Example 6
Source File: DatadogStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#739") @Test void sanitizeColonsInTagKeys() { Counter c = registry.counter("my:counter", "my:tag", "my_value"); DatadogStatsdLineBuilder lb = new DatadogStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my_counter:1|c|#statistic:count,my_tag:my_value"); }
Example 7
Source File: DatadogStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void interpretEmptyTagValuesAsValuelessTags() { Counter c = registry.counter("my:counter", "my:tag", ""); DatadogStatsdLineBuilder lb = new DatadogStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my_counter:1|c|#statistic:count,my_tag"); }
Example 8
Source File: DatadogStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#1998") @Test void allowColonsInTagValues() { Counter c = registry.counter("my:counter", "my:tag", "my:value", "other_tag", "some:value:", "123.another.tag", "123:value"); DatadogStatsdLineBuilder lb = new DatadogStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")) .isEqualTo("my_counter:1|c|#statistic:count,m.123.another.tag:123:value,my_tag:my:value,other_tag:some:value_"); }
Example 9
Source File: SysdigStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void changingNamingConvention() { Counter c = registry.counter("my.counter", "my.tag", "value"); SysdigStatsdLineBuilder lb = new SysdigStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my.counter#statistic=count,my.tag=value:1|c"); registry.config().namingConvention(NamingConvention.camelCase); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("myCounter#statistic=count,myTag=value:1|c"); }
Example 10
Source File: SysdigStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#739") @Test void sanitizeColons() { Counter c = registry.counter("my:counter", "my:tag", "my:value"); SysdigStatsdLineBuilder lb = new SysdigStatsdLineBuilder(c.getId(), registry.config()); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my_counter#statistic=count,my_tag=my_value:1|c"); }
Example 11
Source File: EtsyStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Test void changingNamingConvention() { Counter c = registry.counter("my.counter", "my.tag", "value"); EtsyStatsdLineBuilder lb = new EtsyStatsdLineBuilder(c.getId(), registry.config(), HierarchicalNameMapper.DEFAULT); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my.counter.my.tag.value.statistic.count:1|c"); registry.config().namingConvention(NamingConvention.camelCase); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("myCounter.myTag.value.statistic.count:1|c"); }
Example 12
Source File: EtsyStatsdLineBuilderTest.java From micrometer with Apache License 2.0 | 5 votes |
@Issue("#739") @Test void sanitizeColons() { Counter c = registry.counter("my:counter", "my:tag", "my:value"); EtsyStatsdLineBuilder lb = new EtsyStatsdLineBuilder(c.getId(), registry.config(), HierarchicalNameMapper.DEFAULT); registry.config().namingConvention(NamingConvention.dot); assertThat(lb.line("1", Statistic.COUNT, "c")).isEqualTo("my_counter.my_tag.my_value.statistic.count:1|c"); }