newrelic / newrelic-php-agent

The New Relic PHP Agent
https://opensource.newrelic.com/projects/newrelic/newrelic-php-agent
Apache License 2.0
120 stars 63 forks source link

feat(agent): improve package major version metric creation #965

Closed mfulb closed 1 month ago

mfulb commented 1 month ago

Change how the package major number metrics are created. This now occurs in R_SHUTDOWN. This allows the use of package versions from ALL sources including the Composer API. Whenever instrumentation for a package detects a package, it can create a package suggestion. Initially if a version is not known it is fine to use PHP_PACKAGE_VERSION_UNKNOWN. If later the instrumentation determines a version from a class constant, etc, then the suggestion can be updated with the version.

At the end of the transaction the suggestions are iterated over and the actual package data (which could include Composer API data) is referenced and a major number supportability metric is created with the best version available.

newrelic-php-agent-bot commented 1 month ago
Test Suite Status Result
Multiverse :white_check_mark: 7/7 passing
SOAK :white_check_mark: 56/56 passing
codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 77.41935% with 14 lines in your changes missing coverage. Please review.

Project coverage is 78.50%. Comparing base (51f6d43) to head (4c23cd6).

Files with missing lines Patch % Lines
agent/fw_wordpress.c 0.00% 3 Missing :warning:
agent/fw_slim.c 0.00% 2 Missing :warning:
agent/lib_phpunit.c 0.00% 2 Missing :warning:
axiom/nr_php_packages.c 75.00% 2 Missing :warning:
agent/fw_drupal8.c 50.00% 1 Missing :warning:
agent/fw_laminas3.c 0.00% 1 Missing :warning:
agent/fw_lumen.c 0.00% 1 Missing :warning:
agent/lib_doctrine2.c 0.00% 1 Missing :warning:
agent/lib_mongodb.c 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## feat/vm/user-composer-for-package-info #965 +/- ## ========================================================================== + Coverage 78.46% 78.50% +0.03% ========================================================================== Files 195 195 Lines 27036 27057 +21 ========================================================================== + Hits 21214 21241 +27 + Misses 5822 5816 -6 ``` | [Flag](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | Coverage Δ | | |---|---|---| | [agent-for-php-7.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.51% <77.41%> (+0.04%)` | :arrow_up: | | [agent-for-php-7.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.53% <77.41%> (+0.04%)` | :arrow_up: | | [agent-for-php-7.4](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.23% <75.80%> (+0.04%)` | :arrow_up: | | [agent-for-php-8.0](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.25% <75.80%> (+0.04%)` | :arrow_up: | | [agent-for-php-8.1](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `78.24% <75.80%> (+0.04%)` | :arrow_up: | | [agent-for-php-8.2](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.84% <75.80%> (+0.04%)` | :arrow_up: | | [agent-for-php-8.3](https://app.codecov.io/gh/newrelic/newrelic-php-agent/pull/965/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `77.84% <75.80%> (+0.04%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.