io.micrometer.core.instrument.search.RequiredSearch Java Examples
The following examples show how to use
io.micrometer.core.instrument.search.RequiredSearch.
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: MonitoredAspectTest.java From waggle-dance with Apache License 2.0 | 6 votes |
@Test public void specialChars() throws Throwable { reset(signature); when(signature.getDeclaringTypeName()).thenReturn("$Type<Enc>$"); when(signature.getName()).thenReturn("<method$x>"); aspect.monitor(pjp, monitored); RequiredSearch rs = meterRegistry.get("counter._Type_Enc__._method_x_.all.calls"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("counter._Type_Enc__._method_x_.all.success"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("timer._Type_Enc__._method_x_.all.duration"); assertThat(rs.timer().count(), is(1L)); }
Example #2
Source File: MonitoredAspectTest.java From waggle-dance with Apache License 2.0 | 6 votes |
@Test public void monitorFailures() throws Throwable { when(pjp.proceed()).thenThrow(new ClassCastException()); try { aspect.monitor(pjp, monitored); } catch (ClassCastException e) { // Expected } RequiredSearch rs = meterRegistry.get("counter.Type_Anonymous.myMethod.all.calls"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("counter.Type_Anonymous.myMethod.all.failure"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("timer.Type_Anonymous.myMethod.all.duration"); assertThat(rs.timer().count(), is(1L)); }
Example #3
Source File: MonitoredAspectTest.java From waggle-dance with Apache License 2.0 | 6 votes |
@Test public void monitorFailuresForSpecificMetastore() throws Throwable { CurrentMonitoredMetaStoreHolder.monitorMetastore("metastoreName"); when(pjp.proceed()).thenThrow(new ClassCastException()); try { aspect.monitor(pjp, monitored); } catch (ClassCastException e) { // Expected } RequiredSearch rs = meterRegistry.get("counter.Type_Anonymous.myMethod.metastoreName.calls"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("counter.Type_Anonymous.myMethod.metastoreName.failure"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("timer.Type_Anonymous.myMethod.metastoreName.duration"); assertThat(rs.timer().count(), is(1L)); }
Example #4
Source File: MonitoredAspectTest.java From waggle-dance with Apache License 2.0 | 5 votes |
@Test public void monitorSuccesses() throws Throwable { aspect.monitor(pjp, monitored); RequiredSearch rs = meterRegistry.get("counter.Type_Anonymous.myMethod.all.calls"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("counter.Type_Anonymous.myMethod.all.success"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("timer.Type_Anonymous.myMethod.all.duration"); assertThat(rs.timer().count(), is(1L)); }
Example #5
Source File: MonitoredAspectTest.java From waggle-dance with Apache License 2.0 | 5 votes |
@Test public void monitorSuccessesForSpecificMetastore() throws Throwable { CurrentMonitoredMetaStoreHolder.monitorMetastore("metastoreName"); aspect.monitor(pjp, monitored); RequiredSearch rs = meterRegistry.get("counter.Type_Anonymous.myMethod.metastoreName.calls"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("counter.Type_Anonymous.myMethod.metastoreName.success"); assertThat(rs.counter().count(), is(1.0)); rs = meterRegistry.get("timer.Type_Anonymous.myMethod.metastoreName.duration"); assertThat(rs.timer().count(), is(1L)); }
Example #6
Source File: TaggedBulkheadMetricsTest.java From resilience4j with Apache License 2.0 | 5 votes |
@Test public void customTagsShouldBeAdded() { Bulkhead bulkheadC = bulkheadRegistry.bulkhead("backendC", io.vavr.collection.HashMap.of("key1", "value1")); // record some basic stats bulkheadC.tryAcquirePermission(); bulkheadC.tryAcquirePermission(); List<Meter> meters = meterRegistry.getMeters(); assertThat(meters).hasSize(4); final RequiredSearch match = meterRegistry.get(DEFAULT_BULKHEAD_MAX_ALLOWED_CONCURRENT_CALLS_METRIC_NAME).tags("key1", "value1"); assertThat(match).isNotNull(); }
Example #7
Source File: TaggedTimeLimiterMetricsPublisherTest.java From resilience4j with Apache License 2.0 | 5 votes |
@Test public void shouldAddCustomTags() { TimeLimiter timeLimiterF = timeLimiterRegistry.timeLimiter("backendF", io.vavr.collection.HashMap.of("key1", "value1")); timeLimiterF.onSuccess(); assertThat(taggedTimeLimiterMetricsPublisher.meterIdMap).containsKeys("backendA", "backendF"); assertThat(taggedTimeLimiterMetricsPublisher.meterIdMap.get("backendF")).hasSize(3); assertThat(meterRegistry.getMeters()).hasSize(6); RequiredSearch match = meterRegistry.get(DEFAULT_TIME_LIMITER_CALLS).tags("key1", "value1"); assertThat(match).isNotNull(); }
Example #8
Source File: TaggedCircuitBreakerMetricsTest.java From resilience4j with Apache License 2.0 | 5 votes |
@Test public void shouldAddCustomTags() { CircuitBreaker circuitBreakerF = circuitBreakerRegistry.circuitBreaker("backendF", io.vavr.collection.HashMap.of("key1", "value1")); circuitBreakerF.onSuccess(0, TimeUnit.NANOSECONDS); assertThat(taggedCircuitBreakerMetrics.meterIdMap).containsKeys("backendA", "backendF"); assertThat(taggedCircuitBreakerMetrics.meterIdMap.get("backendF")).hasSize(16); List<Meter> meters = meterRegistry.getMeters(); assertThat(meters).hasSize(32); final RequiredSearch match = meterRegistry.get(DEFAULT_CIRCUIT_BREAKER_BUFFERED_CALLS).tags("key1", "value1"); assertThat(match).isNotNull(); }
Example #9
Source File: AbstractCacheMetricsTest.java From micrometer with Apache License 2.0 | 4 votes |
protected RequiredSearch fetch(MeterRegistry meterRegistry, String name) { return fetch(meterRegistry, name, expectedTag); }
Example #10
Source File: AbstractCacheMetricsTest.java From micrometer with Apache License 2.0 | 4 votes |
protected RequiredSearch fetch(MeterRegistry meterRegistry, String name, Iterable<Tag> tags) { return meterRegistry.get(name).tags(tags); }
Example #11
Source File: Hazelcast3CacheMetricsTest.java From micrometer with Apache License 2.0 | 4 votes |
private RequiredSearch fetch(MeterRegistry meterRegistry, String name) { return fetch(meterRegistry, name, Tags.empty()); }
Example #12
Source File: Hazelcast3CacheMetricsTest.java From micrometer with Apache License 2.0 | 4 votes |
private RequiredSearch fetch(MeterRegistry meterRegistry, String name, Iterable<Tag> tags) { return meterRegistry.get(name).tags(tags); }
Example #13
Source File: MeterRegistry.java From micrometer with Apache License 2.0 | 2 votes |
/** * Initiate a search beginning with a metric name. All constraints added in the search must be satisfied or * an {@link MeterNotFoundException} is thrown. * * @param name The meter name to locate. * @return A new search. */ public RequiredSearch get(String name) { return RequiredSearch.in(this).name(name); }