Skip to content

Conversation

zsistla
Copy link
Contributor

@zsistla zsistla commented Jan 21, 2025

Most of the PR is basic instrumentation, retrieval of values and setting attributes or creating metrics and is very similar to patterns we've established in other instrumentation.
The DT header insertion logic is the trickiest bit since we are modifying the headers in flight. (look to drupal and laravel for similar logic).
Note: the DT header insertion logic, while trickiest, is something that can be turned off anytime by the user by setting newrelic.distributed_tracing_exclude_newrelic_header to true.

Initial commit does the following:

  • Detect library via magic file
  • Detect package and version information.
  • Basic unit tests

Subsequent commits:

  • Add attributes needed for rabbitMQ to message segment
  • Instrument basic_publish and basic_get
  • add unit tests, multiverse tests
  • added support for PHP 7.x
  • DT header insertion/retrieval

Remaining:

  • Add more multiverse tests, especially around the DT functionality

Initial commit does the following:
* Detect library via magic file
* Detect package and version information.
* Basic unit tests
@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented Jan 21, 2025

Test Suite Status Result
Multiverse 8/8 passing
SOAK 71/72 passing

Initial commit does the following:
* Detect library via magic file
* Detect package and version information.
* Basic unit tests
@zsistla zsistla force-pushed the feat/rabbitmq_instrumentation branch from 2df782f to 0b184ca Compare January 22, 2025 23:01
…ewrelic-php-agent into feat/rabbitmq_instrumentation
Test version detection when class exists but version const doesn't.
Fixed typos.
@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 21.50171% with 230 lines in your changes missing coverage. Please review.

Project coverage is 77.40%. Comparing base (f3f3e96) to head (851bdcd).

Files with missing lines Patch % Lines
agent/lib_php_amqplib.c 4.58% 208 Missing ⚠️
axiom/nr_span_event.c 56.25% 21 Missing ⚠️
axiom/nr_segment_traces.c 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1009      +/-   ##
==========================================
- Coverage   78.03%   77.40%   -0.64%     
==========================================
  Files         197      198       +1     
  Lines       27411    27715     +304     
==========================================
+ Hits        21391    21453      +62     
- Misses       6020     6262     +242     
Flag Coverage Δ
agent-for-php-7.2 77.53% <21.64%> (-0.62%) ⬇️
agent-for-php-7.3 77.55% <21.64%> (-0.62%) ⬇️
agent-for-php-7.4 77.26% <21.64%> (-0.62%) ⬇️
agent-for-php-8.0 76.65% <22.26%> (?)
agent-for-php-8.1 77.16% <22.26%> (-0.59%) ⬇️
agent-for-php-8.2 76.77% <22.26%> (-0.59%) ⬇️
agent-for-php-8.3 76.77% <22.26%> (-0.59%) ⬇️
agent-for-php-8.4 76.79% <22.26%> (-0.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@zsistla zsistla added this to the next-release milestone Jan 27, 2025
* Creates message segment on basic_publish call.
 * While the RabbitMQ tutorial for using with the dockerized RabbitMQ setup
 * correctly and loads the PhpAmqpLib\\Channel\\AMQPChannel class in time for
 * the agent to wrap the instrumented functions, there are AWS MQ_BROKER
 * specific but valid scenarios where the PhpAmqpLib\\Channel\\AMQPChannel class
 * file does not explicitly load or does not load in time, and the instrumented
 * functions are NEVER wrapped regardless of how many times they are called in
 * one txn.  Specifically, this centered around the very slight but impactful
 * differences when using the PhpAmqpLib\Connection\AMQPStreamConnection which
 * causes an explicit load of the AMQPChannel class/file and
 * PhpAmqpLib\Connection\AMQPSSLConnection which does NOT cause an explicit load
 * of the AMQPChannelclass/file. The following method is thus the only way to
 * ensure the class is loaded in time for the functions to be wrapped.
@zsistla zsistla force-pushed the feat/rabbitmq_instrumentation branch from 05422ea to ba45e6c Compare February 7, 2025 15:41
lavarou
lavarou previously approved these changes Feb 11, 2025
mfulb
mfulb previously approved these changes Feb 12, 2025
Co-authored-by: Michal Nowacki <[email protected]>
@zsistla zsistla dismissed stale reviews from mfulb and lavarou via 4461be7 February 12, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants