DataDog / dd-trace-php

Datadog PHP Clients
https://docs.datadoghq.com/tracing/setup/php
Other
487 stars 152 forks source link

fix: Handle OTel HTTP semantic conventions < 1.21.0 #2717

Closed PROFeNoM closed 3 months ago

PROFeNoM commented 3 months ago

Description

AIDM-162

The following system test was failing. This is because from OTel pov, doing setAttribute sets the status code in the metrics array.

This PR simply maps (and therefore overrides, if set) the deprecated http.status_code metric to the meta array.

This tag is set in Otel HTTP semantic versions inferior or equal than 1.21.0

Reviewer checklist

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.50%. Comparing base (5869a12) to head (eff1c80).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/graphs/tree.svg?width=650&height=150&src=pr&token=eXio8H7vwF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ```diff @@ Coverage Diff @@ ## master #2717 +/- ## ============================================= - Coverage 77.83% 67.50% -10.33% Complexity 2212 2212 ============================================= Files 227 227 Lines 26599 26604 +5 Branches 988 988 ============================================= - Hits 20703 17959 -2744 - Misses 5370 8119 +2749 Partials 526 526 ``` | [Flag](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [appsec-extension](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `69.13% <ø> (ø)` | | | [tracer-extension](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `78.60% <100.00%> (+<0.01%)` | :arrow_up: | | [tracer-php](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `50.62% <ø> (-29.91%)` | :arrow_down: | 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=DataDog#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [ext/serializer.c](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?src=pr&el=tree&filepath=ext%2Fserializer.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZXh0L3NlcmlhbGl6ZXIuYw==) | `81.48% <100.00%> (+0.08%)` | :arrow_up: | ... and [20 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Last update [5869a12...eff1c80](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2717?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog).
pr-commenter[bot] commented 3 months ago

Benchmarks

Benchmark execution time: 2024-06-17 13:19:21

Comparing candidate commit eff1c80a72d712fe14bf17e4a76b87cb06b3c1e1 in PR branch alex/aidm/162 with baseline commit 5869a12307680b55cc32077a5641c1bf4789df72 in branch master.

Found 4 performance improvements and 0 performance regressions! Performance is the same for 174 metrics, 0 unstable metrics.

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

scenario:PDOBench/benchPDOBaseline

scenario:PDOBench/benchPDOOverhead

scenario:PDOBench/benchPDOOverheadWithDBM