Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking AWS MQ infrastructure entities #1898

Closed
wants to merge 46 commits into from
Closed

Linking AWS MQ infrastructure entities #1898

wants to merge 46 commits into from

Conversation

obenkenobi
Copy link
Contributor

@obenkenobi obenkenobi commented May 17, 2024

Overview

This PR uses the changes from the DynamoDB PR. Merge the DynamoDB PR first before merging this PR.

This PR adds new span attributes containing endpoint information from a message broker. This is so the Java Agent can properly link with infrastructure entities generated from AWS MQ.

The new span attributes are the following:

  • server.address which contain the message broker host
  • server.port which contain the message broker port.
  • messaging.rabbitmq.destination.routing_key which is the routing key for a RabbitMQ operation
  • messaging.destination.name which will be the destination for a RabbitMQ operation. For producers this will be the exchange name. For consumers this is the queue name.
  • messaging.destination_publish.name is an otel attribute for message consumers used to indicate what the destination name for the producer is. In the case of RabbitMQ, this is the exchange name.

The externals API has new optional parameters to add host and port for message broker spans, via the method instance(host,port).

For example

ExternalParameters messageProduceParameters = MessageProduceParameters
    .library("JMS")
    .destinationType(DestinationType.NAMED_QUEUE)
    .destinationName("MessageQueue")
    .outboundHeaders(outboundMessageHeaders)
    .instance("localhost", 8088)
    .build();
NewRelic.getAgent().getTracedMethod().reportAsExternal(messageProduceParameters);

ExternalParameters messageConsumeParameters = MessageConsumeParameters
    .library("JMS")
    .destinationType(DestinationType.NAMED_TOPIC)
    .destinationName("MessageTopic")
    .inboundHeaders(inboundMessageHeaders)
    .instance("localhost", 8088)
    .build();
NewRelic.getAgent().getTracedMethod().reportAsExternal(messageConsumeParameters);

Our JMS (if ActiveMQ is used) and RabbitMQ instrumentation automatically add the span attributes.

To get host and port from ActiveMQ, a new instrumentation module was added called activemq-client-5.8.0

On top of that, therabbit-amqp and jms instrumentation was altered to automatically include host and port span attributes.

For our RabbitMQ instrumentation, the existing agent attributes message.routingKey and message.queueName are also added to spans.

In addition the instrumentation was revised so instrumentation module names better match the versions they apply to and to allow host and port information to be reported.

Related Github Issue

#1876
#1832

meiao and others added 26 commits April 18, 2024 18:42
Setting cloud.resource_id in DynamoDB instrumentation
@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

Attention: Patch coverage is 60.19417% with 41 lines in your changes missing coverage. Please review.

Project coverage is 69.76%. Comparing base (464aa44) to head (cae16b6).
Report is 423 commits behind head on main.

Files Patch % Lines
...java/com/newrelic/agent/tracers/DefaultTracer.java 30.43% 15 Missing and 1 partial ⚠️
...ewrelic/agent/bridge/messaging/BrokerInstance.java 0.00% 7 Missing ⚠️
...ava/com/newrelic/agent/tracers/AbstractTracer.java 36.36% 5 Missing and 2 partials ⚠️
...om/newrelic/agent/util/AgentCollectionFactory.java 0.00% 5 Missing ⚠️
...ewrelic/agent/bridge/DefaultCollectionFactory.java 60.00% 1 Missing and 1 partial ⚠️
...n/java/com/newrelic/agent/util/AwsAccountUtil.java 90.47% 0 Missing and 2 partials ⚠️
...newrelic/agent/bridge/messaging/JmsProperties.java 0.00% 1 Missing ⚠️
...elic/agent/service/analytics/SpanEventFactory.java 96.42% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1898      +/-   ##
============================================
- Coverage     70.68%   69.76%   -0.92%     
+ Complexity     9861     9775      -86     
============================================
  Files           826      829       +3     
  Lines         39792    39882      +90     
  Branches       6061     6078      +17     
============================================
- Hits          28127    27824     -303     
- Misses         8946     9370     +424     
+ Partials       2719     2688      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@obenkenobi obenkenobi closed this Jul 12, 2024
@obenkenobi
Copy link
Contributor Author

aws-mq-rebased is where the MQ changes are pulled to to prevent pollution from dynamo db changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants