io.prometheus.client.dropwizard.samplebuilder.DefaultSampleBuilder Java Examples

The following examples show how to use io.prometheus.client.dropwizard.samplebuilder.DefaultSampleBuilder. 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: DefaultSampleBuilderTest.java    From client_java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_WHEN_NoSuffixAndExtraLabels_THEN_ShouldReturnCorrectSample() {
    final DefaultSampleBuilder builder = new DefaultSampleBuilder();
    final Collector.MetricFamilySamples.Sample result = builder.createSample("org.github.name", null, null, null, 1d);
    Assert.assertEquals(
            new Collector.MetricFamilySamples.Sample("org_github_name", Collections.<String>emptyList(), Collections.<String>emptyList(), 1d)
            , result);
}
 
Example #2
Source File: DefaultSampleBuilderTest.java    From client_java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_WHEN_SuffixAndExtraLabels_THEN_ShouldReturnCorrectSample() {
    final DefaultSampleBuilder builder = new DefaultSampleBuilder();
    final Collector.MetricFamilySamples.Sample result = builder.createSample("org.github.name", "suffix.test", Collections.singletonList("another"), Arrays.asList("label"), 1d);
    Assert.assertEquals(
            new Collector.MetricFamilySamples.Sample("org_github_namesuffix_test", Collections.singletonList("another"),
                    Arrays.asList("label"), 1d), result);

}
 
Example #3
Source File: IrisDropwizardExports.java    From arcusplatform with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new DropwizardExports with a {@link DefaultSampleBuilder}.
 *
 * @param registry a metric registry to export in prometheus.
 */
public IrisDropwizardExports(MetricRegistry registry) {
   this.registry = registry;
   this.sampleBuilder = new DefaultSampleBuilder();
}
 
Example #4
Source File: DropwizardExports.java    From client_java with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new DropwizardExports with a {@link DefaultSampleBuilder}.
 *
 * @param registry a metric registry to export in prometheus.
 */
public DropwizardExports(MetricRegistry registry) {
    this.registry = registry;
    this.sampleBuilder = new DefaultSampleBuilder();
}