Search in sources :

Example 21 with MetricName

use of com.palantir.tritium.metrics.registry.MetricName in project atlasdb by palantir.

the class InstrumentationUtilsTest method untaggedAndTaggedMetricRegistryFailureMetricsHaveDifferentNames.

@Test
public void untaggedAndTaggedMetricRegistryFailureMetricsHaveDifferentNames() {
    MetricName legacyFailureMetricName = MetricName.builder().safeName(InstrumentationUtils.TAGGED_FAILURES_METRIC_NAME.safeName()).build();
    assertThat(InstrumentationUtils.TAGGED_FAILURES_METRIC_NAME).isNotEqualTo(legacyFailureMetricName);
}
Also used : MetricName(com.palantir.tritium.metrics.registry.MetricName) Test(org.junit.Test)

Example 22 with MetricName

use of com.palantir.tritium.metrics.registry.MetricName in project atlasdb by palantir.

the class TransactionOutcomeMetricsAssert method checkPresentAndCheckCount.

private void checkPresentAndCheckCount(TransactionOutcome outcome, long count, TableReference tableReference) {
    MetricName metricName = actual.getMetricName(outcome, getTableReferenceTags(tableReference));
    checkPresentAndCheckCount(metricName, count);
}
Also used : MetricName(com.palantir.tritium.metrics.registry.MetricName)

Example 23 with MetricName

use of com.palantir.tritium.metrics.registry.MetricName in project atlasdb by palantir.

the class TransactionOutcomeMetricsAssert method hasPlaceholderWriteWriteConflictsSatisfying.

public TransactionOutcomeMetricsAssert hasPlaceholderWriteWriteConflictsSatisfying(LongConsumer assertion) {
    MetricName metricName = actual.getMetricName(TransactionOutcome.WRITE_WRITE_CONFLICT, getTableReferenceTags(LoggingArgs.PLACEHOLDER_TABLE_REFERENCE));
    assertion.accept(taggedMetricRegistry.meter(metricName).getCount());
    return this;
}
Also used : MetricName(com.palantir.tritium.metrics.registry.MetricName)

Example 24 with MetricName

use of com.palantir.tritium.metrics.registry.MetricName in project atlasdb by palantir.

the class ToplistDeltaFilteringTableLevelMetricsControllerTest method operatesCorrectlyWithSharedContexts.

@Test
public void operatesCorrectlyWithSharedContexts() {
    MetricsManager otherManager = MetricsManagers.createAlwaysSafeAndFilteringForTests();
    ToplistDeltaFilteringTableLevelMetricsController otherController = new ToplistDeltaFilteringTableLevelMetricsController(context, otherManager, mockClock);
    Map<Integer, Counter> counters = KeyedStream.of(ImmutableList.of(1, 2, 4)).map(value -> controller.createAndRegisterCounter(Class.class, "metricName", TableReference.create(Namespace.create("namespace"), "table" + value))).collectToMap();
    counters.forEach((value, counter) -> counter.inc(value));
    Counter otherControllersCounter = otherController.createAndRegisterCounter(Class.class, "metricName", TableReference.create(Namespace.create("namespace"), "table3"));
    otherControllersCounter.inc(3);
    assertThat(metricsManager.getPublishableMetrics().getMetrics()).containsOnlyKeys(getMetricName("table2"), getMetricName("table4"));
    assertThat(otherManager.getPublishableMetrics().getMetrics()).containsOnlyKeys(getMetricName("table3"));
}
Also used : IntStream(java.util.stream.IntStream) Clock(com.codahale.metrics.Clock) Namespace(com.palantir.atlasdb.keyvalue.api.Namespace) MetricName(com.palantir.tritium.metrics.registry.MetricName) ImmutableMap(com.google.common.collect.ImmutableMap) KeyedStream(com.palantir.common.streams.KeyedStream) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) MetricsManagers(com.palantir.atlasdb.util.MetricsManagers) List(java.util.List) MetricsManager(com.palantir.atlasdb.util.MetricsManager) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) Counter(com.codahale.metrics.Counter) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Mockito.mock(org.mockito.Mockito.mock) Before(org.junit.Before) Counter(com.codahale.metrics.Counter) MetricsManager(com.palantir.atlasdb.util.MetricsManager) Test(org.junit.Test)

Example 25 with MetricName

use of com.palantir.tritium.metrics.registry.MetricName in project atlasdb by palantir.

the class MetricsManager method registerOrGetTaggedHistogram.

public Histogram registerOrGetTaggedHistogram(Class<?> clazz, String metricName, Map<String, String> tags) {
    MetricName name = getTaggedMetricName(clazz, metricName, tags);
    Histogram histogram = taggedMetricRegistry.histogram(name);
    registerTaggedMetricName(name);
    return histogram;
}
Also used : MetricName(com.palantir.tritium.metrics.registry.MetricName) Histogram(com.codahale.metrics.Histogram)

Aggregations

MetricName (com.palantir.tritium.metrics.registry.MetricName)37 TaggedMetricRegistry (com.palantir.tritium.metrics.registry.TaggedMetricRegistry)11 Test (org.junit.jupiter.api.Test)10 Metric (com.codahale.metrics.Metric)9 DefaultTaggedMetricRegistry (com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry)9 Timer (com.codahale.metrics.Timer)7 Counter (com.codahale.metrics.Counter)6 Histogram (com.codahale.metrics.Histogram)6 Meter (com.codahale.metrics.Meter)6 Test (org.junit.Test)6 Gauge (com.codahale.metrics.Gauge)5 Closeable (java.io.Closeable)5 ImmutableList (com.google.common.collect.ImmutableList)4 List (java.util.List)4 ConsoleReporter (com.codahale.metrics.ConsoleReporter)3 MetricSet (com.codahale.metrics.MetricSet)3 OkHttpClient (okhttp3.OkHttpClient)3 Request (okhttp3.Request)3 Response (okhttp3.Response)3 ExponentiallyDecayingReservoir (com.codahale.metrics.ExponentiallyDecayingReservoir)2