Search in sources :

Example 1 with OverThresholdRequestsRecordedEvent

use of com.couchbase.client.core.cnc.events.tracing.OverThresholdRequestsRecordedEvent in project couchbase-jvm-clients by couchbase.

the class ThresholdLoggingTracerIntegrationTest method assertInEvent.

private void assertInEvent(String opName) {
    waitUntilCondition(() -> eventBus.publishedEvents().stream().anyMatch(e -> e instanceof OverThresholdRequestsRecordedEvent));
    List<Event> events = eventBus.publishedEvents().stream().filter(e -> e instanceof OverThresholdRequestsRecordedEvent).collect(Collectors.toList());
    boolean found = false;
    for (Event event : events) {
        String output = event.description();
        if (output.contains("\"operation_name\":\"" + opName + "\"")) {
            found = true;
        }
    }
    assertTrue(found, "Operation Name: " + opName + " not found!");
}
Also used : JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Util.waitUntilCondition(com.couchbase.client.test.Util.waitUntilCondition) Capabilities(com.couchbase.client.test.Capabilities) OverThresholdRequestsRecordedEvent(com.couchbase.client.core.cnc.events.tracing.OverThresholdRequestsRecordedEvent) Event(com.couchbase.client.core.cnc.Event) ClusterType(com.couchbase.client.test.ClusterType) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) 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) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) ThresholdLoggingTracerConfig(com.couchbase.client.core.env.ThresholdLoggingTracerConfig) 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) OverThresholdRequestsRecordedEvent(com.couchbase.client.core.cnc.events.tracing.OverThresholdRequestsRecordedEvent) OverThresholdRequestsRecordedEvent(com.couchbase.client.core.cnc.events.tracing.OverThresholdRequestsRecordedEvent) Event(com.couchbase.client.core.cnc.Event)

Aggregations

Event (com.couchbase.client.core.cnc.Event)1 SimpleEventBus (com.couchbase.client.core.cnc.SimpleEventBus)1 OverThresholdRequestsRecordedEvent (com.couchbase.client.core.cnc.events.tracing.OverThresholdRequestsRecordedEvent)1 ThresholdLoggingTracerConfig (com.couchbase.client.core.env.ThresholdLoggingTracerConfig)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 Capabilities (com.couchbase.client.test.Capabilities)1 ClusterType (com.couchbase.client.test.ClusterType)1 IgnoreWhen (com.couchbase.client.test.IgnoreWhen)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 AfterEach (org.junit.jupiter.api.AfterEach)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1