Search in sources :

Example 1 with LatencyMetricsAggregatedEvent

use of com.couchbase.client.core.cnc.events.metrics.LatencyMetricsAggregatedEvent in project couchbase-jvm-clients by couchbase.

the class LoggingMeterIntegrationTest method aggregateMetrics.

@Test
void aggregateMetrics() {
    String id = UUID.randomUUID().toString();
    collection.upsert(id, JsonObject.create());
    collection.get(id);
    waitUntilCondition(() -> eventBus.publishedEvents().stream().anyMatch(e -> e instanceof LatencyMetricsAggregatedEvent));
    List<Event> events = eventBus.publishedEvents().stream().filter(e -> e instanceof LatencyMetricsAggregatedEvent).collect(Collectors.toList());
    for (Event ev : events) {
        String desc = ev.description();
        assertTrue(desc.contains("{\"emit_interval_s\":2}"), "Actual description: " + desc);
        assertTrue(desc.contains("kv"), "Actual description: " + desc);
    }
}
Also used : JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Util.waitUntilCondition(com.couchbase.client.test.Util.waitUntilCondition) LatencyMetricsAggregatedEvent(com.couchbase.client.core.cnc.events.metrics.LatencyMetricsAggregatedEvent) Event(com.couchbase.client.core.cnc.Event) LoggingMeterConfig(com.couchbase.client.core.env.LoggingMeterConfig) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) AfterAll(org.junit.jupiter.api.AfterAll) Test(org.junit.jupiter.api.Test) SimpleEventBus(com.couchbase.client.core.cnc.SimpleEventBus) Collection(com.couchbase.client.java.Collection) Bucket(com.couchbase.client.java.Bucket) List(java.util.List) BeforeAll(org.junit.jupiter.api.BeforeAll) Cluster(com.couchbase.client.java.Cluster) Duration(java.time.Duration) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) JsonObject(com.couchbase.client.java.json.JsonObject) LatencyMetricsAggregatedEvent(com.couchbase.client.core.cnc.events.metrics.LatencyMetricsAggregatedEvent) LatencyMetricsAggregatedEvent(com.couchbase.client.core.cnc.events.metrics.LatencyMetricsAggregatedEvent) Event(com.couchbase.client.core.cnc.Event) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

Event (com.couchbase.client.core.cnc.Event)1 SimpleEventBus (com.couchbase.client.core.cnc.SimpleEventBus)1 LatencyMetricsAggregatedEvent (com.couchbase.client.core.cnc.events.metrics.LatencyMetricsAggregatedEvent)1 LoggingMeterConfig (com.couchbase.client.core.env.LoggingMeterConfig)1 Bucket (com.couchbase.client.java.Bucket)1 Cluster (com.couchbase.client.java.Cluster)1 Collection (com.couchbase.client.java.Collection)1 JsonObject (com.couchbase.client.java.json.JsonObject)1 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)1 Util.waitUntilCondition (com.couchbase.client.test.Util.waitUntilCondition)1 Duration (java.time.Duration)1 List (java.util.List)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 AfterAll (org.junit.jupiter.api.AfterAll)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 Test (org.junit.jupiter.api.Test)1