Search in sources :

Example 6 with MessageProduceParameters

use of com.newrelic.api.agent.MessageProduceParameters in project newrelic-java-agent by newrelic.

the class UtilTest method testGenerateProduceMetricsBadQueueName.

@Test
public void testGenerateProduceMetricsBadQueueName() {
    MessageProduceParameters messageProduceParameters = Util.generateExternalProduceMetrics("path");
    Assert.assertEquals("SQS", messageProduceParameters.getLibrary());
    Assert.assertEquals("unknown", messageProduceParameters.getDestinationName());
    Assert.assertEquals(DestinationType.NAMED_QUEUE, messageProduceParameters.getDestinationType());
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) Test(org.junit.Test)

Example 7 with MessageProduceParameters

use of com.newrelic.api.agent.MessageProduceParameters in project newrelic-java-agent by newrelic.

the class SqsClient_Instrumentation method sendMessageBatch.

@Trace
public SendMessageBatchResponse sendMessageBatch(SendMessageBatchRequest sendMessageBatchRequest) {
    MessageProduceParameters messageProduceParameters = Util.generateExternalProduceMetrics(sendMessageBatchRequest.queueUrl());
    NewRelic.getAgent().getTracedMethod().reportAsExternal(messageProduceParameters);
    return Weaver.callOriginal();
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) Trace(com.newrelic.api.agent.Trace)

Example 8 with MessageProduceParameters

use of com.newrelic.api.agent.MessageProduceParameters in project newrelic-java-agent by newrelic.

the class SqsClient_Instrumentation method sendMessage.

@Trace
public SendMessageResponse sendMessage(SendMessageRequest sendMessageRequest) {
    MessageProduceParameters messageProduceParameters = Util.generateExternalProduceMetrics(sendMessageRequest.queueUrl());
    NewRelic.getAgent().getTracedMethod().reportAsExternal(messageProduceParameters);
    return Weaver.callOriginal();
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) Trace(com.newrelic.api.agent.Trace)

Example 9 with MessageProduceParameters

use of com.newrelic.api.agent.MessageProduceParameters in project newrelic-java-agent by newrelic.

the class SNSInstrumentationHelperTest method testTargetArnBasedMessage.

@Test
public void testTargetArnBasedMessage() throws Exception {
    PublishRequest publishRequest = new PublishRequest(null, "message", "VERY IMPORTANT");
    publishRequest.setTargetArn("userSpecifiedTargetArn");
    MessageProduceParameters result = SNSInstrumentationHelper.makeMessageProducerParameters(publishRequest);
    assertEquals("SNS", result.getLibrary());
    assertEquals("userSpecifiedTargetArn", result.getDestinationName());
    assertEquals(DestinationType.NAMED_TOPIC, result.getDestinationType());
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) PublishRequest(com.amazonaws.services.sns.model.PublishRequest) Test(org.junit.Test)

Example 10 with MessageProduceParameters

use of com.newrelic.api.agent.MessageProduceParameters in project newrelic-java-agent by newrelic.

the class SnsClientInstrumentationHelper method startSegmentAndReportAsExternal.

public static Segment startSegmentAndReportAsExternal(PublishRequest publishRequest) {
    Transaction transaction = NewRelic.getAgent().getTransaction();
    Segment segment = transaction.startSegment("SNS");
    MessageProduceParameters params = SnsClientInstrumentationHelper.makeMessageProducerParameters(publishRequest);
    segment.reportAsExternal(params);
    return segment;
}
Also used : Transaction(com.newrelic.api.agent.Transaction) MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) Segment(com.newrelic.api.agent.Segment)

Aggregations

MessageProduceParameters (com.newrelic.api.agent.MessageProduceParameters)17 Test (org.junit.Test)8 Trace (com.newrelic.api.agent.Trace)5 PublishRequest (com.amazonaws.services.sns.model.PublishRequest)3 PublishRequest (software.amazon.awssdk.services.sns.model.PublishRequest)3 Segment (com.newrelic.api.agent.Segment)2 HttpParameters (com.newrelic.api.agent.HttpParameters)1 InboundHeaders (com.newrelic.api.agent.InboundHeaders)1 MessageConsumeParameters (com.newrelic.api.agent.MessageConsumeParameters)1 Transaction (com.newrelic.api.agent.Transaction)1 CallbackWrapper (com.nr.instrumentation.kafka.CallbackWrapper)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1