Search in sources :

Example 11 with MessageProduceParameters

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

the class SnsClientInstrumentationHelperTest method testTargetArnBasedMessage.

@Test
public void testTargetArnBasedMessage() throws Exception {
    PublishRequest publishRequest = PublishRequest.builder().message("message").targetArn("userSpecifiedTargetArn").subject("VERY IMPORTANT").build();
    MessageProduceParameters result = SnsClientInstrumentationHelper.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(software.amazon.awssdk.services.sns.model.PublishRequest) Test(org.junit.Test)

Example 12 with MessageProduceParameters

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

the class SnsClientInstrumentationHelperTest method testTopicArnBasedMessage.

@Test
public void testTopicArnBasedMessage() throws Exception {
    PublishRequest publishRequest = PublishRequest.builder().message("message").topicArn("userSpecifiedTopicArn").subject("VERY IMPORTANT").build();
    MessageProduceParameters result = SnsClientInstrumentationHelper.makeMessageProducerParameters(publishRequest);
    assertEquals("SNS", result.getLibrary());
    assertEquals("userSpecifiedTopicArn", result.getDestinationName());
    assertEquals(DestinationType.NAMED_TOPIC, result.getDestinationType());
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) PublishRequest(software.amazon.awssdk.services.sns.model.PublishRequest) Test(org.junit.Test)

Example 13 with MessageProduceParameters

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

the class AmazonSQS_Instrumentation method sendMessageBatch.

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

Example 14 with MessageProduceParameters

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

the class AmazonSQS_Instrumentation method sendMessage.

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

Example 15 with MessageProduceParameters

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

the class UtilTest method testGenerateProduceMetricsGoodQueueName.

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

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