DataDog / dd-trace-php

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

fix: Add `ddsource` attribute to json-formatted logs #2727

Open PROFeNoM opened 3 months ago

PROFeNoM commented 3 months ago

Description

Problem: The PHP Log pipeline is not automatically used to process PHP logs ==> No Log Correlation by default, despite the trace identifiers being injected.

Two solutions:

  1. We inject the trace identifiers outside of context
  2. We use ddsource

Either way, it seems like we should have always been using ddsource + it is more elegant and is the actual way of doing it.

TBD - I gotta double test this on my sandbox. generating the artifact...

Reviewer checklist

pr-commenter[bot] commented 3 months ago

Benchmarks

Benchmark execution time: 2024-06-20 15:00:03

Comparing candidate commit e1b1f330a66021b428e9dae01599cef76ecec51c in PR branch alex/fix/ddsource with baseline commit 3648fb565a58e8a542c85ba360187a16448ceb24 in branch master.

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

scenario:PDOBench/benchPDOBaseline

scenario:PDOBench/benchPDOBaseline-opcache

scenario:PDOBench/benchPDOOverhead-opcache

scenario:PDOBench/benchPDOOverheadWithDBM

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 65.96%. Comparing base (3648fb5) to head (17bd3f3). Report is 8 commits behind head on master.

:exclamation: There is a different number of reports uploaded between BASE (3648fb5) and HEAD (17bd3f3). Click for more details.

HEAD has 3 uploads less than BASE | Flag | BASE (3648fb5) | HEAD (17bd3f3) | |------|------|------| |tracer-php|12|10| |appsec-extension|1|0|
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727/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/2727?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ```diff @@ Coverage Diff @@ ## master #2727 +/- ## ============================================= - Coverage 77.83% 65.96% -11.88% Complexity 2212 2212 ============================================= Files 227 201 -26 Lines 26604 22596 -4008 Branches 988 0 -988 ============================================= - Hits 20708 14906 -5802 - Misses 5370 7690 +2320 + Partials 526 0 -526 ``` | [Flag](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727/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/2727/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `?` | | | [tracer-extension](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `78.60% <ø> (+<0.01%)` | :arrow_up: | | [tracer-php](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `47.56% <0.00%> (-32.97%)` | :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/2727?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [src/DDTrace/Integrations/Logs/LogsIntegration.php](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727?src=pr&el=tree&filepath=src%2FDDTrace%2FIntegrations%2FLogs%2FLogsIntegration.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-c3JjL0REVHJhY2UvSW50ZWdyYXRpb25zL0xvZ3MvTG9nc0ludGVncmF0aW9uLnBocA==) | `0.00% <0.00%> (-93.29%)` | :arrow_down: | ... and [66 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727/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/2727?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/2727?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Last update [3648fb5...17bd3f3](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2727?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).