Search in sources :

Example 16 with MessageProduceParameters

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

the class Util method generateExternalProduceMetrics.

public static MessageProduceParameters generateExternalProduceMetrics(String queueUrl) {
    String queueName = UNKOWN;
    int index = queueUrl.lastIndexOf('/');
    if (index > 0) {
        queueName = queueUrl.substring(index + 1);
    }
    MessageProduceParameters params = MessageProduceParameters.library(LIBRARY).destinationType(DestinationType.NAMED_QUEUE).destinationName(queueName).outboundHeaders(null).build();
    return params;
}
Also used : MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters)

Example 17 with MessageProduceParameters

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

the class DefaultTracer method reportAsExternal.

@Override
public void reportAsExternal(ExternalParameters externalParameters) {
    if (Agent.LOG.isFineEnabled()) {
        Agent.LOG.log(Level.FINE, "Setting externalParameters to: " + externalParameters);
    }
    MetricNames.recordApiSupportabilityMetric(MetricNames.SUPPORTABILITY_API_REPORT_AS_EXTERNAL);
    this.externalParameters = externalParameters;
    if (this.externalParameters instanceof HttpParameters) {
        // URI validity check and logging
        HttpParameters httpParameters = (HttpParameters) this.externalParameters;
        URI uri = httpParameters.getUri();
        if (uri == null || uri.getScheme() == null || uri.getHost() == null || uri.getPort() == -1) {
            Agent.LOG.log(Level.FINE, "URI parameter passed to HttpParameters should include a valid scheme, host, and port.");
        }
        InboundHeaders headers = httpParameters.getInboundResponseHeaders();
        if (null != headers) {
            readInboundResponseHeaders(headers);
        }
    } else if (this.externalParameters instanceof MessageProduceParameters) {
        catForMessaging(((MessageProduceParameters) this.externalParameters));
    } else if (this.externalParameters instanceof MessageConsumeParameters) {
        catForMessaging(((MessageConsumeParameters) this.externalParameters));
    }
}
Also used : HttpParameters(com.newrelic.api.agent.HttpParameters) MessageConsumeParameters(com.newrelic.api.agent.MessageConsumeParameters) InboundHeaders(com.newrelic.api.agent.InboundHeaders) MessageProduceParameters(com.newrelic.api.agent.MessageProduceParameters) URI(java.net.URI)

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