use of com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace in project pinpoint by naver.
the class KafkaClientITBase method verifyConsumerEntryPoint.
private void verifyConsumerEntryPoint(PluginTestVerifier verifier, String topic, String expectedRpc, Class<?> paramType, ExpectedAnnotation... expectedAnnotations) throws NoSuchMethodException {
Method sendMethod = KafkaProducer.class.getDeclaredMethod("send", ProducerRecord.class, Callback.class);
ExpectedTrace.Builder eventBuilder = ExpectedTrace.createEventBuilder(KAFKA_CLIENT_SERVICE_TYPE);
eventBuilder.setMethod(sendMethod);
eventBuilder.setEndPoint(BROKER_URL);
eventBuilder.setDestinationId(BROKER_URL);
eventBuilder.setAnnotations(annotation("kafka.topic", topic));
ExpectedTrace producerSendExpected = eventBuilder.build();
ExpectedTrace.Builder rootBuilder = ExpectedTrace.createRootBuilder(KAFKA_CLIENT_SERVICE_TYPE);
rootBuilder.setMethodSignature("Kafka Consumer Invocation");
rootBuilder.setRpc(expectedRpc);
rootBuilder.setRemoteAddr(BROKER_URL);
rootBuilder.setAnnotations(expectedAnnotations);
ExpectedTrace consumerEntryPointInvocationExpected = rootBuilder.build();
Method consumeRecordsMethod = TestConsumerRecordEntryPoint.class.getDeclaredMethod("consumeRecord", paramType);
ExpectedTrace messageArrivedExpected = event(KAFKA_CLIENT_INTERNAL_SERVICE_TYPE, consumeRecordsMethod);
verifier.printCache();
verifier.verifyDiscreteTrace(producerSendExpected, consumerEntryPointInvocationExpected, messageArrivedExpected);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace in project pinpoint by naver.
the class PahoMqttV5ClientIT method verifyTrace.
private void verifyTrace(PluginTestVerifier verifier) throws NoSuchMethodException {
Method publishMethod = MqttAsyncClient.class.getDeclaredMethod("publish", String.class, MqttMessage.class, Object.class, org.eclipse.paho.mqttv5.client.MqttActionListener.class);
ExpectedTrace publishExpected = event(PAHO_MQTT_CLIENT, publishMethod, annotation("mqtt.broker.uri", container.getBrokerUrl()), annotation("mqtt.topic", TOPIC), annotation("mqtt.message.payload", MESSAGE_PAYLOAD), annotation("mqtt.qos", QOS));
String expectedRpcName = "mqtt://topic=" + TOPIC + "&qos=" + QOS;
ExpectedTrace messageArrivedInvocationExpected = root(PAHO_MQTT_CLIENT, "MQTT Message Arrived Invocation", expectedRpcName, null, container.getBrokerUrl(), annotation("mqtt.message.payload", MESSAGE_PAYLOAD));
Method messageArrivedMethod = CommsCallback.class.getDeclaredMethod("messageArrived", MqttPublish.class);
ExpectedTrace messageArrivedExpected = event(PAHO_MQTT_CLIENT_INTERNAL, messageArrivedMethod);
verifier.verifyDiscreteTrace(publishExpected, messageArrivedInvocationExpected, messageArrivedExpected);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace in project pinpoint by naver.
the class PahoMqttV3ClientIT method verifyTrace.
private void verifyTrace(PluginTestVerifier verifier) throws NoSuchMethodException {
Method publishMethod = MqttAsyncClient.class.getDeclaredMethod("publish", String.class, MqttMessage.class, Object.class, org.eclipse.paho.client.mqttv3.IMqttActionListener.class);
ExpectedTrace publishExpected = event(PAHO_MQTT_CLIENT, publishMethod, annotation("mqtt.broker.uri", container.getBrokerUrl()), annotation("mqtt.topic", TOPIC), annotation("mqtt.message.payload", MESSAGE_PAYLOAD), annotation("mqtt.qos", QOS));
String expectedRpcName = "mqtt://topic=" + TOPIC + "&qos=" + QOS;
ExpectedTrace messageArrivedInvocationExpected = root(PAHO_MQTT_CLIENT, "MQTT Message Arrived Invocation", expectedRpcName, null, container.getBrokerUrl(), annotation("mqtt.message.payload", MESSAGE_PAYLOAD));
Method messageArrivedMethod = CommsCallback.class.getDeclaredMethod("messageArrived", MqttPublish.class);
ExpectedTrace messageArrivedExpected = event(PAHO_MQTT_CLIENT_INTERNAL, messageArrivedMethod);
verifier.verifyDiscreteTrace(publishExpected, messageArrivedInvocationExpected, messageArrivedExpected);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace in project pinpoint by naver.
the class ProcessIT method test1.
@Test
public void test1() throws Exception {
Process process = Runtime.getRuntime().exec(CMD);
long pid = getPid(process);
process.destroy();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
ExpectedTrace event = event("PROCESS", ProcessBuilder.class.getMethod("start"), processAnnotations(pid));
verifier.verifyTrace(event);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace in project pinpoint by naver.
the class ProcessIT method test0.
@Test
public void test0() throws Exception {
ProcessBuilder pb = new ProcessBuilder(CMD);
Process process = pb.start();
long pid = getPid(process);
process.destroy();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
ExpectedTrace event = event("PROCESS", ProcessBuilder.class.getMethod("start"), processAnnotations(pid));
verifier.verifyTrace(event);
}
Aggregations