Skip to content

Commit

Permalink
Refactor service mapping to a more general location
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM committed Dec 14, 2023
1 parent 810d6de commit eff88d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/Integrations/Integrations/DatabaseIntegrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ public static function propagateViaSqlComments($query, $databaseService, $mode =
$tags = [];

if ($databaseService != "") {
$mapping = dd_trace_env_config('DD_SERVICE_MAPPING');
if (isset($mapping[$databaseService])) {
$databaseService = $mapping[$databaseService];
}
$tags["dddbs"] = $databaseService;
}

Expand Down
12 changes: 9 additions & 3 deletions src/Integrations/Integrations/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,19 @@ public static function handleInternalSpanServiceName(SpanData $span, $fallbackNa
if ($flatServiceNames) {
$rootSpan = \DDTrace\root_span();
if ($rootSpan) {
$span->service = $rootSpan->service;
$service = $rootSpan->service;
} else {
$span->service = \ddtrace_config_app_name($fallbackName);
$service = \ddtrace_config_app_name($fallbackName);
}
} else {
$span->service = $fallbackName;
$service = $fallbackName;
}

$mapping = \dd_trace_env_config('DD_SERVICE_MAPPING');
if (isset($mapping[$service])) {
$service = $mapping[$service];
}
$span->service = $service;
}
}

Expand Down

0 comments on commit eff88d7

Please sign in to comment.