Search in sources :

Example 36 with Tag

use of org.eclipse.microprofile.metrics.Tag in project Payara by payara.

the class BulkheadMetricTckTest method bulkheadMetricRejectionTest.

/**
 * Scenario is equivalent to the TCK test of same name but not 100% identical
 */
@Test(timeout = 3000)
public void bulkheadMetricRejectionTest() {
    callMethodWithNewThreadAndWaitFor(commonWaiter);
    callMethodWithNewThreadAndWaitFor(commonWaiter);
    waitUntilPermitsAquired(2, 0);
    assertFurtherThreadThrowsBulkheadException(1);
    commonWaiter.complete(null);
    waitUntilPermitsAquired(0, 0);
    String methodName = "fish.payara.microprofile.faulttolerance.policy.BulkheadMetricTckTest.bulkheadMetricRejectionTest_Method";
    @SuppressWarnings("unchecked") Gauge<Long> excutionsRunning = (Gauge<Long>) registry.getGauge(new MetricID("ft.bulkhead.executionsRunning", new Tag("method", methodName)));
    assertNotNull(excutionsRunning);
    assertEquals(0, excutionsRunning.getValue().intValue());
    Counter acceptedCalls = registry.getCounter(new MetricID("ft.bulkhead.calls.total", new Tag("method", methodName), new Tag("bulkheadResult", "accepted")));
    assertNotNull(acceptedCalls);
    assertEquals(2, acceptedCalls.getCount());
    Counter rejectedCalls = registry.getCounter(new MetricID("ft.bulkhead.calls.total", new Tag("method", methodName), new Tag("bulkheadResult", "rejected")));
    assertNotNull(rejectedCalls);
    assertEquals(1, rejectedCalls.getCount());
}
Also used : MetricID(org.eclipse.microprofile.metrics.MetricID) Counter(org.eclipse.microprofile.metrics.Counter) Tag(org.eclipse.microprofile.metrics.Tag) Gauge(org.eclipse.microprofile.metrics.Gauge) Test(org.junit.Test)

Aggregations

Tag (org.eclipse.microprofile.metrics.Tag)36 MetricID (org.eclipse.microprofile.metrics.MetricID)25 Test (org.junit.Test)23 Metadata (org.eclipse.microprofile.metrics.Metadata)12 Counter (org.eclipse.microprofile.metrics.Counter)7 Metric (org.eclipse.microprofile.metrics.Metric)5 Snapshot (org.eclipse.microprofile.metrics.Snapshot)5 Histogram (org.eclipse.microprofile.metrics.Histogram)4 ArrayList (java.util.ArrayList)2 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)2 JsonObjectBuilder (javax.json.JsonObjectBuilder)2 ConcurrentGauge (org.eclipse.microprofile.metrics.ConcurrentGauge)2 Gauge (org.eclipse.microprofile.metrics.Gauge)2 Meter (org.eclipse.microprofile.metrics.Meter)2 SimpleTimer (org.eclipse.microprofile.metrics.SimpleTimer)2 Timer (org.eclipse.microprofile.metrics.Timer)2 TimerImpl (fish.payara.microprofile.metrics.impl.TimerImpl)1 ExtendedMetadata (io.smallrye.metrics.ExtendedMetadata)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1