Skip to content

Commit

Permalink
[master] Check if tracing is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofvc committed Sep 14, 2022
1 parent 16590ba commit 0eeb0b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"ext-json" : "*",
"monolog/monolog": "^1 || ^2 || ^3",
"symfony/http-foundation": "^3 || ^4 || ^5 || ^6",
"datadog/dd-trace": "^0.79.0"
"datadog/dd-trace": "^0.79.0",
"symfony/event-dispatcher": "^4.4 || ^5.3"
},
"require-dev": {
"phpunit/phpunit": "^7.",
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/CommandProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class ConsoleProcessor implements EventSubscriberInterface
class CommandProcessor implements EventSubscriberInterface
{
protected $command;
protected $input;
Expand Down
6 changes: 5 additions & 1 deletion src/Processor/DatadogTracingProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ class DatadogTracingProcessor
{
public function processRecord(array $record)
{
if (!extension_loaded('ddtrace')) {
return $record;
}

$context = \DDTrace\current_context();
$record['dd'] .= [
$record['dd'] = [
'trace_id' => $context['trace_id'],
'span_id' => $context['span_id'],
];
Expand Down

0 comments on commit 0eeb0b3

Please sign in to comment.