diff --git a/src/DDTrace/Integrations/AMQP/AMQPIntegration.php b/src/DDTrace/Integrations/AMQP/AMQPIntegration.php index 6903d3d0db0..4a6c8a95616 100644 --- a/src/DDTrace/Integrations/AMQP/AMQPIntegration.php +++ b/src/DDTrace/Integrations/AMQP/AMQPIntegration.php @@ -491,6 +491,7 @@ public static function setGenericTags( $span->meta[Tag::SPAN_KIND] = $spanKind; $span->type = 'queue'; $span->service = 'amqp'; + $span->meta['_dd.svc_src'] = AMQPIntegration::NAME; $span->meta[Tag::COMPONENT] = self::NAME; $span->meta[Tag::MQ_SYSTEM] = self::SYSTEM; diff --git a/src/DDTrace/Integrations/CakePHP/CakePHPIntegration.php b/src/DDTrace/Integrations/CakePHP/CakePHPIntegration.php index 51133bbc53e..9adf7691128 100644 --- a/src/DDTrace/Integrations/CakePHP/CakePHPIntegration.php +++ b/src/DDTrace/Integrations/CakePHP/CakePHPIntegration.php @@ -37,6 +37,7 @@ public static function init(): int self::$appName = \ddtrace_config_app_name(CakePHPIntegration::NAME); self::addTraceAnalyticsIfEnabled($rootSpan); $rootSpan->service = self::$appName; + Integration::tagFrameworkServiceSource($rootSpan, CakePHPIntegration::NAME); if ('cli' === PHP_SAPI) { $rootSpan->name = 'cakephp.console'; $rootSpan->resource = !empty($_SERVER['argv'][1]) diff --git a/src/DDTrace/Integrations/CakePHP/V2/CakePHPIntegrationLoader.php b/src/DDTrace/Integrations/CakePHP/V2/CakePHPIntegrationLoader.php index 779fd61df1d..0d6b6744aea 100644 --- a/src/DDTrace/Integrations/CakePHP/V2/CakePHPIntegrationLoader.php +++ b/src/DDTrace/Integrations/CakePHP/V2/CakePHPIntegrationLoader.php @@ -29,8 +29,7 @@ public static function load() function (SpanData $span, array $args) { $span->name = $span->resource = 'Controller.invokeAction'; $span->type = Type::WEB_SERVLET; - $span->service = CakePHPIntegration::$appName; - $span->meta[Tag::COMPONENT] = CakePHPIntegration::NAME; + Integration::setComponentMetadata($span, CakePHPIntegration::NAME, CakePHPIntegration::$appName); $request = $args[0]; if (!$request instanceof CakeRequest) { @@ -83,8 +82,7 @@ function (SpanData $span, array $args) { $file = $this->viewPath . '/' . $this->view . $this->ext; $span->resource = $file; $span->meta = ['cakephp.view' => $file]; - $span->service = CakePHPIntegration::$appName; - $span->meta[Tag::COMPONENT] = CakePHPIntegration::NAME; + Integration::setComponentMetadata($span, CakePHPIntegration::NAME, CakePHPIntegration::$appName); }); \DDTrace\hook_method( diff --git a/src/DDTrace/Integrations/CakePHP/V3/CakePHPIntegrationLoader.php b/src/DDTrace/Integrations/CakePHP/V3/CakePHPIntegrationLoader.php index 79aa46e38d3..77a681baf4f 100644 --- a/src/DDTrace/Integrations/CakePHP/V3/CakePHPIntegrationLoader.php +++ b/src/DDTrace/Integrations/CakePHP/V3/CakePHPIntegrationLoader.php @@ -25,8 +25,7 @@ public static function load() function (SpanData $span) { $span->name = $span->resource = 'Controller.invokeAction'; $span->type = Type::WEB_SERVLET; - $span->service = CakePHPIntegration::$appName; - $span->meta[Tag::COMPONENT] = CakePHPIntegration::NAME; + Integration::setComponentMetadata($span, CakePHPIntegration::NAME, CakePHPIntegration::$appName); /** @var \Cake\Controller\Controller $this */ $request = $this->request; @@ -90,8 +89,7 @@ static function (HookData $hook) use ($renderHook) { $span = $renderHook->span(); $span->name = 'cakephp.view'; $span->type = Type::WEB_SERVLET; - $span->service = CakePHPIntegration::$appName; - $span->meta[Tag::COMPONENT] = CakePHPIntegration::NAME; + Integration::setComponentMetadata($span, CakePHPIntegration::NAME, CakePHPIntegration::$appName); $absoluteFilePath = $renderHook->data['viewFileName'] ?? ''; $fileExtension = pathinfo($absoluteFilePath, PATHINFO_EXTENSION); diff --git a/src/DDTrace/Integrations/Curl/CurlIntegration.php b/src/DDTrace/Integrations/Curl/CurlIntegration.php index 71a0f49569b..66047e63b90 100644 --- a/src/DDTrace/Integrations/Curl/CurlIntegration.php +++ b/src/DDTrace/Integrations/Curl/CurlIntegration.php @@ -308,6 +308,7 @@ public static function set_curl_attributes($span, $info) { if (\dd_trace_env_config("DD_TRACE_HTTP_CLIENT_SPLIT_BY_DOMAIN")) { $span->service = Urls::hostnameForTag($sanitizedUrl); + $span->meta['_dd.svc_src'] = 'opt.http_client_split_by_domain'; } $span->resource = $normalizedPath; diff --git a/src/DDTrace/Integrations/Drupal/DrupalIntegration.php b/src/DDTrace/Integrations/Drupal/DrupalIntegration.php index 7180369414c..27cd7cffb05 100644 --- a/src/DDTrace/Integrations/Drupal/DrupalIntegration.php +++ b/src/DDTrace/Integrations/Drupal/DrupalIntegration.php @@ -44,12 +44,14 @@ public static function init(): int $rootSpan = \DDTrace\root_span(); $rootSpan->name = 'drupal.request'; $rootSpan->service = $service; + Integration::tagFrameworkServiceSource($rootSpan, 'drupal'); $rootSpan->meta[Tag::SPAN_KIND] = 'server'; $rootSpan->meta[Tag::COMPONENT] = self::NAME; $span->name = 'drupal.kernel.handle'; $span->type = Type::WEB_SERVLET; $span->service = $service; + Integration::tagFrameworkServiceSource($span, 'drupal'); $span->meta[Tag::SPAN_KIND] = 'server'; $span->meta[Tag::COMPONENT] = self::NAME; } @@ -59,8 +61,7 @@ public static function init(): int $stackedHttpKernelTracer = static function (SpanData $span) { $span->name = 'drupal.httpkernel.handle'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('drupal'); - $span->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($span, 'drupal'); }; // See Drupal\Core\DependencyInjection\Compiler\StackedKernelPass // If a middleware is tagged with 'responder' => true, then the underlying middleware and the HTTP kernel @@ -77,8 +78,7 @@ public static function init(): int 'prehook' => static function (SpanData $span) { $span->name = 'drupal.kernel.boot'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('drupal'); - $span->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($span, 'drupal'); } ] ); @@ -123,8 +123,7 @@ static function (HookData $fnHookData) use ($hook, $module, $functionName) { $span = $fnHookData->span(); $span->name = 'drupal.hook.' . $hook; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('drupal'); - $span->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($span, 'drupal'); $span->meta['drupal.hook'] = $hook; $span->meta['drupal.module'] = $module; @@ -164,8 +163,7 @@ static function (HookData $fnHookData) use ($hook, $module, $functionName) { $span = $fnHookData->span(); $span->name = 'drupal.hook.' . $hook; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('drupal'); - $span->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($span, 'drupal'); $span->resource = $functionName; $span->meta['drupal.hook'] = $hook; @@ -196,8 +194,7 @@ function (HookData $hook) { $span = $hook->span(); $span->name = 'drupal.view.execute'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('drupal'); - $span->meta[Tag::COMPONENT] = DrupalIntegration::NAME; + Integration::setComponentMetadata($span, 'drupal'); // @var \Drupal\views\Entity\View $storage $storage = $this->storage; @@ -239,6 +236,7 @@ static function ($registry, $scope, $args) { 'prehook' => function (SpanData $span, $args) { $span->name = 'drupal.theme.render'; $span->service = \ddtrace_config_app_name('drupal'); + Integration::tagFrameworkServiceSource($span, 'drupal'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = DrupalIntegration::NAME; @@ -396,6 +394,7 @@ static function ($mainContViewSubscriber, $scope, $args) { static function (SpanData $span) { $span->name = 'symfony.response.send'; $span->service = \ddtrace_config_app_name('drupal'); + Integration::tagFrameworkServiceSource($span, 'drupal'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = self::NAME; } diff --git a/src/DDTrace/Integrations/Guzzle/GuzzleIntegration.php b/src/DDTrace/Integrations/Guzzle/GuzzleIntegration.php index 410fb427315..5dbfcbf2e82 100644 --- a/src/DDTrace/Integrations/Guzzle/GuzzleIntegration.php +++ b/src/DDTrace/Integrations/Guzzle/GuzzleIntegration.php @@ -144,6 +144,7 @@ public static function addRequestInfo(SpanData $span, $request) if (\dd_trace_env_config("DD_TRACE_HTTP_CLIENT_SPLIT_BY_DOMAIN")) { $span->service = Urls::hostnameForTag($url); + $span->meta['_dd.svc_src'] = 'opt.http_client_split_by_domain'; } $span->meta[Tag::HTTP_METHOD] = $request->getMethod(); @@ -158,6 +159,7 @@ public static function addRequestInfo(SpanData $span, $request) } if (\dd_trace_env_config("DD_TRACE_HTTP_CLIENT_SPLIT_BY_DOMAIN")) { $span->service = Urls::hostnameForTag($url); + $span->meta['_dd.svc_src'] = 'opt.http_client_split_by_domain'; } $span->meta[Tag::HTTP_METHOD] = $request->getMethod(); diff --git a/src/DDTrace/Integrations/Integration.php b/src/DDTrace/Integrations/Integration.php index 6bc50d31aa4..2fe53f82c21 100644 --- a/src/DDTrace/Integrations/Integration.php +++ b/src/DDTrace/Integrations/Integration.php @@ -81,13 +81,10 @@ public static function handleInternalSpanServiceName(SpanData $span, string $fal $flatServiceNames = !$skipFlattening && \dd_trace_env_config('DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED'); + $rootSpan = null; if ($flatServiceNames) { $rootSpan = \DDTrace\root_span(); - if ($rootSpan) { - $service = $rootSpan->service; - } else { - $service = \ddtrace_config_app_name($fallbackName); - } + $service = $rootSpan ? $rootSpan->service : \ddtrace_config_app_name($fallbackName); } else { $service = $fallbackName; } @@ -97,6 +94,36 @@ public static function handleInternalSpanServiceName(SpanData $span, string $fal $service = $mapping[$service]; } $span->service = $service; + unset($span->meta['_dd.svc_src']); + if ($flatServiceNames) { + if ($rootSpan && isset($rootSpan->meta['_dd.svc_src'])) { + $span->meta['_dd.svc_src'] = $rootSpan->meta['_dd.svc_src']; + } + } else { + $span->meta['_dd.svc_src'] = $fallbackName; + } + } + + public static function tagFrameworkServiceSource(SpanData $span, $integrationName) + { + if (\dd_trace_env_config('DD_SERVICE')) { + unset($span->meta['_dd.svc_src']); + } else { + $span->meta['_dd.svc_src'] = $integrationName; + } + } + + /** + * Set the standard framework-integration metadata on a span. + * When DD_SERVICE is configured the user's value is left untouched. + */ + public static function setComponentMetadata(SpanData $span, $component, $service = null) + { + if (!\dd_trace_env_config('DD_SERVICE')) { + $span->service = $service ?? $component; + $span->meta['_dd.svc_src'] = $component; + } + $span->meta[Tag::COMPONENT] = $component; } public static function handleOrphan(SpanData $span) diff --git a/src/DDTrace/Integrations/Laminas/LaminasIntegration.php b/src/DDTrace/Integrations/Laminas/LaminasIntegration.php index 0ba637cc4e9..0d55f3d22a9 100644 --- a/src/DDTrace/Integrations/Laminas/LaminasIntegration.php +++ b/src/DDTrace/Integrations/Laminas/LaminasIntegration.php @@ -157,8 +157,7 @@ static function (SpanData $span) use ($className, $methodName) { $span->name = 'laminas.mvcEventListener'; $span->resource = $className . '@' . $methodName; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('laminas'); - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas'); } ); } @@ -174,12 +173,12 @@ static function (SpanData $span) { $span->name = 'laminas.application.init'; $span->resource = 'laminas.application.init'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('laminas'); - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas'); $rootSpan = root_span(); $rootSpan->name = 'laminas.request'; $rootSpan->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($rootSpan, 'laminas'); $rootSpan->meta[Tag::SPAN_KIND] = 'server'; $rootSpan->meta[Tag::COMPONENT] = self::NAME; } @@ -192,8 +191,7 @@ static function (SpanData $span) { $span->name = 'laminas.application.bootstrap'; $span->resource = 'laminas.application.bootstrap'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name('laminas'); - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas'); } ); @@ -211,8 +209,7 @@ static function (SpanData $span) { } $span->name = "laminas.event.$eventName"; - $span->service = \ddtrace_config_app_name('laminas'); - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas'); } ] ); @@ -225,8 +222,7 @@ static function (SpanData $span) { $service = \ddtrace_config_app_name('laminas'); $span->name = 'laminas.application.run'; $span->type = Type::WEB_SERVLET; - $span->service = $service; - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas', $service); } ] ); @@ -391,6 +387,7 @@ static function ($This, $score, $args) { static function (SpanData $span, $args) { $span->name = 'laminas.application.completeRequest'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = 'laminas'; @@ -413,6 +410,7 @@ static function (SpanData $span, $args) { 'prehook' => static function (SpanData $span, $args) { $span->name = 'laminas.templating.render'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = 'laminas'; @@ -433,6 +431,7 @@ static function (SpanData $span, $args) { static function (SpanData $span) { $span->name = 'laminas.view.render'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = 'laminas'; } @@ -444,6 +443,7 @@ static function (SpanData $span) { function (SpanData $span) { $span->name = 'laminas.view.model.serialize'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->resource = \get_class($this); $span->meta[Tag::COMPONENT] = 'laminas'; } @@ -455,6 +455,7 @@ function (SpanData $span) { function (SpanData $span, $args) { $span->name = 'laminas.view.http.renderer'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->resource = \get_class($this) . '@render'; $span->meta[Tag::COMPONENT] = 'laminas'; @@ -475,6 +476,7 @@ function (SpanData $span, $args) { function (SpanData $span, $args) { $span->name = 'laminas.view.console.renderer'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->resource = \get_class($this) . '@render'; $span->meta[Tag::COMPONENT] = 'laminas'; @@ -496,6 +498,7 @@ function (SpanData $span, $args) { static function (SpanData $span, $args, $retval) { $span->name = 'laminas.mvcEvent.setError'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = 'laminas'; @@ -522,6 +525,7 @@ static function (SpanData $span, $args, $retval) { static function (SpanData $span, $args) { $span->name = 'laminas.controller.pluginManager.get'; $span->service = \ddtrace_config_app_name('laminas'); + Integration::tagFrameworkServiceSource($span, 'laminas'); $span->resource = $args[0]; $span->meta[Tag::COMPONENT] = 'laminas'; } @@ -532,8 +536,7 @@ static function (SpanData $span, $args) { 'forward', static function (SpanData $span, $args) { $span->name = 'laminas.controller.forward'; - $span->service = \ddtrace_config_app_name('laminas'); - $span->meta[Tag::COMPONENT] = 'laminas'; + Integration::setComponentMetadata($span, 'laminas'); $controllerName = $args[0]; if (isset($args[1]) && isset($args[1]['action'])) { diff --git a/src/DDTrace/Integrations/Laravel/LaravelIntegration.php b/src/DDTrace/Integrations/Laravel/LaravelIntegration.php index 726c4ed117c..0f00a02b825 100644 --- a/src/DDTrace/Integrations/Laravel/LaravelIntegration.php +++ b/src/DDTrace/Integrations/Laravel/LaravelIntegration.php @@ -62,6 +62,7 @@ static function (SpanData $span, $args, $response) { $span->name = 'laravel.application.handle'; $span->type = Type::WEB_SERVLET; $span->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = 'Illuminate\Foundation\Application@handle'; $span->meta[Tag::COMPONENT] = self::NAME; @@ -74,6 +75,7 @@ static function (SpanData $span, $args, $response) { $rootSpan->meta[Tag::HTTP_STATUS_CODE] = $response->getStatusCode(); } $rootSpan->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($rootSpan, LaravelIntegration::NAME); $rootSpan->meta[Tag::SPAN_KIND] = 'server'; $rootSpan->meta[Tag::COMPONENT] = self::NAME; } @@ -170,6 +172,7 @@ function (SpanData $span) { $span->name = 'laravel.action'; $span->type = Type::WEB_SERVLET; $span->service = LaravelIntegration::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = $this->uri; $span->meta[Tag::COMPONENT] = LaravelIntegration::NAME; } @@ -202,6 +205,7 @@ function ($This, $scope, $args) { $span->name = 'laravel.event.handle'; $span->type = Type::WEB_SERVLET; $span->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = $args[0]; $span->meta[Tag::COMPONENT] = self::NAME; @@ -241,6 +245,7 @@ function ($This, $scope, $args) { $span->name = 'laravel.event.handle'; $span->type = Type::WEB_SERVLET; $span->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = is_object($args[0]) ? get_class($args[0]) : $args[0]; $span->meta[Tag::COMPONENT] = self::NAME; }, @@ -252,6 +257,7 @@ function ($This, $scope, $args) { $span->name = 'laravel.view.render'; $span->type = Type::WEB_SERVLET; $span->service = LaravelIntegration::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = $this->view; $span->meta[Tag::COMPONENT] = LaravelIntegration::NAME; }); @@ -270,6 +276,7 @@ static function (SpanData $span, $args) { : LumenIntegration::NAME; $span->type = Type::WEB_SERVLET; $span->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); if (isset($args[0]) && \is_string($args[0])) { $span->resource = $args[0]; } @@ -285,6 +292,7 @@ static function (SpanData $span) { $span->name = 'laravel.provider.load'; $span->type = Type::WEB_SERVLET; $span->service = $serviceName; + Integration::tagFrameworkServiceSource($span, LaravelIntegration::NAME); $span->resource = 'Illuminate\Foundation\ProviderRepository::load'; $span->meta[Tag::COMPONENT] = self::NAME; @@ -292,8 +300,7 @@ static function (SpanData $span) { $rootSpan = \DDTrace\root_span(); $rootSpan->name = 'laravel.request'; - $rootSpan->service = $serviceName; - $rootSpan->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($rootSpan, LaravelIntegration::NAME, $serviceName); } ); @@ -599,8 +606,7 @@ static function () { } $rootSpan->name = 'laravel.request'; - $rootSpan->service = self::getServiceName(); - $rootSpan->meta[Tag::COMPONENT] = self::NAME; + Integration::setComponentMetadata($rootSpan, LaravelIntegration::NAME, self::getServiceName()); } ); diff --git a/src/DDTrace/Integrations/LaravelQueue/LaravelQueueIntegration.php b/src/DDTrace/Integrations/LaravelQueue/LaravelQueueIntegration.php index aa61a1e1215..b3e6f624795 100644 --- a/src/DDTrace/Integrations/LaravelQueue/LaravelQueueIntegration.php +++ b/src/DDTrace/Integrations/LaravelQueue/LaravelQueueIntegration.php @@ -166,6 +166,7 @@ function (HookData $hook) use ($class, $method, $fireHook) { $span->name = 'laravel.queue.action'; $span->type = 'queue'; $span->service = LaravelQueueIntegration::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelQueueIntegration::NAME); $span->resource = $class . '@' . $method; $span->meta[Tag::COMPONENT] = LaravelQueueIntegration::NAME; @@ -295,6 +296,7 @@ public static function setSpanAttributes( ) { $span->name = $name; $span->service = self::getServiceName(); + Integration::tagFrameworkServiceSource($span, LaravelQueueIntegration::NAME); $span->type = 'queue'; $span->meta[Tag::SPAN_KIND] = 'client'; $span->meta[Tag::COMPONENT] = self::NAME; diff --git a/src/DDTrace/Integrations/Lumen/LumenIntegration.php b/src/DDTrace/Integrations/Lumen/LumenIntegration.php index c2938ccf0f5..aff0751cb2a 100644 --- a/src/DDTrace/Integrations/Lumen/LumenIntegration.php +++ b/src/DDTrace/Integrations/Lumen/LumenIntegration.php @@ -48,6 +48,7 @@ static function (SpanData $span, $args) { $request = $args[0]; $rootSpan->name = 'lumen.request'; $rootSpan->service = \ddtrace_config_app_name(self::NAME); + Integration::tagFrameworkServiceSource($rootSpan, LumenIntegration::NAME); self::addTraceAnalyticsIfEnabled($rootSpan); if (!array_key_exists(Tag::HTTP_URL, $rootSpan->meta)) { $rootSpan->meta[Tag::HTTP_URL] = \DDTrace\Util\Normalizer::urlSanitize($request->getUri()); @@ -69,6 +70,8 @@ static function (SpanData $span, $args) { $rootSpan = \DDTrace\root_span(); $span->service = \ddtrace_config_app_name(self::NAME); + + Integration::tagFrameworkServiceSource($span, LumenIntegration::NAME); $span->type = 'web'; if (count($args) < 1 || !\is_array($args[0])) { return; @@ -100,6 +103,7 @@ static function (SpanData $span, $args) { $exceptionRender = static function (SpanData $span, $args) { $span->service = \ddtrace_config_app_name(self::NAME); + Integration::tagFrameworkServiceSource($span, LumenIntegration::NAME); $span->type = 'web'; if (count($args) < 1 || !\is_a($args[0], 'Throwable')) { return; diff --git a/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php b/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php index 067e71cba29..bc5db373c90 100644 --- a/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php +++ b/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php @@ -425,6 +425,7 @@ public static function setConnectionInfo(SpanData $span, $mysqli) if (isset($hostInfo[Tag::TARGET_HOST])) { $span->service .= '-' . \DDTrace\Util\Normalizer::normalizeHostUdsAsService($hostInfo[Tag::TARGET_HOST]); + $span->meta['_dd.svc_src'] = 'opt.db_client_split_by_instance'; } } $dbName = ObjectKVStore::get($mysqli, self::KEY_DATABASE_NAME); diff --git a/src/DDTrace/Integrations/PDO/PDOIntegration.php b/src/DDTrace/Integrations/PDO/PDOIntegration.php index 73e646c8f98..1c52378cf88 100644 --- a/src/DDTrace/Integrations/PDO/PDOIntegration.php +++ b/src/DDTrace/Integrations/PDO/PDOIntegration.php @@ -324,6 +324,7 @@ public static function setCommonSpanInfo($source, SpanData $span) Integration::handleInternalSpanServiceName($span, self::NAME, true); $span->service = $span->service . '-' . \DDTrace\Util\Normalizer::normalizeHostUdsAsService($storedConnectionInfo[Tag::TARGET_HOST]); + $span->meta['_dd.svc_src'] = 'opt.db_client_split_by_instance'; } else { Integration::handleInternalSpanServiceName($span, self::NAME); } diff --git a/src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php b/src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php index e993c3078ed..f7c3e358b5f 100644 --- a/src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php +++ b/src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php @@ -329,12 +329,15 @@ public static function enrichSpan(SpanData $span, $instance, $class, $method = n if (!empty($clusterName)) { $normalizedClusterName = \DDTrace\Util\Normalizer::normalizeHostUdsAsService($clusterName); $span->service = $serviceNamePrefix . $normalizedClusterName; + $span->meta['_dd.svc_src'] = 'opt.redis_client_split_by_host'; } elseif (!empty($firstHostOrUDS)) { $normalizedHost = \DDTrace\Util\Normalizer::normalizeHostUdsAsService($firstHostOrUDS); $span->service = $serviceNamePrefix . $normalizedHost; + $span->meta['_dd.svc_src'] = 'opt.redis_client_split_by_host'; } elseif (!empty($host)) { $normalizedHost = \DDTrace\Util\Normalizer::normalizeHostUdsAsService($host); $span->service = $serviceNamePrefix . $normalizedHost; + $span->meta['_dd.svc_src'] = 'opt.redis_client_split_by_host'; } else { Integration::handleInternalSpanServiceName($span, self::NAME); } diff --git a/src/DDTrace/Integrations/Psr18/Psr18Integration.php b/src/DDTrace/Integrations/Psr18/Psr18Integration.php index df481ceba52..727d6e0fa1f 100644 --- a/src/DDTrace/Integrations/Psr18/Psr18Integration.php +++ b/src/DDTrace/Integrations/Psr18/Psr18Integration.php @@ -57,6 +57,7 @@ public static function addRequestInfo(SpanData $span, $request) if (\dd_trace_env_config("DD_TRACE_HTTP_CLIENT_SPLIT_BY_DOMAIN")) { $span->service = Urls::hostnameForTag($url); + $span->meta['_dd.svc_src'] = 'opt.http_client_split_by_domain'; } $span->meta[Tag::HTTP_METHOD] = $request->getMethod(); diff --git a/src/DDTrace/Integrations/Ratchet/RatchetIntegration.php b/src/DDTrace/Integrations/Ratchet/RatchetIntegration.php index c1e87c4a269..2b1fcc30e68 100644 --- a/src/DDTrace/Integrations/Ratchet/RatchetIntegration.php +++ b/src/DDTrace/Integrations/Ratchet/RatchetIntegration.php @@ -78,6 +78,7 @@ public static function init(): int \DDTrace\collect_code_origins(1); if (\dd_trace_env_config("DD_TRACE_HTTP_CLIENT_SPLIT_BY_DOMAIN")) { $span->service = Urls::hostnameForTag($url); + $span->meta['_dd.svc_src'] = 'opt.http_client_split_by_domain'; } }, static function (HookData $hook) { $span = $hook->data; @@ -177,6 +178,7 @@ public static function init(): int $activeSpan = $hook->span(new SpanStack); $activeSpan->service = \ddtrace_config_app_name('ratchet'); + Integration::tagFrameworkServiceSource($activeSpan, 'ratchet'); $activeSpan->name = "web.request"; $activeSpan->type = Type::WEB_SERVLET; $activeSpan->meta[Tag::COMPONENT] = self::NAME; @@ -260,6 +262,9 @@ public static function init(): int $span = $hook->span($rootTrace ? new SpanStack : null); $span->type = Type::WEBSOCKET; $span->service = $handshake->service; + if (isset($handshake->meta['_dd.svc_src'])) { + $span->meta['_dd.svc_src'] = $handshake->meta['_dd.svc_src']; + } $resourceParts = explode(" ", $handshake->resource, 2); $span->resource = "websocket " . end($resourceParts); $span->meta[Tag::SPAN_KIND] = Tag::SPAN_KIND_VALUE_CONSUMER; diff --git a/src/DDTrace/Integrations/Roadrunner/RoadrunnerIntegration.php b/src/DDTrace/Integrations/Roadrunner/RoadrunnerIntegration.php index 1b0a185b077..314d17f9db1 100644 --- a/src/DDTrace/Integrations/Roadrunner/RoadrunnerIntegration.php +++ b/src/DDTrace/Integrations/Roadrunner/RoadrunnerIntegration.php @@ -155,6 +155,7 @@ function (HookData $hook) use (&$activeSpan, &$suppressResponse, $service, &$rec $activeSpan = \DDTrace\start_trace_span(); $activeSpan->service = $service; + Integration::tagFrameworkServiceSource($activeSpan, 'roadrunner'); $activeSpan->name = "web.request"; $activeSpan->type = Type::WEB_SERVLET; $activeSpan->meta[Tag::COMPONENT] = RoadrunnerIntegration::NAME; diff --git a/src/DDTrace/Integrations/SQLSRV/SQLSRVIntegration.php b/src/DDTrace/Integrations/SQLSRV/SQLSRVIntegration.php index 07dcb7179b0..929a860c005 100644 --- a/src/DDTrace/Integrations/SQLSRV/SQLSRVIntegration.php +++ b/src/DDTrace/Integrations/SQLSRV/SQLSRVIntegration.php @@ -182,6 +182,7 @@ public static function setDefaultAttributes($source, SpanData $span, $name, $que if (\dd_trace_env_config("DD_TRACE_DB_CLIENT_SPLIT_BY_INSTANCE")) { if ($targetName !== "") { $span->service .= '-' . \DDTrace\Util\Normalizer::normalizeHostUdsAsService($targetName); + $span->meta['_dd.svc_src'] = 'opt.db_client_split_by_instance'; } } } diff --git a/src/DDTrace/Integrations/Slim/SlimIntegration.php b/src/DDTrace/Integrations/Slim/SlimIntegration.php index ad6265bbe9e..d135e66d810 100644 --- a/src/DDTrace/Integrations/Slim/SlimIntegration.php +++ b/src/DDTrace/Integrations/Slim/SlimIntegration.php @@ -33,6 +33,7 @@ function ($app) { SlimIntegration::addTraceAnalyticsIfEnabled($rootSpan); $rootSpan->name = 'slim.request'; $rootSpan->service = \ddtrace_config_app_name(SlimIntegration::NAME); + Integration::tagFrameworkServiceSource($rootSpan, SlimIntegration::NAME); $rootSpan->meta[Tag::SPAN_KIND] = 'server'; $rootSpan->meta[Tag::COMPONENT] = SlimIntegration::NAME; @@ -44,8 +45,7 @@ function ($app) { $span->name = 'slim.middleware'; $span->resource = \get_class($this); $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name(SlimIntegration::NAME); - $span->meta[Tag::COMPONENT] = SlimIntegration::NAME; + Integration::setComponentMetadata($span, SlimIntegration::NAME); }; \DDTrace\trace_method($name, 'process', $closure); } @@ -110,8 +110,7 @@ static function ($router, $scope, $args, $return) use ($rootSpan) { $span->resource = $callableName ?: 'controller'; $span->type = Type::WEB_SERVLET; - $span->service = \ddtrace_config_app_name(SlimIntegration::NAME); - $span->meta[Tag::COMPONENT] = SlimIntegration::NAME; + Integration::setComponentMetadata($span, SlimIntegration::NAME); /** @var ServerRequestInterface $request */ $request = $args[1]; @@ -152,6 +151,7 @@ static function ($router, $scope, $args, $return) use ($rootSpan) { \DDTrace\trace_method('Slim\Views\Twig', 'render', static function (SpanData $span, $args) { $span->name = 'slim.view'; $span->service = \ddtrace_config_app_name(SlimIntegration::NAME); + Integration::tagFrameworkServiceSource($span, SlimIntegration::NAME); $span->type = Type::WEB_SERVLET; $template = $args[1]; $span->resource = $template; diff --git a/src/DDTrace/Integrations/Symfony/SymfonyIntegration.php b/src/DDTrace/Integrations/Symfony/SymfonyIntegration.php index 4f210d4cfac..d0540860fa5 100644 --- a/src/DDTrace/Integrations/Symfony/SymfonyIntegration.php +++ b/src/DDTrace/Integrations/Symfony/SymfonyIntegration.php @@ -50,6 +50,7 @@ public static function init(): int $service = \ddtrace_config_app_name('symfony'); $rootSpan->name = 'symfony.request'; $rootSpan->service = $service; + Integration::tagFrameworkServiceSource($rootSpan, SymfonyIntegration::NAME); $rootSpan->meta[Tag::SPAN_KIND] = 'server'; $rootSpan->meta[Tag::COMPONENT] = SymfonyIntegration::NAME; SymfonyIntegration::addTraceAnalyticsIfEnabled($rootSpan); @@ -58,6 +59,7 @@ public static function init(): int $span->resource = \get_class($this); $span->type = Type::WEB_SERVLET; $span->service = $service; + Integration::tagFrameworkServiceSource($span, SymfonyIntegration::NAME); $span->meta[Tag::SPAN_KIND] = 'server'; $span->meta[Tag::COMPONENT] = SymfonyIntegration::NAME; }, @@ -77,6 +79,7 @@ public static function init(): int $span->resource = \get_class($this); $span->type = Type::WEB_SERVLET; $span->service = \ddtrace_config_app_name('symfony'); + Integration::tagFrameworkServiceSource($span, SymfonyIntegration::NAME); $span->meta[Tag::COMPONENT] = SymfonyIntegration::NAME; }, ] @@ -326,6 +329,7 @@ static function($This, $scope, $args, $result) { $span->name = 'symfony.console.command.run'; $span->resource = $commandName ?: $span->name; $span->service = \ddtrace_config_app_name(SymfonyIntegration::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, SymfonyIntegration::$frameworkPrefix); $span->type = Type::CLI; $span->meta['symfony.console.command.class'] = \get_class($this); $span->meta[Tag::COMPONENT] = SymfonyIntegration::NAME; @@ -467,6 +471,7 @@ static function(SpanData $span, $args, $response) use ($handle_http_route) { $span->name = 'symfony.kernel.handle'; $span->service = \ddtrace_config_app_name(self::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, self::$frameworkPrefix); $span->type = Type::WEB_SERVLET; $span->meta[Tag::COMPONENT] = self::NAME; @@ -547,6 +552,7 @@ static function(HookData $hook) use ($controllerName) { $span->resource = $controllerName; $span->type = Type::WEB_SERVLET; $span->service = \ddtrace_config_app_name(self::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, self::$frameworkPrefix); $span->meta[Tag::COMPONENT] = self::NAME; \DDTrace\remove_hook($hook->id); @@ -562,6 +568,7 @@ static function(HookData $hook) use ($controllerName) { $span->resource = $controllerName; $span->type = Type::WEB_SERVLET; $span->service = \ddtrace_config_app_name(self::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, self::$frameworkPrefix); $span->meta[Tag::COMPONENT] = self::NAME; \DDTrace\remove_hook($hook->id); @@ -574,6 +581,7 @@ static function(HookData $hook) use ($controllerName) { $span->name = $span->resource = 'symfony.' . $eventName; $span->service = \ddtrace_config_app_name(self::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, self::$frameworkPrefix); $span->meta[Tag::COMPONENT] = self::NAME; if ($event === null) { return; @@ -619,6 +627,7 @@ static function(HookData $hook) use ($controllerName) { $exceptionHandlingTracer = static function(SpanData $span, $args, $retval) { $span->name = $span->resource = 'symfony.kernel.handleException'; $span->service = \ddtrace_config_app_name(self::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, self::$frameworkPrefix); $span->meta[Tag::COMPONENT] = self::NAME; \DDTrace\root_span()->exception = $args[0]; @@ -638,6 +647,7 @@ static function(HookData $hook) use ($controllerName) { $traceRender = function(SpanData $span, $args) { $span->name = 'symfony.templating.render'; $span->service = \ddtrace_config_app_name(SymfonyIntegration::$frameworkPrefix); + Integration::tagFrameworkServiceSource($span, SymfonyIntegration::$frameworkPrefix); $span->type = Type::WEB_SERVLET; $resourceName = count($args) > 0 ? get_class($this) . ' ' . $args[0] : get_class($this); diff --git a/src/DDTrace/Integrations/SymfonyMessenger/SymfonyMessengerIntegration.php b/src/DDTrace/Integrations/SymfonyMessenger/SymfonyMessengerIntegration.php index c444ff3b51f..e72cf290341 100644 --- a/src/DDTrace/Integrations/SymfonyMessenger/SymfonyMessengerIntegration.php +++ b/src/DDTrace/Integrations/SymfonyMessenger/SymfonyMessengerIntegration.php @@ -229,6 +229,7 @@ public static function setSpanAttributes( $span->name = $name; $span->service = \ddtrace_config_app_name('symfony'); + Integration::tagFrameworkServiceSource($span, 'symfony'); $span->type = 'queue'; $span->meta[Tag::MQ_SYSTEM] = 'symfony'; $span->meta[Tag::MQ_DESTINATION_KIND] = 'queue'; diff --git a/src/DDTrace/Integrations/ZendFramework/V1/Ddtrace.php b/src/DDTrace/Integrations/ZendFramework/V1/Ddtrace.php index 339763a1b30..48e4a4c3793 100644 --- a/src/DDTrace/Integrations/ZendFramework/V1/Ddtrace.php +++ b/src/DDTrace/Integrations/ZendFramework/V1/Ddtrace.php @@ -20,6 +20,7 @@ public function init() $span = \DDTrace\root_span(); $span->name = self::getOperationName(); $span->service = \ddtrace_config_app_name(self::NAME); + Integration::tagFrameworkServiceSource($span, self::NAME); } /** diff --git a/src/DDTrace/Integrations/ZendFramework/ZendFrameworkIntegration.php b/src/DDTrace/Integrations/ZendFramework/ZendFrameworkIntegration.php index 4c2b77bb1ef..89744136740 100644 --- a/src/DDTrace/Integrations/ZendFramework/ZendFrameworkIntegration.php +++ b/src/DDTrace/Integrations/ZendFramework/ZendFrameworkIntegration.php @@ -53,6 +53,7 @@ static function ($broker, $scope, $args) { // For backward compatibility with the legacy API we are not using the integration // name 'zendframework', we are instead using the 'zf1' prefix. $rootSpan->service = \ddtrace_config_app_name('zf1'); + Integration::tagFrameworkServiceSource($rootSpan, 'zf1'); $controller = $request->getControllerName(); $action = $request->getActionName(); $route = Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(); diff --git a/tests/Common/SnapshotTestTrait.php b/tests/Common/SnapshotTestTrait.php index 6fee71e5b16..feb12737c2d 100644 --- a/tests/Common/SnapshotTestTrait.php +++ b/tests/Common/SnapshotTestTrait.php @@ -123,7 +123,7 @@ private function waitForTraces(string $token, int $numExpectedTraces = 0) */ private function stopAndCompareSnapshotSession( string $token, - array $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid'], + array $fieldsToIgnore = ['metrics.php.compilation.total_time_ms', 'metrics.php.memory.peak_usage_bytes', 'metrics.php.memory.peak_real_usage_bytes', 'meta.error.stack', 'meta._dd.p.tid', 'meta._dd.svc_src'], int $numExpectedTraces = 1, bool $snapshotMetrics = false, array $fieldsToIgnoreMetrics = ['openai.request.duration'], @@ -136,6 +136,9 @@ private function stopAndCompareSnapshotSession( $this->waitForTraces($token, $numExpectedTraces); + if (!in_array('meta._dd.svc_src', $fieldsToIgnore, true)) { + $fieldsToIgnore[] = 'meta._dd.svc_src'; + } $url = self::$testAgentUrl . '/test/session/snapshot?ignores=' . implode(',', $fieldsToIgnore) . '&test_session_token=' . $token; diff --git a/tests/Composer/ComposerInteroperabilityTest.php b/tests/Composer/ComposerInteroperabilityTest.php index ab5e1cc76e1..95ff9031855 100644 --- a/tests/Composer/ComposerInteroperabilityTest.php +++ b/tests/Composer/ComposerInteroperabilityTest.php @@ -140,6 +140,7 @@ function ($execute) { SpanAssertion::build('my_operation', 'web.request', 'memcached', 'my_resource') ->withExactTags([ 'http.method' => 'GET', + '_dd.svc_src' => 'm', ]), ]), ]); @@ -181,6 +182,7 @@ function ($execute) { SpanAssertion::build('my_operation', 'web.request', 'memcached', 'my_resource') ->withExactTags([ 'http.method' => 'GET', + '_dd.svc_src' => 'm', ]), ]), ]); @@ -257,6 +259,7 @@ function ($execute) { SpanAssertion::build('my_operation', 'web.request', 'memcached', 'my_resource') ->withExactTags([ 'http.method' => 'GET', + '_dd.svc_src' => 'm', ]), ]), ]); diff --git a/tests/Integrations/AMQP/V2/AMQPTest.php b/tests/Integrations/AMQP/V2/AMQPTest.php index ca6c23cf80e..155b9441239 100644 --- a/tests/Integrations/AMQP/V2/AMQPTest.php +++ b/tests/Integrations/AMQP/V2/AMQPTest.php @@ -45,6 +45,7 @@ public function testConnectError() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -92,6 +93,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -105,6 +107,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -119,6 +122,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -136,6 +140,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -151,6 +156,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -164,6 +170,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -178,6 +185,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello', Tag::MQ_DESTINATION_KIND => 'queue', @@ -195,6 +203,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'consumer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello', Tag::MQ_DESTINATION_KIND => 'queue', @@ -217,6 +226,7 @@ public function testHelloWorld() )->withExactTags([ Tag::SPAN_KIND => 'consumer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello', Tag::MQ_DESTINATION_KIND => 'queue', @@ -287,6 +297,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -300,6 +311,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -314,6 +326,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -328,6 +341,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -344,6 +358,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -360,6 +375,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -376,6 +392,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -393,6 +410,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -408,6 +426,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -421,6 +440,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -435,6 +455,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -452,6 +473,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'consumer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -474,6 +496,7 @@ public function testRouting() )->withExactTags([ Tag::SPAN_KIND => 'consumer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -519,6 +542,7 @@ public function testCancel() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -532,6 +556,7 @@ public function testCancel() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -546,6 +571,7 @@ public function testCancel() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -563,6 +589,7 @@ public function testCancel() )->withExactTags([ Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -573,6 +600,7 @@ public function testCancel() SpanAssertion::exists('amqp.basic.cancel')->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -587,6 +615,7 @@ public function testCancel() )->withExactTags([ Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -624,6 +653,7 @@ public function testPublishOnClosedChannel() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -637,6 +667,7 @@ public function testPublishOnClosedChannel() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -651,6 +682,7 @@ public function testPublishOnClosedChannel() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello', Tag::MQ_DESTINATION_KIND => 'queue', @@ -690,6 +722,7 @@ public function testReconnect() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -703,6 +736,7 @@ public function testReconnect() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -717,6 +751,7 @@ public function testReconnect() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -730,6 +765,7 @@ public function testReconnect() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -770,6 +806,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -783,6 +820,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -797,6 +835,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -811,6 +850,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -827,6 +867,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -845,6 +886,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'consumer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -866,6 +908,7 @@ public function testBasicGet() )->withExactTags([ Tag::SPAN_KIND => 'process', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -994,6 +1037,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -1007,6 +1051,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -1021,6 +1066,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', @@ -1035,6 +1081,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello-1', Tag::MQ_DESTINATION_KIND => 'queue', @@ -1051,6 +1098,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::RABBITMQ_ROUTING_KEY => 'hello-2', Tag::MQ_DESTINATION_KIND => 'queue', @@ -1067,6 +1115,7 @@ public function testBatchedPublishing() )->withExactTags([ Tag::SPAN_KIND => 'producer', Tag::COMPONENT => 'amqp', + '_dd.svc_src' => 'amqp', Tag::MQ_SYSTEM => 'rabbitmq', Tag::MQ_DESTINATION_KIND => 'queue', Tag::MQ_PROTOCOL => 'AMQP', diff --git a/tests/Integrations/CLI/Custom/Autoloaded/NoRootSpanTest.php b/tests/Integrations/CLI/Custom/Autoloaded/NoRootSpanTest.php index cb4931bd747..b64516caf89 100644 --- a/tests/Integrations/CLI/Custom/Autoloaded/NoRootSpanTest.php +++ b/tests/Integrations/CLI/Custom/Autoloaded/NoRootSpanTest.php @@ -44,6 +44,7 @@ public function testCommandWillAutoFlush() '_dd.code_origin.frames.1.file' => '%s', '_dd.code_origin.frames.0.file' => '%s', '_dd.code_origin.frames.0.line' => '6', + '_dd.svc_src' => 'm', ])->withChildren([ SpanAssertion::exists( 'mysqli_connect', diff --git a/tests/Integrations/CLI/Laravel/Latest/CommonScenariosTest.php b/tests/Integrations/CLI/Laravel/Latest/CommonScenariosTest.php index a125979c8e5..8a63dd917a9 100644 --- a/tests/Integrations/CLI/Laravel/Latest/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Laravel/Latest/CommonScenariosTest.php @@ -40,6 +40,7 @@ public function testCommandWithNoArguments() 'artisan' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -79,6 +80,7 @@ public function testCommandWithArgument() 'artisan route:list' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -118,6 +120,7 @@ public function testCommandWithError() 'artisan foo:error' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withExistingTagsNames([ Tag::ERROR_MSG, 'error.stack' diff --git a/tests/Integrations/CLI/Laravel/V10_X/CommonScenariosTest.php b/tests/Integrations/CLI/Laravel/V10_X/CommonScenariosTest.php index 65bf99a734c..b20d92dc85d 100644 --- a/tests/Integrations/CLI/Laravel/V10_X/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Laravel/V10_X/CommonScenariosTest.php @@ -27,6 +27,7 @@ public function testCommandWithError() 'artisan foo:error' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withExistingTagsNames([ Tag::ERROR_MSG, 'error.stack' diff --git a/tests/Integrations/CLI/Laravel/V5_8/CommonScenariosTest.php b/tests/Integrations/CLI/Laravel/V5_8/CommonScenariosTest.php index b53a16bb39e..69b4fa2a27f 100644 --- a/tests/Integrations/CLI/Laravel/V5_8/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Laravel/V5_8/CommonScenariosTest.php @@ -33,6 +33,7 @@ public function testCommandWithNoArguments() 'artisan' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -71,6 +72,7 @@ public function testCommandWithArgument() 'artisan route:list' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -109,6 +111,7 @@ public function testCommandWithError() 'artisan foo:error' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withExistingTagsNames([ Tag::ERROR_MSG, 'error.stack' diff --git a/tests/Integrations/CLI/Laravel/V8_X/CommonScenariosTest.php b/tests/Integrations/CLI/Laravel/V8_X/CommonScenariosTest.php index 49de6dd0c00..fe473e7979c 100644 --- a/tests/Integrations/CLI/Laravel/V8_X/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Laravel/V8_X/CommonScenariosTest.php @@ -40,6 +40,7 @@ public function testCommandWithNoArguments() 'artisan' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -78,6 +79,7 @@ public function testCommandWithArgument() 'artisan route:list' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -116,6 +118,7 @@ public function testCommandWithError() 'artisan foo:error' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withExistingTagsNames([ Tag::ERROR_MSG, 'error.stack' diff --git a/tests/Integrations/CLI/Laravel/V9_X/CommonScenariosTest.php b/tests/Integrations/CLI/Laravel/V9_X/CommonScenariosTest.php index 1554c239ecd..4987fb4a915 100644 --- a/tests/Integrations/CLI/Laravel/V9_X/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Laravel/V9_X/CommonScenariosTest.php @@ -40,6 +40,7 @@ public function testCommandWithNoArguments() 'artisan' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -79,6 +80,7 @@ public function testCommandWithArgument() 'artisan route:list' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists( 'laravel.provider.load', @@ -118,6 +120,7 @@ public function testCommandWithError() 'artisan foo:error' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withExistingTagsNames([ Tag::ERROR_MSG, 'error.stack' diff --git a/tests/Integrations/CLI/Symfony/V4_4/CommonScenariosTest.php b/tests/Integrations/CLI/Symfony/V4_4/CommonScenariosTest.php index 03745a02b2d..cac535a8d45 100644 --- a/tests/Integrations/CLI/Symfony/V4_4/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Symfony/V4_4/CommonScenariosTest.php @@ -59,6 +59,7 @@ public function testThrowCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -68,6 +69,7 @@ public function testThrowCommand() 'app:throw' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'App\\Command\\ThrowCommand', '_dd.base_service' => 'console', ])->setError( @@ -82,6 +84,7 @@ public function testThrowCommand() 'symfony.console.error' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -91,6 +94,7 @@ public function testThrowCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -100,6 +104,7 @@ public function testThrowCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]) ])->setError("Exception", "This is an exception", true) @@ -132,6 +137,7 @@ public function testCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -141,6 +147,7 @@ public function testCommand() 'about' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'Symfony\Bundle\FrameworkBundle\Command\AboutCommand', '_dd.base_service' => 'console', ]), @@ -151,6 +158,7 @@ public function testCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -160,6 +168,7 @@ public function testCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), ]), diff --git a/tests/Integrations/CLI/Symfony/V5_2/CommonScenariosTest.php b/tests/Integrations/CLI/Symfony/V5_2/CommonScenariosTest.php index d7bcad2dda4..8efa79b1f7b 100644 --- a/tests/Integrations/CLI/Symfony/V5_2/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Symfony/V5_2/CommonScenariosTest.php @@ -59,6 +59,7 @@ public function testThrowCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -68,6 +69,7 @@ public function testThrowCommand() 'app:throw' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'App\\Command\\ThrowCommand', '_dd.base_service' => 'console', ])->setError( @@ -82,6 +84,7 @@ public function testThrowCommand() 'symfony.console.error' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -91,6 +94,7 @@ public function testThrowCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -100,6 +104,7 @@ public function testThrowCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]) ])->setError("Exception", "This is an exception", true) @@ -132,6 +137,7 @@ public function testCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -141,6 +147,7 @@ public function testCommand() 'about' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'Symfony\Bundle\FrameworkBundle\Command\AboutCommand', '_dd.base_service' => 'console', ]), @@ -151,6 +158,7 @@ public function testCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -160,6 +168,7 @@ public function testCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), ]), diff --git a/tests/Integrations/CLI/Symfony/V6_2/CommonScenariosTest.php b/tests/Integrations/CLI/Symfony/V6_2/CommonScenariosTest.php index 5b22d5c0076..858d3cdb716 100644 --- a/tests/Integrations/CLI/Symfony/V6_2/CommonScenariosTest.php +++ b/tests/Integrations/CLI/Symfony/V6_2/CommonScenariosTest.php @@ -64,6 +64,7 @@ public function testThrowCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -73,6 +74,7 @@ public function testThrowCommand() 'app:throw' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'App\\Command\\ThrowCommand', '_dd.base_service' => 'console', ])->setError( @@ -87,6 +89,7 @@ public function testThrowCommand() 'symfony.console.error' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -96,6 +99,7 @@ public function testThrowCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -105,6 +109,7 @@ public function testThrowCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]) ])->setError("Exception", "This is an exception", true) @@ -137,6 +142,7 @@ public function testCommand() 'symfony.console.terminate' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -146,6 +152,7 @@ public function testCommand() 'about' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', 'symfony.console.command.class' => 'Symfony\Bundle\FrameworkBundle\Command\AboutCommand', '_dd.base_service' => 'console', ]), @@ -156,6 +163,7 @@ public function testCommand() 'symfony.console.command' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), SpanAssertion::build( @@ -165,6 +173,7 @@ public function testCommand() 'App\Kernel' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console', ]), ]), diff --git a/tests/Integrations/Curl/CurlIntegrationTest.php b/tests/Integrations/Curl/CurlIntegrationTest.php index b366b5c0bcb..e01c76154ae 100644 --- a/tests/Integrations/Curl/CurlIntegrationTest.php +++ b/tests/Integrations/Curl/CurlIntegrationTest.php @@ -91,6 +91,7 @@ public function testLoad200UrlOnInit() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -116,6 +117,7 @@ public function testLoad200UrlAsOpt() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -141,6 +143,7 @@ public function testInlineCredentials() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -167,6 +170,7 @@ public function testCredentialsViaBasicAuth() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -198,6 +202,7 @@ function ($execute) { 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', '_dd.base_service' => 'top_level_app', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) @@ -222,6 +227,7 @@ public function testPrivateCallbackForResponseHeaders() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -246,6 +252,7 @@ public function testLoad404UrlOnInit() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -270,6 +277,7 @@ public function testLoadUnroutableIP() 'span.kind' => 'client', 'network.destination.name' => '10.255.255.1', Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames([Tag::ERROR_MSG]) ->withExistingTagsNames([Tag::ERROR_STACK]) @@ -297,6 +305,7 @@ public function testLoadOperationTimeout() 'span.kind' => 'client', 'network.destination.name' => '10.255.255.1', Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames([Tag::ERROR_MSG]) ->withExistingTagsNames([Tag::ERROR_STACK]) @@ -324,6 +333,7 @@ public function testNonExistingHost() 'span.kind' => 'client', 'network.destination.name' => '__i_am_not_real__.invalid', Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/') @@ -473,6 +483,7 @@ public function testAppendHostnameToServiceName() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -504,6 +515,7 @@ public function testAppendHostnameToServiceNameInlineCredentials() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -565,6 +577,7 @@ public function testMulti($withRootSpan) SpanAssertion::build('curl_multi_exec', 'curl', 'http', 'curl_multi_exec') ->withExactTags([ Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ])->withChildren([ SpanAssertion::build('curl_exec', 'curl', 'http', 'http://' . HTTPBIN_INTEGRATION . '/status/?') ->withExactTags([ @@ -573,6 +586,7 @@ public function testMulti($withRootSpan) 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(($withRootSpan ? [-1 => "_dd.base_service"] : []) + self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/'), @@ -583,6 +597,7 @@ public function testMulti($withRootSpan) 'span.kind' => 'client', 'network.destination.name' => '__i_am_not_real__.invalid', Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', ]) ->withExistingTagsNames(($withRootSpan ? [-1 => "_dd.base_service"] : []) + self::commonCurlInfoTags()) ->skipTagsLike('/^curl\..*/') @@ -630,6 +645,7 @@ function ($execute) { 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', '_dd.base_service' => 'top_level_app', ]) ->withExistingTagsNames(self::commonCurlInfoTags()) @@ -720,6 +736,7 @@ public function testPeerServiceEnabled() 'span.kind' => 'client', 'network.destination.name' => HTTPBIN_SERVICE_HOST, Tag::COMPONENT => 'curl', + '_dd.svc_src' => 'curl', 'peer.service' => HTTPBIN_SERVICE_HOST, '_dd.peer.service.source' => 'network.destination.name', ]) diff --git a/tests/Integrations/Elasticsearch/V1/ElasticSearchIntegrationTest.php b/tests/Integrations/Elasticsearch/V1/ElasticSearchIntegrationTest.php index b8cf8658aa9..77223ff268c 100644 --- a/tests/Integrations/Elasticsearch/V1/ElasticSearchIntegrationTest.php +++ b/tests/Integrations/Elasticsearch/V1/ElasticSearchIntegrationTest.php @@ -69,7 +69,7 @@ public function testConstructor() 'elasticsearch', 'elasticsearch', '__construct' - )->withExactTags([Tag::COMPONENT => 'elasticsearch']) + )->withExactTags([Tag::COMPONENT => 'elasticsearch', '_dd.svc_src' => 'elasticsearch']) ]); } @@ -88,7 +88,8 @@ public function testCount() 'count' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ @@ -127,7 +128,8 @@ public function testDelete() 'delete index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ @@ -166,7 +168,8 @@ public function testExists() 'exists index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ @@ -213,7 +216,8 @@ public function testExplain() 'explain index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ @@ -256,7 +260,8 @@ public function testGet() 'get index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ]) ->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') @@ -291,7 +296,8 @@ public function testIndex() 'index index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ @@ -429,6 +435,7 @@ public function testScroll() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', '_dd.base_service' => 'phpunit', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest')->withChildren([ @@ -443,6 +450,7 @@ public function testScroll() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', '_dd.base_service' => 'phpunit', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest')->withChildren([ @@ -482,7 +490,8 @@ public function testSearch() 'search index:' . 'my_index7' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ]) ->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') @@ -535,7 +544,8 @@ public function testPerformRequest() 'elasticsearch.params' => '[]', 'elasticsearch.body' => '{"query":{"match_all":{}}}', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists( 'Elasticsearch.Serializers.SmartSerializer.serialize', @@ -577,7 +587,8 @@ public function testUpdate() 'update index:my_index7 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren( SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest') ->withChildren([ diff --git a/tests/Integrations/Elasticsearch/V8/ElasticSearchIntegrationTest.php b/tests/Integrations/Elasticsearch/V8/ElasticSearchIntegrationTest.php index 714c1138c33..28656e8036f 100644 --- a/tests/Integrations/Elasticsearch/V8/ElasticSearchIntegrationTest.php +++ b/tests/Integrations/Elasticsearch/V8/ElasticSearchIntegrationTest.php @@ -69,7 +69,8 @@ public function testConstructor() 'elasticsearch', '__construct' )->withExactTags([ - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ]), ]); } @@ -89,7 +90,8 @@ public function testCount() 'count' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ SpanAssertion::exists('Psr\Http\Client\ClientInterface.sendRequest', 'sendRequest'), @@ -125,7 +127,8 @@ public function testDelete() 'delete index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ SpanAssertion::exists('Psr\Http\Client\ClientInterface.sendRequest', 'sendRequest'), @@ -161,7 +164,8 @@ public function testExists() 'exists index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ SpanAssertion::exists('Psr\Http\Client\ClientInterface.sendRequest', 'sendRequest'), @@ -204,7 +208,8 @@ public function testExplain() 'explain index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elastic.Transport.Serializer.JsonSerializer.serialize', 'Elastic.Transport.Serializer.JsonSerializer.serialize'), SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ @@ -241,7 +246,8 @@ public function testGet() 'get index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ]) ->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ @@ -273,7 +279,8 @@ public function testIndex() 'index index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elastic.Transport.Serializer.JsonSerializer.serialize', 'Elastic.Transport.Serializer.JsonSerializer.serialize'), SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ @@ -409,6 +416,7 @@ public function testScroll() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', '_dd.base_service' => 'phpunit', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest')->withChildren([ @@ -423,6 +431,7 @@ public function testScroll() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', '_dd.base_service' => 'phpunit', ])->withChildren([ SpanAssertion::exists('Elasticsearch.Endpoint.performRequest')->withChildren([ @@ -462,7 +471,8 @@ public function testSearch() 'search index:' . 'my_index8' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ]) ->withChildren([ SpanAssertion::exists('Elastic.Transport.Serializer.JsonSerializer.serialize', 'Elastic.Transport.Serializer.JsonSerializer.serialize'), @@ -508,7 +518,8 @@ public function testPerformRequest() 'elasticsearch.method' => 'POST', 'elasticsearch.body' => '{"query":{"match_all":{}}}', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Psr\Http\Client\ClientInterface.sendRequest', 'sendRequest'), ]), @@ -543,7 +554,8 @@ public function testUpdate() 'update index:my_index8 type:my_type' )->withExactTags([ Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'elasticsearch' + Tag::COMPONENT => 'elasticsearch', + '_dd.svc_src' => 'elasticsearch', ])->withChildren([ SpanAssertion::exists('Elastic.Transport.Serializer.JsonSerializer.serialize', 'Elastic.Transport.Serializer.JsonSerializer.serialize'), SpanAssertion::exists('Elasticsearch.Endpoint.performRequest', 'performRequest')->withChildren([ diff --git a/tests/Integrations/Frankenphp/CommonScenariosTest.php b/tests/Integrations/Frankenphp/CommonScenariosTest.php index 5c45c93318a..70d997639d7 100644 --- a/tests/Integrations/Frankenphp/CommonScenariosTest.php +++ b/tests/Integrations/Frankenphp/CommonScenariosTest.php @@ -49,7 +49,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'frankenphp' + Tag::COMPONENT => 'frankenphp', ]), ], 'A GET request with an exception' => [ @@ -63,7 +63,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/error?key=value&', 'http.status_code' => '500', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'frankenphp' + Tag::COMPONENT => 'frankenphp', ])->setError('Exception', 'Uncaught Exception: Error page', true), ], ], diff --git a/tests/Integrations/Guzzle/Latest/GuzzleIntegrationTest.php b/tests/Integrations/Guzzle/Latest/GuzzleIntegrationTest.php index 44616631d3f..ce22bc192bf 100644 --- a/tests/Integrations/Guzzle/Latest/GuzzleIntegrationTest.php +++ b/tests/Integrations/Guzzle/Latest/GuzzleIntegrationTest.php @@ -25,7 +25,7 @@ public function testSendRequest() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'psr18' + Tag::COMPONENT => 'psr18', ]) ->withChildren([ SpanAssertion::build('GuzzleHttp\Client.transfer', 'guzzle', 'http', 'transfer') @@ -36,6 +36,7 @@ public function testSendRequest() 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', '_dd.base_service' => 'phpunit' ]), ]) diff --git a/tests/Integrations/Guzzle/V5/GuzzleIntegrationTest.php b/tests/Integrations/Guzzle/V5/GuzzleIntegrationTest.php index d8e6a0448b5..8504ee23c4a 100644 --- a/tests/Integrations/Guzzle/V5/GuzzleIntegrationTest.php +++ b/tests/Integrations/Guzzle/V5/GuzzleIntegrationTest.php @@ -70,7 +70,8 @@ public function testAliasMethods($method) 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -102,7 +103,8 @@ public function testSend() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -120,7 +122,8 @@ public function testGet() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -139,7 +142,8 @@ public function testGetInlineCredentials() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -326,7 +330,8 @@ public function testAppendHostnameToServiceName() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]), ]); } @@ -346,7 +351,8 @@ public function testAppendHostnameToServiceNameInlineCredentials() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]), ]); } @@ -377,6 +383,7 @@ function ($execute) { 'network.destination.name' => HTTPBIN_SERVICE_HOST, TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', '_dd.base_service' => 'top_level_app', ]) ->withChildren([ @@ -403,6 +410,7 @@ public function testPeerServiceEnabled() 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', 'peer.service' => 'example.com', '_dd.peer.service.source' => 'network.destination.name', ]), diff --git a/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php b/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php index 3cc84180173..ea7942cae4a 100644 --- a/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php +++ b/tests/Integrations/Guzzle/V6/GuzzleIntegrationTest.php @@ -67,7 +67,8 @@ public function testAliasMethods($method) 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -101,6 +102,7 @@ public function testSend() 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', // Note that the leaf span is guzzle, not the curl inside '_dd.code_origin.frames.1.file' => '%s/GuzzleIntegrationTest.php', '_dd.code_origin.frames.1.line' => '%d', @@ -116,7 +118,8 @@ public function testSend() 'network.destination.name' => 'example.com', 'http.status_code' => '200', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]) ]); @@ -135,7 +138,8 @@ public function testGet() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -154,7 +158,8 @@ public function testGetInlineCredentials() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]), ]); } @@ -296,7 +301,8 @@ public function testAppendHostnameToServiceNameNoSchema() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]), ]); } @@ -347,7 +353,8 @@ public function testAppendHostnameToServiceName() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]), ]); } @@ -367,7 +374,8 @@ public function testAppendHostnameToServiceNameInlineCredentials() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'opt.http_client_split_by_domain', ]), ]); } @@ -398,6 +406,7 @@ function ($execute) { 'network.destination.name' => HTTPBIN_SERVICE_HOST, TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', '_dd.base_service' => 'top_level_app', ]) ->withChildren([ @@ -428,6 +437,7 @@ public function testPeerServiceEnabled() 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', ]) ->withChildren([ SpanAssertion::build('GuzzleHttp\Client.transfer', 'guzzle', 'http', 'transfer') @@ -438,6 +448,7 @@ public function testPeerServiceEnabled() 'http.status_code' => '200', TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'guzzle', + '_dd.svc_src' => 'guzzle', 'peer.service' => 'example.com', 'peer.service' => 'example.com', '_dd.peer.service.source' => 'network.destination.name', @@ -465,7 +476,7 @@ public function testNoFakeServices() 'http.status_code' => '200', 'network.destination.name' => 'example.com', TAG::SPAN_KIND => 'client', - Tag::COMPONENT => 'guzzle' + Tag::COMPONENT => 'guzzle', ]), ]); } diff --git a/tests/Integrations/Laravel/Octane/Latest/CommonScenariosTest.php b/tests/Integrations/Laravel/Octane/Latest/CommonScenariosTest.php index d6ab6969b75..a787ff2574c 100644 --- a/tests/Integrations/Laravel/Octane/Latest/CommonScenariosTest.php +++ b/tests/Integrations/Laravel/Octane/Latest/CommonScenariosTest.php @@ -109,7 +109,7 @@ public function testScenarioGetReturnString() 'laravel.route.action' => 'App\Http\Controllers\CommonSpecsController@simple', ])->withChildren([ SpanAssertion::build('laravel.action', 'swoole_test_app', 'web', 'simple')->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', ]), SpanAssertion::exists('laravel.event.handle', null, null, 'swoole_test_app'), SpanAssertion::exists('laravel.event.handle', null, null, 'swoole_test_app'), @@ -181,7 +181,7 @@ public function testScenarioGetWithView() 'laravel.route.action' => 'App\Http\Controllers\CommonSpecsController@simple_view', ])->withChildren([ SpanAssertion::build('laravel.action', 'swoole_test_app', 'web', 'simple_view')->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', ]), SpanAssertion::build( 'laravel.view.render', @@ -270,7 +270,7 @@ public function testScenarioGetWithException() 'laravel.route.action' => 'App\Http\Controllers\CommonSpecsController@error', ])->setError('Exception', 'Controller error', true)->withChildren([ SpanAssertion::build('laravel.action', 'swoole_test_app', 'web', 'error')->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', ])->setError('Exception', 'Controller error', true), SpanAssertion::exists('laravel.event.handle', null, null, 'swoole_test_app'), SpanAssertion::exists('laravel.event.handle', null, null, 'swoole_test_app'), diff --git a/tests/Integrations/Laravel/V4/CommonScenariosTest.php b/tests/Integrations/Laravel/V4/CommonScenariosTest.php index 8af188ddb24..122a6947175 100644 --- a/tests/Integrations/Laravel/V4/CommonScenariosTest.php +++ b/tests/Integrations/Laravel/V4/CommonScenariosTest.php @@ -61,6 +61,7 @@ public function provideSpecs() 'some.key2' => 'value2', TAG::SPAN_KIND => 'server', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withChildren([ SpanAssertion::exists('laravel.application.handle') @@ -70,6 +71,7 @@ public function provideSpecs() 'some.key1' => 'value', 'some.key2' => 'value2', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), SpanAssertion::exists('laravel.event.handle', null, null, 'laravel'), SpanAssertion::exists('laravel.event.handle', null, null, 'laravel'), @@ -113,6 +115,7 @@ public function provideSpecs() 'some.key1' => 'value', 'some.key2' => 'value2', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withChildren([ SpanAssertion::exists('laravel.event.handle', null, null, 'laravel'), @@ -150,6 +153,7 @@ public function provideSpecs() 'some.key2' => 'value2', TAG::SPAN_KIND => 'server', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->setError()->withChildren([ SpanAssertion::exists('laravel.application.handle') ->withChildren([ @@ -158,6 +162,7 @@ public function provideSpecs() 'some.key1' => 'value', 'some.key2' => 'value2', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExistingTagsNames(['error.stack']) ->setError('Exception', 'Controller error'), @@ -198,6 +203,7 @@ public function provideSpecs() 'some.key2' => 'value2', TAG::SPAN_KIND => 'server', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withChildren([ SpanAssertion::exists('laravel.application.handle') @@ -207,6 +213,7 @@ public function provideSpecs() 'some.key1' => 'value', 'some.key2' => 'value2', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), SpanAssertion::exists('laravel.event.handle', null, null, 'laravel'), SpanAssertion::exists('laravel.event.handle', null, null, 'laravel'), diff --git a/tests/Integrations/Laravel/V4/EloquentTest.php b/tests/Integrations/Laravel/V4/EloquentTest.php index abd402c1291..bb9becf8156 100644 --- a/tests/Integrations/Laravel/V4/EloquentTest.php +++ b/tests/Integrations/Laravel/V4/EloquentTest.php @@ -40,6 +40,7 @@ public function testDestroy() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -59,6 +60,7 @@ public function testGet() TAG::SPAN_KIND => 'client', 'sql.query' => 'select * from `users`', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -77,6 +79,7 @@ public function testInsert() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -96,6 +99,7 @@ public function testUpdate() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -115,6 +119,7 @@ public function testDelete() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'laravel', Tag::DB_SYSTEM => 'other_sql', ])); } diff --git a/tests/Integrations/Laravel/V4/TraceSearchConfigTest.php b/tests/Integrations/Laravel/V4/TraceSearchConfigTest.php index 75783776e89..3109b07ddeb 100644 --- a/tests/Integrations/Laravel/V4/TraceSearchConfigTest.php +++ b/tests/Integrations/Laravel/V4/TraceSearchConfigTest.php @@ -46,6 +46,7 @@ public function testScenario() 'http.route' => 'simple', TAG::SPAN_KIND => 'server', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -58,6 +59,7 @@ public function testScenario() SpanAssertion::build('laravel.action', 'laravel', 'web', 'simple') ->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), SpanAssertion::exists('laravel.event.handle'), SpanAssertion::exists('laravel.event.handle'), diff --git a/tests/Integrations/Laravel/V5_7/EloquentTest.php b/tests/Integrations/Laravel/V5_7/EloquentTest.php index 24f4c373930..592b3a0fa2b 100644 --- a/tests/Integrations/Laravel/V5_7/EloquentTest.php +++ b/tests/Integrations/Laravel/V5_7/EloquentTest.php @@ -40,6 +40,7 @@ public function testDestroy() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -59,6 +60,7 @@ public function testRefresh() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -78,6 +80,7 @@ public function testGet() TAG::SPAN_KIND => 'client', 'sql.query' => 'select * from `users`', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -96,6 +99,7 @@ public function testInsert() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -115,6 +119,7 @@ public function testUpdate() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -134,6 +139,7 @@ public function testDelete() )->withExactTags([ TAG::SPAN_KIND => 'client', Tag::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } diff --git a/tests/Integrations/Laravel/V5_7/PipelineTracingTest.php b/tests/Integrations/Laravel/V5_7/PipelineTracingTest.php index 16dcec07e2f..c4f22c77e4d 100644 --- a/tests/Integrations/Laravel/V5_7/PipelineTracingTest.php +++ b/tests/Integrations/Laravel/V5_7/PipelineTracingTest.php @@ -34,6 +34,7 @@ public function testPipeline() 'Tests\Integration\DummyPipe::someHandler' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), ]), ]); @@ -57,6 +58,7 @@ public function testPipelineCalledTwiceProperlyTraced() 'Tests\Integration\DummyPipe::someHandler' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), SpanAssertion::build( 'laravel.pipeline.pipe', @@ -65,6 +67,7 @@ public function testPipelineCalledTwiceProperlyTraced() 'Tests\Integration\DummyPipe::someHandler' )->withExactTags([ Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]), ]), ]); diff --git a/tests/Integrations/Laravel/V5_7/TraceSearchConfigTest.php b/tests/Integrations/Laravel/V5_7/TraceSearchConfigTest.php index 3f9725f1ea1..402c38eab84 100644 --- a/tests/Integrations/Laravel/V5_7/TraceSearchConfigTest.php +++ b/tests/Integrations/Laravel/V5_7/TraceSearchConfigTest.php @@ -50,7 +50,8 @@ public function testScenario() 'http.status_code' => '200', 'http.route' => 'simple', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, diff --git a/tests/Integrations/Laravel/V5_8/EloquentTest.php b/tests/Integrations/Laravel/V5_8/EloquentTest.php index 6f4138d7747..1baebe87148 100644 --- a/tests/Integrations/Laravel/V5_8/EloquentTest.php +++ b/tests/Integrations/Laravel/V5_8/EloquentTest.php @@ -37,6 +37,7 @@ public function testDestroy() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -56,6 +57,7 @@ public function testRefresh() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -75,6 +77,7 @@ public function testGet() TAG::SPAN_KIND => 'client', 'sql.query' => 'select * from `users`', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -93,6 +96,7 @@ public function testInsert() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -112,6 +116,7 @@ public function testUpdate() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -131,6 +136,7 @@ public function testDelete() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } diff --git a/tests/Integrations/Laravel/V5_8/QueueTest.php b/tests/Integrations/Laravel/V5_8/QueueTest.php index a8196ef8df5..89e0c8a79ca 100644 --- a/tests/Integrations/Laravel/V5_8/QueueTest.php +++ b/tests/Integrations/Laravel/V5_8/QueueTest.php @@ -83,7 +83,8 @@ public function testSimplePushAndProcess() ->withChildren([ SpanAssertion::exists('laravel.action') ->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ $this->spanQueuePush('database', 'emails', 'Illuminate\Queue\DatabaseQueue') ]) @@ -174,7 +175,8 @@ public function testJobFailure() ->withChildren([ SpanAssertion::exists('laravel.action') ->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ $this->spanQueueLater('database', 'emails', 'Illuminate\Queue\DatabaseQueue') ]) @@ -242,7 +244,8 @@ protected function spanEventJobProcessing() 'web', 'Illuminate\Queue\Events\JobProcessing' )->withExistingTagsNames([ - Tag::COMPONENT + Tag::COMPONENT, + '_dd.svc_src', ]); } @@ -254,7 +257,8 @@ protected function spanEventJobProcessed() 'web', 'Illuminate\Queue\Events\JobProcessed' )->withExistingTagsNames([ - Tag::COMPONENT + Tag::COMPONENT, + '_dd.svc_src', ]); } @@ -267,6 +271,7 @@ protected function getCommonTags( Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'laravelqueue', + '_dd.svc_src' => 'laravelqueue', Tag::MQ_SYSTEM => 'laravel', Tag::MQ_DESTINATION_KIND => 'queue', diff --git a/tests/Integrations/Laravel/V5_8/TraceSearchConfigTest.php b/tests/Integrations/Laravel/V5_8/TraceSearchConfigTest.php index 957c6be4888..3d8fd4681ef 100644 --- a/tests/Integrations/Laravel/V5_8/TraceSearchConfigTest.php +++ b/tests/Integrations/Laravel/V5_8/TraceSearchConfigTest.php @@ -51,6 +51,7 @@ public function testScenario() 'http.route' => 'simple', TAG::SPAN_KIND => 'server', Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, diff --git a/tests/Integrations/Laravel/V8_x/EloquentTest.php b/tests/Integrations/Laravel/V8_x/EloquentTest.php index dc63b751dbd..8731dbea3f9 100644 --- a/tests/Integrations/Laravel/V8_x/EloquentTest.php +++ b/tests/Integrations/Laravel/V8_x/EloquentTest.php @@ -37,6 +37,7 @@ public function testDestroy() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -56,6 +57,7 @@ public function testRefresh() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -75,6 +77,7 @@ public function testGet() TAG::SPAN_KIND => 'client', 'sql.query' => 'select * from `users`', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -93,6 +96,7 @@ public function testInsert() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -112,6 +116,7 @@ public function testUpdate() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } @@ -131,6 +136,7 @@ public function testDelete() )->withExactTags([ TAG::SPAN_KIND => 'client', TAG::COMPONENT => 'eloquent', + '_dd.svc_src' => 'Laravel', Tag::DB_SYSTEM => 'other_sql', ])); } diff --git a/tests/Integrations/Laravel/V8_x/InternalExceptionsTest.php b/tests/Integrations/Laravel/V8_x/InternalExceptionsTest.php index 8dbc19b85dd..8441164c14d 100644 --- a/tests/Integrations/Laravel/V8_x/InternalExceptionsTest.php +++ b/tests/Integrations/Laravel/V8_x/InternalExceptionsTest.php @@ -47,7 +47,8 @@ public function testNotImplemented() 'http.status_code' => '501', 'http.route' => 'not-implemented', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_sampling_priority_v1' => 1, @@ -57,6 +58,7 @@ public function testNotImplemented() SpanAssertion::build('laravel.action', 'laravel_test_app', 'web', 'not-implemented') ->withExactTags([ TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', 'track_error' => 'false', ]) ->setError('Symfony\Component\HttpKernel\Exception\HttpException') @@ -108,7 +110,8 @@ public function testUnauthorized() 'http.status_code' => '403', 'http.route' => 'unauthorized', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_sampling_priority_v1' => 1, @@ -121,7 +124,8 @@ public function testUnauthorized() 'web', 'errors::403' )->withExactTags([ - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ SpanAssertion::exists('laravel.view')->withChildren([ SpanAssertion::exists('laravel.event.handle'), @@ -132,6 +136,7 @@ public function testUnauthorized() SpanAssertion::build('laravel.action', 'laravel_test_app', 'web', 'unauthorized') ->withExactTags([ TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', 'track_error' => 'false', ]) ->setError() diff --git a/tests/Integrations/Laravel/V8_x/QueueTest.php b/tests/Integrations/Laravel/V8_x/QueueTest.php index 00cb7fe9c2a..14a0f0d04a3 100644 --- a/tests/Integrations/Laravel/V8_x/QueueTest.php +++ b/tests/Integrations/Laravel/V8_x/QueueTest.php @@ -101,7 +101,8 @@ public function testSimplePushAndProcess() ->withChildren([ SpanAssertion::exists('laravel.action') ->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ $this->spanQueuePush('database', 'emails', 'Illuminate\Queue\DatabaseQueue') ->withChildren([ @@ -194,7 +195,8 @@ public function testJobFailure() ->withChildren([ SpanAssertion::exists('laravel.action') ->withExactTags([ - Tag::COMPONENT => 'laravel' + Tag::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ])->withChildren([ $this->spanQueueLater('database', 'emails', 'Illuminate\Queue\DatabaseQueue') ->withChildren([ @@ -353,7 +355,8 @@ protected function spanEventJobProcessing() 'web', 'Illuminate\Queue\Events\JobProcessing' )->withExistingTagsNames([ - Tag::COMPONENT + Tag::COMPONENT, + '_dd.svc_src', ]); } @@ -365,7 +368,8 @@ protected function spanEventJobProcessed() 'web', 'Illuminate\Queue\Events\JobProcessed' )->withExistingTagsNames([ - Tag::COMPONENT + Tag::COMPONENT, + '_dd.svc_src', ]); } @@ -378,6 +382,7 @@ protected function getCommonTags( Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'laravelqueue', + '_dd.svc_src' => 'laravelqueue', Tag::MQ_SYSTEM => 'laravel', Tag::MQ_DESTINATION_KIND => 'queue', @@ -578,6 +583,7 @@ protected function spanQueueBatchAdd() )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'laravelqueue', + '_dd.svc_src' => 'laravelqueue', Tag::MQ_OPERATION => 'send' ])->withExistingTagsNames([ Tag::LARAVELQ_BATCH_ID diff --git a/tests/Integrations/Laravel/V8_x/QueueTestNotDistributed.php b/tests/Integrations/Laravel/V8_x/QueueTestNotDistributed.php index 0027f236c82..43163b7b74f 100644 --- a/tests/Integrations/Laravel/V8_x/QueueTestNotDistributed.php +++ b/tests/Integrations/Laravel/V8_x/QueueTestNotDistributed.php @@ -100,6 +100,7 @@ protected function getCommonTags( Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'laravelqueue', + '_dd.svc_src' => 'laravelqueue', Tag::MQ_SYSTEM => 'laravel', Tag::MQ_DESTINATION_KIND => 'queue', diff --git a/tests/Integrations/Laravel/V8_x/RouteCachingTest.php b/tests/Integrations/Laravel/V8_x/RouteCachingTest.php index 83b17d496ad..247e049ccfe 100644 --- a/tests/Integrations/Laravel/V8_x/RouteCachingTest.php +++ b/tests/Integrations/Laravel/V8_x/RouteCachingTest.php @@ -46,7 +46,8 @@ public function testNotCached() 'http.status_code' => '200', 'http.route' => 'unnamed-route', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withChildren([ SpanAssertion::exists('laravel.action'), @@ -94,7 +95,8 @@ public function testCached() 'http.status_code' => '200', 'http.route' => 'unnamed-route', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withChildren([ SpanAssertion::exists('laravel.action'), diff --git a/tests/Integrations/Laravel/V8_x/TraceSearchConfigTest.php b/tests/Integrations/Laravel/V8_x/TraceSearchConfigTest.php index eeacce21003..0d76259fbcf 100644 --- a/tests/Integrations/Laravel/V8_x/TraceSearchConfigTest.php +++ b/tests/Integrations/Laravel/V8_x/TraceSearchConfigTest.php @@ -50,7 +50,8 @@ public function testScenario() 'http.status_code' => '200', 'http.route' => 'simple', TAG::SPAN_KIND => 'server', - TAG::COMPONENT => 'laravel' + TAG::COMPONENT => 'laravel', + '_dd.svc_src' => 'laravel', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, diff --git a/tests/Integrations/Lumen/V10_0/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V10_0/TraceSearchConfigTest.php index 9eb9eb0e198..bee744eaa16 100644 --- a/tests/Integrations/Lumen/V10_0/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V10_0/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -63,6 +64,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Lumen/V5_2/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V5_2/TraceSearchConfigTest.php index bb8bde07aa2..962f268fbbb 100644 --- a/tests/Integrations/Lumen/V5_2/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V5_2/TraceSearchConfigTest.php @@ -47,7 +47,8 @@ public function testScenario() 'http.url' => 'http://localhost/simple', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - TAG::COMPONENT => 'lumen' + TAG::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -62,7 +63,8 @@ public function testScenario() 'simple_route' )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', - TAG::COMPONENT => 'lumen' + TAG::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]) ] diff --git a/tests/Integrations/Lumen/V5_6/DeprecatedResourceNameTest.php b/tests/Integrations/Lumen/V5_6/DeprecatedResourceNameTest.php index 2cc839a0827..59803c874f9 100644 --- a/tests/Integrations/Lumen/V5_6/DeprecatedResourceNameTest.php +++ b/tests/Integrations/Lumen/V5_6/DeprecatedResourceNameTest.php @@ -47,6 +47,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withChildren([ SpanAssertion::build( @@ -57,6 +58,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Lumen/V5_6/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V5_6/TraceSearchConfigTest.php index 74e5fab7da4..8ed82832ffd 100644 --- a/tests/Integrations/Lumen/V5_6/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V5_6/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -63,6 +64,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Lumen/V5_8/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V5_8/TraceSearchConfigTest.php index 5eccee2e158..dcefdc8bad3 100644 --- a/tests/Integrations/Lumen/V5_8/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V5_8/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -63,6 +64,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Lumen/V8_1/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V8_1/TraceSearchConfigTest.php index c05aa745ae9..5f2f141ed21 100644 --- a/tests/Integrations/Lumen/V8_1/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V8_1/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -63,6 +64,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Lumen/V9_0/TraceSearchConfigTest.php b/tests/Integrations/Lumen/V9_0/TraceSearchConfigTest.php index 1239f2f13f4..87675daa158 100644 --- a/tests/Integrations/Lumen/V9_0/TraceSearchConfigTest.php +++ b/tests/Integrations/Lumen/V9_0/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, @@ -63,6 +64,7 @@ public function testScenario() )->withExactTags([ 'lumen.route.action' => 'App\Http\Controllers\ExampleController@simple', Tag::COMPONENT => 'lumen', + '_dd.svc_src' => 'lumen', ]), ]), ] diff --git a/tests/Integrations/Memcache/MemcacheTest.php b/tests/Integrations/Memcache/MemcacheTest.php index 69703827387..787e3387b70 100644 --- a/tests/Integrations/Memcache/MemcacheTest.php +++ b/tests/Integrations/Memcache/MemcacheTest.php @@ -181,6 +181,7 @@ public function testFlush() 'memcache.command' => 'flush', Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'memcache', + '_dd.svc_src' => 'memcache', Tag::DB_SYSTEM => 'memcached', ]), SpanAssertion::exists('Memcache.get'), @@ -323,7 +324,7 @@ public function testCasPeerServiceEnabled() ]); } - private static function baseTags($expectPeerService = false) + private static function baseTags($expectPeerService = false, $svcSrc = 'memcache') { $tags = [ 'out.host' => self::$host, @@ -331,6 +332,9 @@ private static function baseTags($expectPeerService = false) Tag::COMPONENT => 'memcache', Tag::DB_SYSTEM => 'memcached', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } if ($expectPeerService) { $tags['peer.service'] = 'memcached-integration'; @@ -353,7 +357,7 @@ public function testNoFakeServices() $this->assertSpans($traces, [ SpanAssertion::build('Memcache.add', 'configured_service', 'memcached', 'add') - ->withExactTags(array_merge(self::baseTags(), [ + ->withExactTags(array_merge(self::baseTags(false, null), [ 'memcache.query' => 'add ' . Obfuscation::toObfuscatedString('key'), 'memcache.command' => 'add', Tag::SPAN_KIND => 'client', diff --git a/tests/Integrations/Memcached/MemcachedTest.php b/tests/Integrations/Memcached/MemcachedTest.php index 85518d7f47a..d0af99e60c3 100644 --- a/tests/Integrations/Memcached/MemcachedTest.php +++ b/tests/Integrations/Memcached/MemcachedTest.php @@ -985,7 +985,7 @@ public function testCasPeerServiceEnabled() ]); } - private static function baseTags($expectPeerService = false) + private static function baseTags($expectPeerService = false, $svcSrc = 'memcached') { $tags = [ 'out.host' => self::$host, @@ -994,6 +994,9 @@ private static function baseTags($expectPeerService = false) Tag::COMPONENT => 'memcached', Tag::DB_SYSTEM => 'memcached', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } if ($expectPeerService) { $tags['peer.service'] = 'memcached-integration'; @@ -1017,7 +1020,7 @@ public function testNoFakeServices() $this->assertSpans($traces, [ SpanAssertion::build('Memcached.add', 'configured_service', 'memcached', 'add') - ->withExactTags(array_merge(self::baseTags(), [ + ->withExactTags(array_merge(self::baseTags(false, null), [ 'memcached.query' => 'add ' . Obfuscation::toObfuscatedString('key'), 'memcached.command' => 'add', Tag::SPAN_KIND => 'client', diff --git a/tests/Integrations/Mongo/MongoTest.php b/tests/Integrations/Mongo/MongoTest.php index ba4d18ec3e8..ce8d036d676 100644 --- a/tests/Integrations/Mongo/MongoTest.php +++ b/tests/Integrations/Mongo/MongoTest.php @@ -50,6 +50,7 @@ public function testClientConnectAndClose() 'mongodb.server' => 'mongodb://mongodb-integration:27017', 'mongodb.db' => self::DATABASE, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -79,6 +80,7 @@ public function testSecretsAreSanitizedFromDsnString() 'mongodb.server' => 'mongodb://?:?@mongodb-integration:27017', 'mongodb.db' => self::DATABASE, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -108,6 +110,7 @@ public function testDatabaseNameExtractedFromDsnString() 'mongodb.server' => 'mongodb://mongodb-integration:27017/' . self::DATABASE, 'mongodb.db' => self::DATABASE, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -125,6 +128,7 @@ public function testClientSelectCollection() 'mongodb.collection' => 'foo_collection', 'mongodb.db' => self::DATABASE, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -141,6 +145,7 @@ public function testSelectDB() ->withExactTags([ 'mongodb.db' => self::DATABASE, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -157,6 +162,7 @@ public function testClientSetReadPreference() ->withExactTags([ 'mongodb.read_preference' => MongoClient::RP_NEAREST, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -172,6 +178,7 @@ public function testClientSetWriteConcern() SpanAssertion::build('MongoClient.setWriteConcern', 'mongo', 'mongodb', 'setWriteConcern') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -190,6 +197,7 @@ public function testClientMethods($method) SpanAssertion::build('MongoClient.' . $method, 'mongo', 'mongodb', $method) ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -222,6 +230,7 @@ public function testCommandWithQueryAndTimeout() 'mongodb.query' => '{"age":{"$gte":18}}', 'mongodb.timeout' => '500', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -239,6 +248,7 @@ public function testCreateDBRef() 'mongodb.collection' => 'foo_collection', 'mongodb.bson.id' => '47cc67093475061e3d9536d2', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -255,6 +265,7 @@ public function testCreateCollection() ->withExactTags([ 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -270,6 +281,7 @@ public function testExecute() SpanAssertion::build('MongoDB.execute', 'mongo', 'mongodb', 'execute') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -289,6 +301,7 @@ public function testGetDBRef() ->withExactTags([ 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -305,6 +318,7 @@ public function testSelectCollection() ->withExactTags([ 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -321,6 +335,7 @@ public function testSetProfilingLevel() ->withExactTags([ 'mongodb.profiling_level' => '2', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -337,6 +352,7 @@ public function testSetReadPreference() ->withExactTags([ 'mongodb.read_preference' => MongoClient::RP_NEAREST, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -352,6 +368,7 @@ public function testSetWriteConcern() SpanAssertion::build('MongoDB.setWriteConcern', 'mongo', 'mongodb', 'setWriteConcern') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]) ]); @@ -370,6 +387,7 @@ public function testDBWithDefaultTags($method) SpanAssertion::build('MongoDB.' . $method, 'mongo', 'mongodb', $method) ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -404,6 +422,7 @@ public function testCollection() 'mongodb.db' => self::DATABASE, 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -419,6 +438,7 @@ public function testCollectionAggregate() SpanAssertion::build('MongoCollection.aggregate', 'mongo', 'mongodb', 'aggregate') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -448,6 +468,7 @@ public function testCollectionBatchInsert() SpanAssertion::build('MongoCollection.batchInsert', 'mongo', 'mongodb', 'batchInsert') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -464,6 +485,7 @@ public function testCollectionCount() ->withExactTags([ 'mongodb.query' => '{"title":"Foo"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -481,6 +503,7 @@ public function testCollectionCreateDBRef() 'mongodb.bson.id' => '47cc67093475061e3d9536d2', 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -496,6 +519,7 @@ public function testCollectionCreateIndex() SpanAssertion::build('MongoCollection.createIndex', 'mongo', 'mongodb', 'createIndex') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -511,6 +535,7 @@ public function testCollectionDeleteIndex() SpanAssertion::build('MongoCollection.deleteIndex', 'mongo', 'mongodb', 'deleteIndex') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -527,6 +552,7 @@ public function testCollectionDistinct() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -543,6 +569,7 @@ public function testCollectionFind() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -564,6 +591,7 @@ public function testCollectionFindAndModify() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -580,6 +608,7 @@ public function testCollectionFindOne() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -600,6 +629,7 @@ public function testCollectionGetDBRef() 'mongodb.bson.id' => '47cc67093475061e3d9536d2', 'mongodb.collection' => 'foo_collection', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -619,6 +649,7 @@ public function testCollectionGroup() SpanAssertion::build('MongoCollection.group', 'mongo', 'mongodb', 'group') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -634,6 +665,7 @@ public function testCollectionInsert() SpanAssertion::build('MongoCollection.insert', 'mongo', 'mongodb', 'insert') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -654,6 +686,7 @@ public function testCollectionParallelCollectionScan() ) ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -670,6 +703,7 @@ public function testCollectionRemove() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -685,6 +719,7 @@ public function testCollectionSave() SpanAssertion::build('MongoCollection.save', 'mongo', 'mongodb', 'save') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -701,6 +736,7 @@ public function testCollectionSetReadPreference() ->withExactTags([ 'mongodb.read_preference' => MongoClient::RP_NEAREST, Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -716,6 +752,7 @@ public function testCollectionSetWriteConcern() SpanAssertion::build('MongoCollection.setWriteConcern', 'mongo', 'mongodb', 'setWriteConcern') ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -735,6 +772,7 @@ public function testCollectionUpdate() ->withExactTags([ 'mongodb.query' => '{"foo":"bar"}', Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -753,6 +791,7 @@ public function testCollectionMethods($method) SpanAssertion::build('MongoCollection.' . $method, 'mongo', 'mongodb', $method) ->withExactTags([ Tag::COMPONENT => 'mongo', + '_dd.svc_src' => 'mongo', Tag::DB_SYSTEM => 'mongodb', ]), ]); diff --git a/tests/Integrations/MongoDB/Latest/MongoDBTest.php b/tests/Integrations/MongoDB/Latest/MongoDBTest.php index e0d140acdd5..d4805c64328 100644 --- a/tests/Integrations/MongoDB/Latest/MongoDBTest.php +++ b/tests/Integrations/MongoDB/Latest/MongoDBTest.php @@ -60,6 +60,7 @@ public function testFilterNormalizationRegex() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->withChildren([ SpanAssertion::exists('mongodb.driver.cmd') @@ -104,6 +105,7 @@ public function testFilterAggregation() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->withChildren([ SpanAssertion::exists('mongodb.driver.cmd') @@ -162,6 +164,7 @@ public function testCollectionBulkWrite() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->withChildren([ SpanAssertion::exists('mongodb.driver.cmd') @@ -186,6 +189,7 @@ public function testException() 'mongodb.query' => '"?"', 'span.kind' => 'client', Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]; // On newer versions of the mongodb library, the datadog subscriber is only called after the arguments check @@ -218,6 +222,7 @@ public function testMethodsWithFilter($method, $args) 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->withChildren([ SpanAssertion::exists('mongodb.driver.cmd') @@ -299,6 +304,7 @@ public function testMethodsNoArgs($method, $args) 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->withChildren([ SpanAssertion::exists('mongodb.driver.cmd') @@ -443,6 +449,7 @@ public function testManagerExecuteQuery() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]), ]; @@ -486,6 +493,7 @@ public function testManagerExecuteCommand() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]), ]; @@ -530,6 +538,7 @@ public function testManagerExecuteReadCommand() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]), ]; @@ -586,6 +595,7 @@ public function testManagerExecuteWriteCommand() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]), ]; @@ -642,6 +652,7 @@ public function testManagerExecuteReadWriteCommand() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]) ]; @@ -713,6 +724,7 @@ public function testManagerExecuteBulkWrite() 'mongodb.updates.0.filter' => '{"brand":"?"}', 'mongodb.insertsCount' => 2, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ]), ]); @@ -744,6 +756,7 @@ public function testManagerFailure() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', ])->setError() ->withExistingTagsNames([Tag::ERROR_MSG, 'error.stack']), @@ -765,6 +778,7 @@ public function testManagerExecuteQueryPeerServiceEnabled() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', 'peer.service' => self::DATABASE, '_dd.peer.service.source' => 'mongodb.db', @@ -811,6 +825,7 @@ public function testManagerExecuteBulkWritePeerServiceEnabled() 'mongodb.updates.0.filter' => '{"brand":"?"}', 'mongodb.insertsCount' => 2, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', 'peer.service' => self::DATABASE, '_dd.peer.service.source' => 'mongodb.db', @@ -836,6 +851,7 @@ public function testManagerExecuteCommandPeerServiceEnabled() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', 'peer.service' => self::DATABASE, '_dd.peer.service.source' => 'mongodb.db', @@ -865,6 +881,7 @@ public function testMethodsWithFilterPeerServiceEnabled() 'out.host' => self::HOST, 'out.port' => self::PORT, Tag::COMPONENT => 'mongodb', + '_dd.svc_src' => 'mongodb', Tag::DB_SYSTEM => 'mongodb', 'peer.service' => self::DATABASE, '_dd.peer.service.source' => 'mongodb.db', diff --git a/tests/Integrations/Mysqli/MysqliTest.php b/tests/Integrations/Mysqli/MysqliTest.php index f6bdd08a66c..525a795f629 100644 --- a/tests/Integrations/Mysqli/MysqliTest.php +++ b/tests/Integrations/Mysqli/MysqliTest.php @@ -661,6 +661,7 @@ public function testConstructorConnectError() Tag::SPAN_KIND, Tag::COMPONENT, Tag::DB_SYSTEM, + '_dd.svc_src', ]), ]); } @@ -682,7 +683,7 @@ public function testNoFakeServices() $this->assertFlameGraph($traces, [ SpanAssertion::exists('mysqli.__construct', 'mysqli.__construct'), SpanAssertion::build('mysqli.query', 'configured_service', 'sql', 'SELECT * from tests') - ->withExactTags(self::baseTags()) + ->withExactTags(self::baseTags(true, false, null)) ->withExactMetrics([ Tag::DB_ROW_COUNT => 1, ]), @@ -702,7 +703,7 @@ public function testServiceMappedSplitByDomain() ]); } - private function baseTags($expectDbName = true, $expectPeerService = false) + private function baseTags($expectDbName = true, $expectPeerService = false, $svcSrc = 'mysqli') { $tags = [ 'out.host' => self::$host, @@ -712,6 +713,9 @@ private function baseTags($expectDbName = true, $expectPeerService = false) Tag::COMPONENT => 'mysqli', Tag::DB_SYSTEM => 'mysql', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } if ($expectDbName) { $tags['db.name'] = self::$database; diff --git a/tests/Integrations/Nette/Latest/NetteTest.php b/tests/Integrations/Nette/Latest/NetteTest.php index 49f07e2822e..5551eda3c23 100644 --- a/tests/Integrations/Nette/Latest/NetteTest.php +++ b/tests/Integrations/Nette/Latest/NetteTest.php @@ -59,7 +59,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.configurator.createRobotLoader', @@ -67,7 +67,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -75,7 +75,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -83,7 +83,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]) ]) ]) @@ -101,7 +101,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple_view?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.configurator.createRobotLoader', @@ -109,7 +109,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -117,7 +117,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -125,7 +125,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.latte.render', @@ -134,7 +134,7 @@ public function provideSpecs() 'nette.latte.render' )->withExactTags([ 'nette.latte.templateName' => '%s', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::exists('nette.latte.createTemplate'), // layout template SpanAssertion::exists('nette.latte.createTemplate'), // simpleView template @@ -155,7 +155,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/error?key=value&', 'http.status_code' => '500', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]) ->setError( 'Exception', @@ -169,7 +169,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -177,7 +177,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -185,7 +185,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']), diff --git a/tests/Integrations/Nette/V2_4/NetteTest.php b/tests/Integrations/Nette/V2_4/NetteTest.php index eb8992573b2..4fb1fae30dd 100644 --- a/tests/Integrations/Nette/V2_4/NetteTest.php +++ b/tests/Integrations/Nette/V2_4/NetteTest.php @@ -59,7 +59,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.configurator.createRobotLoader', @@ -67,7 +67,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -75,7 +75,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -83,7 +83,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), ]) ]) @@ -101,7 +101,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple_view?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.configurator.createRobotLoader', @@ -109,7 +109,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -117,7 +117,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -125,7 +125,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.latte.render', @@ -134,7 +134,7 @@ public function provideSpecs() 'nette.latte.render' )->withExactTags([ 'nette.latte.templateName' => '%s', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::exists('nette.latte.createTemplate'), // layout template SpanAssertion::exists('nette.latte.createTemplate'), // simpleView template @@ -155,7 +155,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/error?key=value&', 'http.status_code' => '500', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]) ->setError('HttpError') ->withChildren([ @@ -165,7 +165,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.configurator.createRobotLoader' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]), SpanAssertion::build( 'nette.application.run', @@ -173,7 +173,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.application.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ])->withChildren([ SpanAssertion::build( 'nette.presenter.run', @@ -181,7 +181,7 @@ public function provideSpecs() Type::WEB_SERVLET, 'nette.presenter.run' )->withExactTags([ - Tag::COMPONENT => 'nette' + Tag::COMPONENT => 'nette', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']), diff --git a/tests/Integrations/PDO/PDOTest.php b/tests/Integrations/PDO/PDOTest.php index dd77c790471..b2abb86e49d 100644 --- a/tests/Integrations/PDO/PDOTest.php +++ b/tests/Integrations/PDO/PDOTest.php @@ -187,7 +187,7 @@ public function testPDOSplitByDomain() $this->assertSpans($traces, [ SpanAssertion::build('PDO.__construct', 'pdo-mysql-integration', 'sql', 'PDO.__construct') - ->withExactTags($this->baseTags()), + ->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')), ]); } @@ -201,7 +201,7 @@ public function testPDOServiceMappedSplitByDomain() $this->assertSpans($traces, [ SpanAssertion::build('PDO.__construct', 'my-pdo-mysql-integration', 'sql', 'PDO.__construct') - ->withExactTags($this->baseTags()), + ->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')), ]); } @@ -512,14 +512,14 @@ public function testPDOStatementSplitByDomain() 'pdo-mysql-integration', 'sql', "SELECT * FROM tests WHERE id = ?" - )->withExactTags($this->baseTags()), + )->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')), SpanAssertion::build( 'PDOStatement.execute', 'pdo-mysql-integration', 'sql', "SELECT * FROM tests WHERE id = ?" ) - ->withExactTags($this->baseTags()) + ->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')) ->withExactMetrics([ Tag::DB_ROW_COUNT => 1.0, Tag::ANALYTICS_KEY => 1.0, @@ -551,14 +551,14 @@ public function testPDOStatementSplitByDomainAndServiceFlattening() 'pdo-mysql-integration', 'sql', "SELECT * FROM tests WHERE id = ?" - )->withExactTags($this->baseTags()), + )->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')), SpanAssertion::build( 'PDOStatement.execute', 'pdo-mysql-integration', 'sql', "SELECT * FROM tests WHERE id = ?" ) - ->withExactTags($this->baseTags()) + ->withExactTags($this->baseTags(false, 'opt.db_client_split_by_instance')) ->withExactMetrics([ Tag::DB_ROW_COUNT => 1.0, Tag::ANALYTICS_KEY => 1.0, @@ -822,7 +822,7 @@ public function testNoFakeServices() $this->assertSpans($traces, [ SpanAssertion::exists('PDO.__construct'), SpanAssertion::build('PDO.exec', 'configured_service', 'sql', $query) - ->withExactTags($this->baseTags()) + ->withExactTags($this->baseTags(false, null)) ->withExactMetrics([Tag::DB_ROW_COUNT => 1.0, Tag::ANALYTICS_KEY => 1.0]), SpanAssertion::exists('PDO.commit'), ], false); @@ -889,7 +889,7 @@ public function mysqlDns() return "mysql:host=" . self::MYSQL_HOST . ";dbname=" . self::$database; } - protected function baseTags($expectPeerService = false) + protected function baseTags($expectPeerService = false, $svcSrc = 'pdo') { $tags = [ 'db.engine' => 'mysql', @@ -901,6 +901,9 @@ protected function baseTags($expectPeerService = false) Tag::DB_SYSTEM => 'mysql', Tag::DB_TYPE => 'mysql', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } if ($expectPeerService) { $tags['peer.service'] = self::$database; diff --git a/tests/Integrations/PHPRedis/V3/PHPRedisClusterTest.php b/tests/Integrations/PHPRedis/V3/PHPRedisClusterTest.php index 2a9b300f194..db6826bf686 100644 --- a/tests/Integrations/PHPRedis/V3/PHPRedisClusterTest.php +++ b/tests/Integrations/PHPRedis/V3/PHPRedisClusterTest.php @@ -1596,13 +1596,13 @@ public function testSplitByDomainWithClusterName() 'redis', "RedisCluster.__construct" )->withExactTags([Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', 'out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', 'out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]]), SpanAssertion::build( "RedisCluster.set", 'redis-cluster_name', 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name']) + )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name', '_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1629,14 +1629,14 @@ public function testSplitByDomainWithClusterNameAndSeeds() "RedisCluster.__construct" )->withExactTags([ 'out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), SpanAssertion::build( "RedisCluster.set", 'redis-cluster_name', 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name']) + )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name', '_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1662,13 +1662,13 @@ public function testSplitByDomainWithFirstNodeIP() $serviceName, 'redis', "RedisCluster.__construct" - )->withExactTags($this->baseTags(null, false, false), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]]), + )->withExactTags($this->baseTags(null, false, false), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], '_dd.svc_src' => 'opt.redis_client_split_by_host']), SpanAssertion::build( "RedisCluster.set", $serviceName, 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value')) + )->withExactTags($this->baseTags('set key value'), ['_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1712,6 +1712,7 @@ protected function baseTags($rawCommand = null, $expectPeerService = false, $has $tags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]; diff --git a/tests/Integrations/PHPRedis/V3/PHPRedisTest.php b/tests/Integrations/PHPRedis/V3/PHPRedisTest.php index 9dbfdfa8dfe..364b7d114f7 100644 --- a/tests/Integrations/PHPRedis/V3/PHPRedisTest.php +++ b/tests/Integrations/PHPRedis/V3/PHPRedisTest.php @@ -81,6 +81,7 @@ public function testConnectionOk($method) )->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', 'out.host' => $this->host, 'out.port' => $this->port, @@ -126,6 +127,7 @@ public function testConnectionError($host, $port, $method) ->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', 'out.host' => $host, 'out.port' => $port ?: $this->port, @@ -1829,7 +1831,7 @@ public function testSplitByDomainWhenError() ) ->setError() ->withExistingTagsNames([Tag::ERROR_MSG, 'error.stack']) - ->withExactTags($this->baseTags(), ['out.host' => 'non-existing-host', 'out.port' => '6379']), + ->withExactTags($this->baseTags(), ['out.host' => 'non-existing-host', 'out.port' => '6379', '_dd.svc_src' => 'opt.redis_client_split_by_host']), ]); } @@ -1850,14 +1852,14 @@ public function testSplitByDomainWhenSuccess() 'redis', "Redis.connect" ) - ->withExactTags($this->baseTags(), [Tag::TARGET_PORT => '6379']), + ->withExactTags($this->baseTags(), [Tag::TARGET_PORT => '6379', '_dd.svc_src' => 'opt.redis_client_split_by_host']), SpanAssertion::build( "Redis.set", 'redis-redis-integration', 'redis', "Redis.set" ) - ->withExactTags($this->baseTags('set key value')), + ->withExactTags($this->baseTags('set key value'), ['_dd.svc_src' => 'opt.redis_client_split_by_host']), ]); } @@ -1946,6 +1948,7 @@ protected function baseTags($rawCommand = null, $expectPeerService = false) $tags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => 'redis-integration', ]; diff --git a/tests/Integrations/PHPRedis/V4/PHPRedisClusterTest.php b/tests/Integrations/PHPRedis/V4/PHPRedisClusterTest.php index b126a102b19..654fc0ac375 100644 --- a/tests/Integrations/PHPRedis/V4/PHPRedisClusterTest.php +++ b/tests/Integrations/PHPRedis/V4/PHPRedisClusterTest.php @@ -1800,14 +1800,14 @@ public function testSplitByDomainWithClusterName() "RedisCluster.__construct" )->withExactTags([ 'out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), SpanAssertion::build( "RedisCluster.set", 'redis-cluster_name', 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name']) + )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name', '_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1834,14 +1834,14 @@ public function testSplitByDomainWithClusterNameAndSeeds() "RedisCluster.__construct" )->withExactTags([ 'out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), SpanAssertion::build( "RedisCluster.set", 'redis-cluster_name', 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name']) + )->withExactTags($this->baseTags('set key value', false, false), ['_dd.cluster.name' => 'cluster_name', '_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1867,13 +1867,13 @@ public function testSplitByDomainWithFirstNodeIP() $serviceName, 'redis', "RedisCluster.__construct" - )->withExactTags($this->baseTags(null, false, false), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]]), + )->withExactTags($this->baseTags(null, false, false), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], '_dd.svc_src' => 'opt.redis_client_split_by_host']), SpanAssertion::build( "RedisCluster.set", $serviceName, 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value')) + )->withExactTags($this->baseTags('set key value'), ['_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -1917,6 +1917,7 @@ protected function baseTags($rawCommand = null, $expectPeerService = false, $has $tags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]; diff --git a/tests/Integrations/PHPRedis/V4/PHPRedisTest.php b/tests/Integrations/PHPRedis/V4/PHPRedisTest.php index 17412cfc16b..c29c69dfa0c 100644 --- a/tests/Integrations/PHPRedis/V4/PHPRedisTest.php +++ b/tests/Integrations/PHPRedis/V4/PHPRedisTest.php @@ -82,6 +82,7 @@ public function testConnectionOk($method) 'out.port' => $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -127,6 +128,7 @@ public function testConnectionError($host, $port, $method) 'out.port' => $port ?: $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]) ->withExistingTagsNames([Tag::ERROR_MSG, 'error.stack']), @@ -2106,7 +2108,7 @@ public function testSplitByDomainWhenError() ) ->setError() ->withExistingTagsNames([Tag::ERROR_MSG, 'error.stack']) - ->withExactTags($this->baseTags(), ['out.host' => 'non-existing-host', 'out.port' => '6379']), + ->withExactTags($this->baseTags(), ['out.host' => 'non-existing-host', 'out.port' => '6379', '_dd.svc_src' => 'opt.redis_client_split_by_host']), ]); } @@ -2127,14 +2129,14 @@ public function testSplitByDomainWhenSuccess() 'redis', "Redis.connect" ) - ->withExactTags($this->baseTags(), [Tag::TARGET_PORT => '6379']), + ->withExactTags($this->baseTags(), [Tag::TARGET_PORT => '6379', '_dd.svc_src' => 'opt.redis_client_split_by_host']), SpanAssertion::build( "Redis.set", 'redis-redis-integration', 'redis', "Redis.set" ) - ->withExactTags($this->baseTags('set key value')), + ->withExactTags($this->baseTags('set key value'), ['_dd.svc_src' => 'opt.redis_client_split_by_host']), ]); } @@ -2223,6 +2225,7 @@ protected function baseTags($rawCommand = null, $expectPeerService = false) $tags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => 'redis-integration', ]; diff --git a/tests/Integrations/PHPRedis/V5/PHPRedisClusterTest.php b/tests/Integrations/PHPRedis/V5/PHPRedisClusterTest.php index 13708b177e2..3ce224e95cc 100644 --- a/tests/Integrations/PHPRedis/V5/PHPRedisClusterTest.php +++ b/tests/Integrations/PHPRedis/V5/PHPRedisClusterTest.php @@ -1818,7 +1818,7 @@ public function testSplitByDomainWithClusterName() 'redis', "RedisCluster.__construct" )->withExactTags(array_merge( - $this->baseTags(null, false, false), + $this->baseTags(null, false, false, 'opt.redis_client_split_by_host'), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]] )), SpanAssertion::build( @@ -1827,7 +1827,7 @@ public function testSplitByDomainWithClusterName() 'redis', "RedisCluster.set" )->withExactTags(array_merge( - $this->baseTags('set key value', false, false), + $this->baseTags('set key value', false, false, 'opt.redis_client_split_by_host'), [ '_dd.cluster.name' => 'cluster_name', ] @@ -1934,7 +1934,7 @@ public function testSplitByDomainWithClusterNameAndSeeds() 'redis', "RedisCluster.__construct" )->withExactTags(array_merge( - $this->baseTags(null, false, false), + $this->baseTags(null, false, false, 'opt.redis_client_split_by_host'), ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]] )), SpanAssertion::build( @@ -1943,7 +1943,7 @@ public function testSplitByDomainWithClusterNameAndSeeds() 'redis', "RedisCluster.set" )->withExactTags(array_merge( - $this->baseTags('set key value', false, false), + $this->baseTags('set key value', false, false, 'opt.redis_client_split_by_host'), [ '_dd.cluster.name' => 'cluster_name', ] @@ -1975,14 +1975,14 @@ public function testSplitByDomainWithFirstNodeIP() "RedisCluster.__construct" )->withExactTags(array_merge( $this->baseTags(null, false, false), - ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1]] + ['out.host' => $this->connection1[0], 'out.port' => $this->connection1[1], '_dd.svc_src' => 'opt.redis_client_split_by_host'] )), SpanAssertion::build( "RedisCluster.set", $serviceName, 'redis', "RedisCluster.set" - )->withExactTags($this->baseTags('set key value')) + )->withExactTags($this->baseTags('set key value'), ['_dd.svc_src' => 'opt.redis_client_split_by_host']) ]); $redis->close(); @@ -2007,7 +2007,7 @@ public function testNoFakeServices() 'configured_service', 'redis', "RedisCluster.mSetNx" - )->withExactTags($this->baseTags('mSetNx k1 v1 k2 v2')), + )->withExactTags($this->baseTags('mSetNx k1 v1 k2 v2', false, true, null)), ]); } @@ -2044,13 +2044,16 @@ private function normalizeRawCommand($method, $rawCommand) return empty($rawCommand) ? $method : "$method $rawCommand"; } - protected function baseTags($rawCommand = null, $expectPeerService = false, $hasFirstConfiguredHost = true) + protected function baseTags($rawCommand = null, $expectPeerService = false, $hasFirstConfiguredHost = true, $svcSrc = 'phpredis') { $tags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } if ($hasFirstConfiguredHost) { $tags['_dd.first.configured.host'] = $this->clusterIp; diff --git a/tests/Integrations/PHPRedis/V5/PHPRedisTest.php b/tests/Integrations/PHPRedis/V5/PHPRedisTest.php index 55e0eb5ae28..ea8edf96e2c 100644 --- a/tests/Integrations/PHPRedis/V5/PHPRedisTest.php +++ b/tests/Integrations/PHPRedis/V5/PHPRedisTest.php @@ -81,6 +81,7 @@ public function testRedisInExtendedClass() Tag::TARGET_PORT => $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -115,6 +116,7 @@ public function testConnectionOk($method) 'out.port' => $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -160,6 +162,7 @@ public function testConnectionError($host, $port, $method) 'out.port' => $port ?: $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]) ->withExistingTagsNames([Tag::ERROR_MSG, 'error.stack']), @@ -202,7 +205,7 @@ public function testClose() 'redis', "Redis.close" )->withExactTags([Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -237,7 +240,7 @@ public function testMethodsSpansOnly($method, $args, $rawCommand) 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -288,7 +291,7 @@ public function testMethodsOnlySpan($method, $arg) 'redis', "Redis.$method" )->withExactTags([Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -325,6 +328,7 @@ public function testMethodsNoArgsPeerServiceEnabled() Tag::TARGET_HOST => $this->host, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', 'peer.service' => $this->host, '_dd.peer.service.source' => Tag::TARGET_HOST, @@ -346,7 +350,7 @@ public function testSelect() 'redis', "Redis.select" )->withExactTags(['db.index' => '1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -370,6 +374,7 @@ public function testSelectPeerServiceEnabled() 'db.index' => '1', Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', 'peer.service' => $this->host, '_dd.peer.service.source' => Tag::TARGET_HOST, @@ -407,7 +412,7 @@ public function testStringCommandsSet($method, $args, $expected, $rawCommand, $i 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame($expected, $redis->get($args[0])); @@ -564,6 +569,7 @@ public function testMethodAsCommandPeerServiceEnabled() 'redis.raw_command' => 'set k1 v1', Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', 'peer.service' => $this->host, '_dd.peer.service.source' => Tag::TARGET_HOST, @@ -586,7 +592,7 @@ public function testMSet() 'redis', "Redis.mSet" )->withExactTags(['redis.raw_command' => 'mSet k1 v1 k2 v2', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $redis->get('k1')); @@ -608,7 +614,7 @@ public function testMSetNx() 'redis', "Redis.mSetNx" )->withExactTags(['redis.raw_command' => 'mSetNx k1 v1 k2 v2', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $redis->get('k1')); @@ -630,7 +636,7 @@ public function testRawCommand() 'redis', "Redis.rawCommand" )->withExactTags(['redis.raw_command' => 'rawCommand set k1 v1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $redis->get('k1')); @@ -666,7 +672,7 @@ public function testCommandsWithResult($method, $args, $expected, $rawCommand, a 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame($expected, $result); } @@ -789,7 +795,7 @@ public function testHashFunctions($method, $args, $expectedResult, $expectedFina 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame($expectedResult, $result); @@ -939,7 +945,7 @@ public function testListFunctions($method, $args, $expectedResult, $expectedFina 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame($expectedResult, $result); @@ -1210,7 +1216,7 @@ public function testSetFunctions($method, $args, $expectedResult, $expectedFinal 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); if ($expectedResult === self::A_STRING) { @@ -1407,7 +1413,7 @@ public function testSortedSetFunctions($method, $args, $expectedResult, $expecte 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); if ($expectedResult === self::A_STRING) { @@ -1639,7 +1645,7 @@ public function testPublish() 'redis', "Redis.publish" )->withExactTags(['redis.raw_command' => 'publish ch1 hi', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -1659,28 +1665,28 @@ public function testTransactions() 'redis', "Redis.multi" )->withExactTags(['redis.raw_command' => 'multi', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), SpanAssertion::build( "Redis.set", 'phpredis', 'redis', "Redis.set" )->withExactTags(['redis.raw_command' => 'set k1 v1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), SpanAssertion::build( "Redis.get", 'phpredis', 'redis', "Redis.get" )->withExactTags(['redis.raw_command' => 'get k1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), SpanAssertion::build( "Redis.exec", 'phpredis', 'redis', "Redis.exec" )->withExactTags(['redis.raw_command' => 'exec', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -1714,7 +1720,7 @@ public function testScriptingFunctions($method, $args, $expectedResult, /*$expec 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertEquals($expectedResult, $result); } @@ -1793,7 +1799,7 @@ public function testIntrospectionFunctions($method, $args, $expectedResult, /*$e 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertEquals($expectedResult, $result); } @@ -1857,14 +1863,14 @@ public function testDumpRestore() 'redis', "Redis.dump" )->withExactTags(['redis.raw_command' => 'dump k1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), SpanAssertion::build( "Redis.restore", 'phpredis', 'redis', "Redis.restore" )->withExactTags([Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $redis->get('k1')); @@ -1891,7 +1897,7 @@ public function testMigrate() 'redis', "Redis.migrate" )->withExactTags(['redis.raw_command' => "migrate redis-integration 6380 k1 0 3600", Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $traces = $this->isolateTracer(function () { @@ -1904,7 +1910,7 @@ public function testMigrate() 'redis', "Redis.migrate" )->withExactTags(['redis.raw_command' => "migrate redis-integration 6380 k2 k3 0 3600", Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $this->redisSecondInstance->get('k1')); @@ -1931,7 +1937,7 @@ public function testMove() 'redis', "Redis.move" )->withExactTags(['redis.raw_command' => "move k1 1", Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertSame('v1', $this->redis->get('k1')); @@ -1951,7 +1957,7 @@ public function testRenameKey() 'redis', "Redis.renameKey" )->withExactTags(['redis.raw_command' => "renameKey k1 k2", Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); $this->assertFalse($this->redis->get('k1')); @@ -1989,7 +1995,7 @@ public function testGeocodingFunctions($method, $args, $expectedResult, /*$expec 'redis', "Redis.$method" )->withExactTags(['redis.raw_command' => $rawCommand, Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); if ($expectedResult === self::A_FLOAT) { @@ -2065,7 +2071,7 @@ public function testStreamsFunctions() 'redis', "Redis.xAdd" )->withExactTags(['redis.raw_command' => 'xAdd s1 123-456 k1 v1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xGroup @@ -2080,7 +2086,7 @@ public function testStreamsFunctions() 'redis', "Redis.xGroup" )->withExactTags(['redis.raw_command' => 'xGroup CREATE s1 group1 0', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xInfo @@ -2095,7 +2101,7 @@ public function testStreamsFunctions() 'redis', "Redis.xInfo" )->withExactTags(['redis.raw_command' => 'xInfo GROUPS s1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xLen @@ -2110,7 +2116,7 @@ public function testStreamsFunctions() 'redis', "Redis.xLen" )->withExactTags(['redis.raw_command' => 'xLen s1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xPending @@ -2125,7 +2131,7 @@ public function testStreamsFunctions() 'redis', "Redis.xPending" )->withExactTags(['redis.raw_command' => 'xPending s1 group1', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xRange @@ -2140,7 +2146,7 @@ public function testStreamsFunctions() 'redis', "Redis.xRange" )->withExactTags(['redis.raw_command' => 'xRange s1 - +', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xRevRange @@ -2155,7 +2161,7 @@ public function testStreamsFunctions() 'redis', "Redis.xRevRange" )->withExactTags(['redis.raw_command' => 'xRevRange s1 + -', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xRead @@ -2170,7 +2176,7 @@ public function testStreamsFunctions() 'redis', "Redis.xRead" )->withExactTags(['redis.raw_command' => 'xRead s1 $', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xReadGroup @@ -2185,7 +2191,7 @@ public function testStreamsFunctions() 'redis', "Redis.xReadGroup" )->withExactTags(['redis.raw_command' => 'xReadGroup group1 consumer1 s1 >', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xAck @@ -2200,7 +2206,7 @@ public function testStreamsFunctions() 'redis', "Redis.xAck" )->withExactTags(['redis.raw_command' => 'xAck s1 group1 s1 123-456', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xClaim @@ -2215,7 +2221,7 @@ public function testStreamsFunctions() 'redis', "Redis.xClaim" )->withExactTags(['redis.raw_command' => 'xClaim s1 group1 consumer1 0 s1 123-456', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xDel @@ -2230,7 +2236,7 @@ public function testStreamsFunctions() 'redis', "Redis.xDel" )->withExactTags(['redis.raw_command' => 'xDel s1 123-456', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); // xTrim @@ -2245,7 +2251,7 @@ public function testStreamsFunctions() 'redis', "Redis.xTrim" )->withExactTags(['redis.raw_command' => 'xTrim s1 0', Tag::SPAN_KIND => 'client', - Tag::COMPONENT => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), + Tag::COMPONENT => 'phpredis', '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', Tag::TARGET_HOST => $this->host]), ]); } @@ -2274,6 +2280,7 @@ public function testSplitByDomainWhenError() Tag::TARGET_HOST => 'non-existing-host', 'out.port' => $this->port, Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -2301,6 +2308,7 @@ public function testSplitByDomainWhenSuccess() Tag::TARGET_PORT => $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), SpanAssertion::build( @@ -2314,6 +2322,7 @@ public function testSplitByDomainWhenSuccess() Tag::TARGET_HOST => $this->host, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'opt.redis_client_split_by_host', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -2335,6 +2344,7 @@ public function testSetGetWithBinarySafeStringsAsValue() )->withExactTags([ Tag::TARGET_HOST => $this->host, Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ]) ->withExistingTagsNames(['redis.raw_command', Tag::SPAN_KIND]), @@ -2346,6 +2356,7 @@ public function testSetGetWithBinarySafeStringsAsValue() )->withExactTags([ Tag::TARGET_HOST => $this->host, Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ])->withExistingTagsNames(['redis.raw_command', Tag::SPAN_KIND]), ]); @@ -2368,6 +2379,7 @@ public function testSetGetWithBinarySafeStringsAsKey() )->withExactTags([ Tag::TARGET_HOST => $this->host, Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ])->withExistingTagsNames(['redis.raw_command', Tag::SPAN_KIND]), SpanAssertion::build( @@ -2378,6 +2390,7 @@ public function testSetGetWithBinarySafeStringsAsKey() )->withExactTags([ Tag::TARGET_HOST => $this->host, Tag::COMPONENT => 'phpredis', + '_dd.svc_src' => 'phpredis', Tag::DB_SYSTEM => 'redis', ])->withExistingTagsNames(['redis.raw_command', Tag::SPAN_KIND]), ]); diff --git a/tests/Integrations/Predis/Latest/PredisTest.php b/tests/Integrations/Predis/Latest/PredisTest.php index 756ecffe486..e7171106a9b 100644 --- a/tests/Integrations/Predis/Latest/PredisTest.php +++ b/tests/Integrations/Predis/Latest/PredisTest.php @@ -184,6 +184,7 @@ public function testPredisClusterConnect() ->withExactTags([ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'predis', + '_dd.svc_src' => 'redis', Tag::DB_SYSTEM => 'redis', ]), ]); @@ -257,6 +258,7 @@ public function testPredisPipeline() $exactTags = [ Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'predis', + '_dd.svc_src' => 'redis', Tag::DB_SYSTEM => 'redis', 'redis.pipeline_length' => '2', Tag::TARGET_HOST => $this->host, @@ -380,18 +382,22 @@ public function testNoFakeServices() $this->assertFlameGraph($traces, [ SpanAssertion::exists('Predis.Client.__construct'), SpanAssertion::build('Predis.Client.connect', 'configured_service', 'redis', 'Predis.Client.connect') - ->withExactTags($this->baseTags()), + ->withExactTags($this->baseTags(null)), ]); } - private function baseTags() + private function baseTags($svcSrc = 'redis') { - return [ + $tags = [ 'out.host' => $this->host, 'out.port' => $this->port, Tag::SPAN_KIND => 'client', Tag::COMPONENT => 'predis', Tag::DB_SYSTEM => 'redis', ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } + return $tags; } } \ No newline at end of file diff --git a/tests/Integrations/Ratchet/V0_4/RatchetTest.php b/tests/Integrations/Ratchet/V0_4/RatchetTest.php index ac6dd8ab67c..cca875d9a12 100644 --- a/tests/Integrations/Ratchet/V0_4/RatchetTest.php +++ b/tests/Integrations/Ratchet/V0_4/RatchetTest.php @@ -84,6 +84,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'producer', 'component' => 'ratchet', + '_dd.svc_src' => 'm', 'websocket.message.type' => 'text', ]) ->withExactMetrics([ @@ -95,6 +96,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'client', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'http.method' => 'GET', 'http.url' => 'ws://127.0.0.1:%d', 'network.destination.name' => '127.0.0.1', @@ -106,6 +108,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'consumer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.close.code' => '1000', '_dd.dm.service' => 'ratchet', '_dd.dm.resource' => 'GET /', @@ -121,6 +124,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'producer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.close.code' => '1000', ]) ->withExistingTagsNames(["_dd.span_links"]) @@ -129,6 +133,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'consumer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', '_dd.dm.service' => 'ratchet', '_dd.dm.resource' => 'GET /', @@ -146,6 +151,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'producer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', ]) ->withExactMetrics([ @@ -158,6 +164,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'consumer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', '_dd.dm.service' => 'phpunit', '_dd.dm.resource' => '', @@ -175,6 +182,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'producer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', ]) ->withExactMetrics([ @@ -187,6 +195,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'consumer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', '_dd.dm.service' => 'ratchet', '_dd.dm.resource' => 'GET /', @@ -204,6 +213,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { ->withExactTags([ 'span.kind' => 'producer', 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'websocket.message.type' => 'text', ]) ->withExactMetrics([ @@ -215,6 +225,7 @@ public function onError(ConnectionInterface $conn, \Exception $e) { SpanAssertion::build('web.request', 'ratchet', 'web', 'GET /') ->withExactTags([ 'component' => 'ratchet', + '_dd.svc_src' => 'ratchet', 'span.kind' => 'server', 'http.url' => 'http://127.0.0.1:%d/', 'http.method' => 'GET', @@ -244,6 +255,7 @@ public function testRatchetConnectFail() ->withExactTags([ "span.kind" => "client", "component" => "ratchet", + "_dd.svc_src" => "ratchet", "http.method" => "GET", "http.url" => "ws://127.0.0.1:1", "network.destination.name" => "127.0.0.1", diff --git a/tests/Integrations/Roadrunner/V2/CommonScenariosTest.php b/tests/Integrations/Roadrunner/V2/CommonScenariosTest.php index abfb1694416..e97f4275a9d 100644 --- a/tests/Integrations/Roadrunner/V2/CommonScenariosTest.php +++ b/tests/Integrations/Roadrunner/V2/CommonScenariosTest.php @@ -59,7 +59,8 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'roadrunner' + Tag::COMPONENT => 'roadrunner', + '_dd.svc_src' => 'roadrunner', ]), ], 'A simple GET request with a view' => [ @@ -73,7 +74,8 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple_view?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'roadrunner' + Tag::COMPONENT => 'roadrunner', + '_dd.svc_src' => 'roadrunner', ]), ], 'A GET request with an exception' => [ @@ -88,7 +90,8 @@ public function provideSpecs() 'http.status_code' => '500', 'error.stack' => '#0 {main}', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'roadrunner' + Tag::COMPONENT => 'roadrunner', + '_dd.svc_src' => 'roadrunner', ])->setError('Exception', 'Uncaught Exception: Error page'), ], ] diff --git a/tests/Integrations/SQLSRV/SQLSRVTest.php b/tests/Integrations/SQLSRV/SQLSRVTest.php index 7c82bb55a54..70b85ff515d 100644 --- a/tests/Integrations/SQLSRV/SQLSRVTest.php +++ b/tests/Integrations/SQLSRV/SQLSRVTest.php @@ -527,7 +527,7 @@ public function testNoFakeServices() $this->assertFlameGraph($traces, [ SpanAssertion::exists('sqlsrv_connect'), SpanAssertion::build('sqlsrv_query', 'configured_service', 'sql', $query) - ->withExactTags(self::baseTags($query)) + ->withExactTags(self::baseTags($query, false, null)) ->withExactMetrics([ Tag::DB_ROW_COUNT => 1.0, Tag::ANALYTICS_KEY => 1.0, @@ -576,7 +576,7 @@ private function assertOneRowInDatabase($table, $wheres) $this->assertCount(1, $results); } - private static function baseTags($query = null, $expectPeerService = false) + private static function baseTags($query = null, $expectPeerService = false, $svcSrc = SQLSRVIntegration::NAME) { $tags = [ Tag::SPAN_KIND => 'client', @@ -588,6 +588,10 @@ private static function baseTags($query = null, $expectPeerService = false) Tag::TARGET_PORT => self::$port, ]; + if ($svcSrc !== null) { + $tags['_dd.svc_src'] = $svcSrc; + } + if ($expectPeerService) { $tags['peer.service'] = 'master'; $tags['_dd.peer.service.source'] = 'db.instance'; diff --git a/tests/Integrations/Slim/Latest/CommonScenariosTest.php b/tests/Integrations/Slim/Latest/CommonScenariosTest.php index 518893567cc..e801ed8b350 100644 --- a/tests/Integrations/Slim/Latest/CommonScenariosTest.php +++ b/tests/Integrations/Slim/Latest/CommonScenariosTest.php @@ -50,7 +50,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\\Middleware\\ErrorMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.middleware', @@ -58,7 +58,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\Middleware\RoutingMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.middleware', @@ -66,7 +66,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\\Views\\TwigMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ]) ->withChildren($children) ->withExistingTagsNames(['error.stack']) @@ -80,7 +80,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\\Middleware\\ErrorMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.middleware', @@ -88,7 +88,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\Middleware\RoutingMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.middleware', @@ -96,7 +96,7 @@ private function wrapMiddleware(array $children, array $setError = []): SpanAsse 'web', 'Slim\\Views\\TwigMiddleware' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren($children) ]), ]); @@ -158,7 +158,7 @@ public function provideSpecs() 'web', 'Closure::__invoke' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.view', diff --git a/tests/Integrations/Slim/V3_12/CommonScenariosTest.php b/tests/Integrations/Slim/V3_12/CommonScenariosTest.php index 7c76d08c81c..b97d16527f0 100644 --- a/tests/Integrations/Slim/V3_12/CommonScenariosTest.php +++ b/tests/Integrations/Slim/V3_12/CommonScenariosTest.php @@ -66,7 +66,7 @@ public function provideSpecs() 'web', 'Closure::__invoke' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ]) ]), ], @@ -91,7 +91,7 @@ public function provideSpecs() 'web', 'App\SimpleViewController::index' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withChildren([ SpanAssertion::build( 'slim.view', @@ -100,7 +100,7 @@ public function provideSpecs() 'simple_view.phtml' )->withExactTags([ 'slim.view' => 'simple_view.phtml', - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ]) ]) ]), @@ -127,7 +127,7 @@ public function provideSpecs() 'web', 'Closure::__invoke' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ])->withExistingTagsNames([ 'error.stack', ])->setError(null, 'Foo error') @@ -154,7 +154,7 @@ public function provideSpecs() 'web', 'Closure::__invoke' )->withExactTags([ - Tag::COMPONENT => 'slim' + Tag::COMPONENT => 'slim', ]) ]), ], diff --git a/tests/Integrations/Swoole/CommonScenariosTest.php b/tests/Integrations/Swoole/CommonScenariosTest.php index 22d173b7754..d72e0702665 100644 --- a/tests/Integrations/Swoole/CommonScenariosTest.php +++ b/tests/Integrations/Swoole/CommonScenariosTest.php @@ -74,7 +74,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'swoole' + Tag::COMPONENT => 'swoole', ]), ], 'A simple GET request with a view' => [ @@ -88,7 +88,7 @@ public function provideSpecs() 'http.url' => 'http://localhost/simple_view?key=value&', 'http.status_code' => '200', Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'swoole' + Tag::COMPONENT => 'swoole', ]), ], 'A GET request with an exception' => [ @@ -103,7 +103,7 @@ public function provideSpecs() 'http.status_code' => '500', 'error.stack' => (PHP_VERSION_ID >= 80400 ? "#0 [internal function]: {closure:" . dirname(__DIR__, 2) . "/Frameworks/Swoole/index.php:9}()" : "#0 [internal function]: {closure}()") . "\n#1 {main}", Tag::SPAN_KIND => 'server', - Tag::COMPONENT => 'swoole' + Tag::COMPONENT => 'swoole', ])->setError('Exception', 'Uncaught Exception: Error page'), ], ] diff --git a/tests/Integrations/Symfony/V3_0/CommonScenariosTest.php b/tests/Integrations/Symfony/V3_0/CommonScenariosTest.php index bf31b5b6c1c..6170e3069e6 100644 --- a/tests/Integrations/Symfony/V3_0/CommonScenariosTest.php +++ b/tests/Integrations/Symfony/V3_0/CommonScenariosTest.php @@ -57,6 +57,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -72,6 +73,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), @@ -94,6 +96,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -109,6 +112,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::simpleViewAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -117,6 +121,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\TwigEngine twig_template.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), @@ -140,6 +145,7 @@ public function provideSpecs() 'http.status_code' => '500', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']) @@ -158,6 +164,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::errorAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']), @@ -172,6 +179,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -180,6 +188,7 @@ public function provideSpecs() 'Twig\Environment @Twig/Exception/error.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), @@ -206,6 +215,7 @@ public function provideSpecs() 'http.status_code' => '404', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -223,6 +233,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -231,6 +242,7 @@ public function provideSpecs() 'Twig\Environment @Twig/Exception/error.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), diff --git a/tests/Integrations/Symfony/V3_0/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V3_0/TraceSearchConfigTest.php index fce6cd51b0d..29535f468ea 100644 --- a/tests/Integrations/Symfony/V3_0/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V3_0/TraceSearchConfigTest.php @@ -47,6 +47,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, diff --git a/tests/Integrations/Symfony/V3_3/CommonScenariosTest.php b/tests/Integrations/Symfony/V3_3/CommonScenariosTest.php index a26e9ddb1e8..9641cbf0767 100644 --- a/tests/Integrations/Symfony/V3_3/CommonScenariosTest.php +++ b/tests/Integrations/Symfony/V3_3/CommonScenariosTest.php @@ -58,6 +58,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -74,6 +75,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), @@ -97,6 +99,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -113,6 +116,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::simpleViewAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -121,6 +125,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\TwigEngine twig_template.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), @@ -145,6 +150,7 @@ public function provideSpecs() 'http.status_code' => '500', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']) @@ -165,6 +171,7 @@ public function provideSpecs() 'AppBundle\Controller\CommonScenariosController::errorAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]) ->setError('Exception', 'An exception occurred') ->withExistingTagsNames(['error.stack']), @@ -180,6 +187,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -188,6 +196,7 @@ public function provideSpecs() 'Twig\Environment @Twig/Exception/error.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), @@ -213,6 +222,7 @@ public function provideSpecs() 'http.status_code' => '404', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.kernel.terminate'), SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ @@ -232,6 +242,7 @@ public function provideSpecs() 'Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -240,6 +251,7 @@ public function provideSpecs() 'Twig\Environment @Twig/Exception/error.html.twig' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), diff --git a/tests/Integrations/Symfony/V3_3/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V3_3/TraceSearchConfigTest.php index 18ee9b4e40f..5483d95fb44 100644 --- a/tests/Integrations/Symfony/V3_3/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V3_3/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'AppBundle\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/Symfony/V3_4/AutofinishedTracesSymfony34Test.php b/tests/Integrations/Symfony/V3_4/AutofinishedTracesSymfony34Test.php index 502ef641cb5..b74a1774c79 100644 --- a/tests/Integrations/Symfony/V3_4/AutofinishedTracesSymfony34Test.php +++ b/tests/Integrations/Symfony/V3_4/AutofinishedTracesSymfony34Test.php @@ -42,6 +42,7 @@ public function testEndpointThatExitsWithNoProcess() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -58,6 +59,7 @@ public function testEndpointThatExitsWithNoProcess() 'AppBundle\Controller\HomeController::actionBeingTerminatedByExit' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), ]), diff --git a/tests/Integrations/Symfony/V3_4/TemplateEnginesTest.php b/tests/Integrations/Symfony/V3_4/TemplateEnginesTest.php index f489dd21b65..9a730a1fb7e 100644 --- a/tests/Integrations/Symfony/V3_4/TemplateEnginesTest.php +++ b/tests/Integrations/Symfony/V3_4/TemplateEnginesTest.php @@ -35,6 +35,7 @@ public function testAlternateTemplatingEngine() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.handle')->withChildren([ SpanAssertion::exists('symfony.httpkernel.kernel.boot'), @@ -51,6 +52,7 @@ public function testAlternateTemplatingEngine() 'AppBundle\Controller\HomeController::indexAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withChildren([ SpanAssertion::build( 'symfony.templating.render', @@ -59,6 +61,7 @@ public function testAlternateTemplatingEngine() 'Symfony\Component\Templating\PhpEngine php_template.template.php' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), ]), SpanAssertion::exists('symfony.kernel.response'), diff --git a/tests/Integrations/Symfony/V3_4/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V3_4/TraceSearchConfigTest.php index 5a935f3f418..e8691e90edc 100644 --- a/tests/Integrations/Symfony/V3_4/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V3_4/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -69,6 +70,7 @@ public function testScenario() 'AppBundle\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/Symfony/V4_0/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V4_0/TraceSearchConfigTest.php index 58f1fd1d3fc..c92a93e9242 100644 --- a/tests/Integrations/Symfony/V4_0/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V4_0/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -69,6 +70,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/Symfony/V4_2/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V4_2/TraceSearchConfigTest.php index 7e9e65af416..3e24e5bd015 100644 --- a/tests/Integrations/Symfony/V4_2/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V4_2/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -70,6 +71,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/Symfony/V4_4/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V4_4/TraceSearchConfigTest.php index b8d19825ae1..ccf749e2c2b 100644 --- a/tests/Integrations/Symfony/V4_4/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V4_4/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response')->withChildren([ SpanAssertion::exists('symfony.security.authentication.success') diff --git a/tests/Integrations/Symfony/V5_0/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V5_0/TraceSearchConfigTest.php index ec770d82aa2..7c9cbfee07a 100644 --- a/tests/Integrations/Symfony/V5_0/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V5_0/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response')->withChildren([ SpanAssertion::exists('symfony.security.authentication.success') diff --git a/tests/Integrations/Symfony/V5_1/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V5_1/TraceSearchConfigTest.php index c21391ed740..5044eafd656 100644 --- a/tests/Integrations/Symfony/V5_1/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V5_1/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response')->withChildren([ SpanAssertion::exists('symfony.security.authentication.success') diff --git a/tests/Integrations/Symfony/V5_2/ConsoleCommandTest.php b/tests/Integrations/Symfony/V5_2/ConsoleCommandTest.php index a9f29828855..cbae029cfe1 100644 --- a/tests/Integrations/Symfony/V5_2/ConsoleCommandTest.php +++ b/tests/Integrations/Symfony/V5_2/ConsoleCommandTest.php @@ -34,6 +34,7 @@ public function testScenario() ->withExactTags([ 'symfony.console.command.class' => 'Symfony\Bundle\FrameworkBundle\Command\AboutCommand', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console' ]), SpanAssertion::exists('symfony.console.command', 'symfony.console.command'), diff --git a/tests/Integrations/Symfony/V5_2/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V5_2/TraceSearchConfigTest.php index 74442c9c0a6..1a622ae42b4 100644 --- a/tests/Integrations/Symfony/V5_2/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V5_2/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/Symfony/V6_2/ConsoleCommandTest.php b/tests/Integrations/Symfony/V6_2/ConsoleCommandTest.php index 34ce7741c9f..7024e4ba9ff 100644 --- a/tests/Integrations/Symfony/V6_2/ConsoleCommandTest.php +++ b/tests/Integrations/Symfony/V6_2/ConsoleCommandTest.php @@ -34,6 +34,7 @@ public function testScenario() ->withExactTags([ 'symfony.console.command.class' => 'Symfony\Bundle\FrameworkBundle\Command\AboutCommand', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', '_dd.base_service' => 'console' ]), SpanAssertion::exists('symfony.console.command', 'symfony.console.command'), diff --git a/tests/Integrations/Symfony/V6_2/TraceSearchConfigTest.php b/tests/Integrations/Symfony/V6_2/TraceSearchConfigTest.php index 7a2465b39d3..aaf2f4acc85 100644 --- a/tests/Integrations/Symfony/V6_2/TraceSearchConfigTest.php +++ b/tests/Integrations/Symfony/V6_2/TraceSearchConfigTest.php @@ -48,6 +48,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ])->withExactMetrics([ '_dd1.sr.eausr' => 0.3, '_sampling_priority_v1' => 1, @@ -67,6 +68,7 @@ public function testScenario() 'App\Controller\CommonScenariosController::simpleAction' )->withExactTags([ Tag::COMPONENT => 'symfony', + '_dd.svc_src' => 'symfony', ]), SpanAssertion::exists('symfony.kernel.response'), SpanAssertion::exists('symfony.kernel.finish_request'), diff --git a/tests/Integrations/ZendFramework/V1/CommonScenariosTest.php b/tests/Integrations/ZendFramework/V1/CommonScenariosTest.php index dbb9bbd8701..a2b52b6920c 100644 --- a/tests/Integrations/ZendFramework/V1/CommonScenariosTest.php +++ b/tests/Integrations/ZendFramework/V1/CommonScenariosTest.php @@ -62,6 +62,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ]), ], 'A simple GET request with a view' => [ @@ -75,6 +76,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ]), ], 'A GET request with an exception' => [ @@ -88,6 +90,7 @@ public function provideSpecs() 'http.status_code' => '500', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ])->setError('Exception', 'Controller error', true), ], ]; diff --git a/tests/Integrations/ZendFramework/V1/TraceSearchConfigTest.php b/tests/Integrations/ZendFramework/V1/TraceSearchConfigTest.php index e220a1f44db..46e1e6cd791 100644 --- a/tests/Integrations/ZendFramework/V1/TraceSearchConfigTest.php +++ b/tests/Integrations/ZendFramework/V1/TraceSearchConfigTest.php @@ -44,6 +44,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'zendframework', + '_dd.svc_src' => 'zf1', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, diff --git a/tests/Integrations/ZendFramework/V1_21/CommonScenariosTest.php b/tests/Integrations/ZendFramework/V1_21/CommonScenariosTest.php index b589958c615..5837b868ca0 100644 --- a/tests/Integrations/ZendFramework/V1_21/CommonScenariosTest.php +++ b/tests/Integrations/ZendFramework/V1_21/CommonScenariosTest.php @@ -53,6 +53,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ]), ], 'A simple GET request with a view' => [ @@ -66,6 +67,7 @@ public function provideSpecs() 'http.status_code' => '200', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ]), ], 'A GET request with an exception' => [ @@ -79,6 +81,7 @@ public function provideSpecs() 'http.status_code' => '500', Tag::SPAN_KIND => "server", Tag::COMPONENT => "zendframework", + '_dd.svc_src' => 'zf1', ]) ->setError('Exception', 'Controller error', true) ], diff --git a/tests/Integrations/ZendFramework/V1_21/TraceSearchConfigTest.php b/tests/Integrations/ZendFramework/V1_21/TraceSearchConfigTest.php index da6a6703508..d2dc2c12f05 100644 --- a/tests/Integrations/ZendFramework/V1_21/TraceSearchConfigTest.php +++ b/tests/Integrations/ZendFramework/V1_21/TraceSearchConfigTest.php @@ -44,6 +44,7 @@ public function testScenario() 'http.status_code' => '200', Tag::SPAN_KIND => 'server', Tag::COMPONENT => 'zendframework', + '_dd.svc_src' => 'zf1', ]) ->withExactMetrics([ '_dd1.sr.eausr' => 0.3, diff --git a/tests/ext/base_service.phpt b/tests/ext/base_service.phpt index 7ac5a5096da..a775ec2358f 100644 --- a/tests/ext/base_service.phpt +++ b/tests/ext/base_service.phpt @@ -38,9 +38,11 @@ array(1) { ["type"]=> string(3) "cli" ["meta"]=> - array(1) { + array(2) { ["_dd.base_service"]=> string(16) "base_service.php" + ["_dd.svc_src"]=> + string(1) "m" } } } diff --git a/tests/ext/sandbox-prehook/dd_trace_method.phpt b/tests/ext/sandbox-prehook/dd_trace_method.phpt index 0739a4d305d..e7ea5c45418 100644 --- a/tests/ext/sandbox-prehook/dd_trace_method.phpt +++ b/tests/ext/sandbox-prehook/dd_trace_method.phpt @@ -113,11 +113,13 @@ array(3) { ["type"]=> string(7) "FooType" ["meta"]=> - array(4) { + array(5) { ["_dd.p.dm"]=> string(2) "-0" ["_dd.p.tid"]=> string(16) "%s" + ["_dd.svc_src"]=> + string(1) "m" ["args.0"]=> string(18) "tracing is awesome" ["runtime-id"]=> diff --git a/tests/ext/sandbox/dd_trace_function_alias.phpt b/tests/ext/sandbox/dd_trace_function_alias.phpt index 9b13e187dec..c1930fcd475 100644 --- a/tests/ext/sandbox/dd_trace_function_alias.phpt +++ b/tests/ext/sandbox/dd_trace_function_alias.phpt @@ -29,4 +29,5 @@ spans(\DDTrace\SpanData) (1) { bar (alias, bar, cli) _dd.p.dm => -0 _dd.p.tid => %s + _dd.svc_src => m } diff --git a/tests/ext/sandbox/dd_trace_function_complex.phpt b/tests/ext/sandbox/dd_trace_function_complex.phpt index 45ee2324028..2de41a7c64c 100644 --- a/tests/ext/sandbox/dd_trace_function_complex.phpt +++ b/tests/ext/sandbox/dd_trace_function_complex.phpt @@ -114,11 +114,13 @@ array(5) { ["type"]=> string(7) "BarType" ["meta"]=> - array(7) { + array(8) { ["_dd.p.dm"]=> string(2) "-0" ["_dd.p.tid"]=> string(16) "%s" + ["_dd.svc_src"]=> + string(1) "m" ["args.0"]=> string(18) "tracing is awesome" ["retval.first"]=> diff --git a/tests/ext/sandbox/dd_trace_method.phpt b/tests/ext/sandbox/dd_trace_method.phpt index a46b65291fb..16762177c00 100644 --- a/tests/ext/sandbox/dd_trace_method.phpt +++ b/tests/ext/sandbox/dd_trace_method.phpt @@ -122,11 +122,13 @@ array(3) { ["type"]=> string(7) "FooType" ["meta"]=> - array(7) { + array(8) { ["_dd.p.dm"]=> string(2) "-0" ["_dd.p.tid"]=> string(16) "%s" + ["_dd.svc_src"]=> + string(1) "m" ["args.0"]=> string(18) "tracing is awesome" ["retval.first"]=> diff --git a/tests/ext/sandbox/dd_trace_method_alias.phpt b/tests/ext/sandbox/dd_trace_method_alias.phpt index c2c7df7a000..931b038444a 100644 --- a/tests/ext/sandbox/dd_trace_method_alias.phpt +++ b/tests/ext/sandbox/dd_trace_method_alias.phpt @@ -33,4 +33,5 @@ spans(\DDTrace\SpanData) (1) { Foo.bar (alias, Foo.bar, cli) _dd.p.dm => -0 _dd.p.tid => %s + _dd.svc_src => m } diff --git a/tests/ext/start_span_with_all_properties.phpt b/tests/ext/start_span_with_all_properties.phpt index 894594d90b7..4ce1682c97a 100644 --- a/tests/ext/start_span_with_all_properties.phpt +++ b/tests/ext/start_span_with_all_properties.phpt @@ -119,11 +119,13 @@ array(2) { ["type"]=> string(6) "runner" ["meta"]=> - array(4) { + array(5) { ["_dd.p.dm"]=> string(2) "-0" ["_dd.p.tid"]=> string(16) "%s" + ["_dd.svc_src"]=> + string(1) "m" ["aa"]=> string(2) "bb" ["runtime-id"]=> diff --git a/tests/ext/svc_src_default_cleared.phpt b/tests/ext/svc_src_default_cleared.phpt new file mode 100644 index 00000000000..5579835e091 --- /dev/null +++ b/tests/ext/svc_src_default_cleared.phpt @@ -0,0 +1,29 @@ +--TEST-- +Default service name (DD_SERVICE or auto-resolved) leaves _dd.svc_src cleared +--ENV-- +DD_SERVICE=my-app +DD_TRACE_GENERATE_ROOT_SPAN=0 +DD_TRACE_AUTO_FLUSH_ENABLED=0 +--FILE-- +name = 'root'; + +$child = \DDTrace\start_span(); +$child->name = 'child'; + +\DDTrace\close_span(); +\DDTrace\close_span(); + +$byName = []; +foreach (dd_trace_serialize_closed_spans() as $s) { $byName[$s['name']] = $s; } +echo "root service: " . $byName['root']['service'] . "\n"; +echo "child service: " . $byName['child']['service'] . "\n"; +echo "root svc_src: " . ($byName['root']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +echo "child svc_src: " . ($byName['child']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +?> +--EXPECT-- +root service: my-app +child service: my-app +root svc_src: (unset) +child svc_src: (unset) diff --git a/tests/ext/svc_src_inheritance.phpt b/tests/ext/svc_src_inheritance.phpt new file mode 100644 index 00000000000..0e339b5a4a9 --- /dev/null +++ b/tests/ext/svc_src_inheritance.phpt @@ -0,0 +1,26 @@ +--TEST-- +Child spans inherit _dd.svc_src from parent at creation time +--ENV-- +DD_TRACE_GENERATE_ROOT_SPAN=0 +DD_TRACE_AUTO_FLUSH_ENABLED=0 +--FILE-- +name = 'root'; +$root->service = 'redis-srv'; +$root->meta['_dd.svc_src'] = 'redis'; + +$child = \DDTrace\start_span(); +$child->name = 'child'; + +\DDTrace\close_span(); +\DDTrace\close_span(); + +$byName = []; +foreach (dd_trace_serialize_closed_spans() as $s) { $byName[$s['name']] = $s; } +echo "root svc_src: " . ($byName['root']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +echo "child svc_src: " . ($byName['child']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +?> +--EXPECT-- +root svc_src: redis +child svc_src: redis diff --git a/tests/ext/svc_src_manual_override.phpt b/tests/ext/svc_src_manual_override.phpt new file mode 100644 index 00000000000..07527277bfe --- /dev/null +++ b/tests/ext/svc_src_manual_override.phpt @@ -0,0 +1,26 @@ +--TEST-- +Manual override of span service produces _dd.svc_src = 'm' +--ENV-- +DD_TRACE_GENERATE_ROOT_SPAN=0 +DD_TRACE_AUTO_FLUSH_ENABLED=0 +--FILE-- +name = 'root'; +$root->service = 'app'; + +$child = \DDTrace\start_span(); +$child->name = 'child'; +$child->service = 'overridden'; + +\DDTrace\close_span(); +\DDTrace\close_span(); + +$byName = []; +foreach (dd_trace_serialize_closed_spans() as $s) { $byName[$s['name']] = $s; } +echo "root svc_src: " . ($byName['root']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +echo "child svc_src: " . ($byName['child']['meta']['_dd.svc_src'] ?? '(unset)') . "\n"; +?> +--EXPECT-- +root svc_src: m +child svc_src: m diff --git a/tests/ext/test_special_attributes.phpt b/tests/ext/test_special_attributes.phpt index b898e91253e..1539e37ff7e 100644 --- a/tests/ext/test_special_attributes.phpt +++ b/tests/ext/test_special_attributes.phpt @@ -53,9 +53,11 @@ array(1) { ["type"]=> string(8) "new.type" ["meta"]=> - array(1) { + array(2) { ["_dd.base_service"]=> string(27) "test_special_attributes.php" + ["_dd.svc_src"]=> + string(1) "m" } ["metrics"]=> array(1) { diff --git a/tests/ext/test_special_attributes_bis.phpt b/tests/ext/test_special_attributes_bis.phpt index 210608393ce..d08ff85c7bf 100644 --- a/tests/ext/test_special_attributes_bis.phpt +++ b/tests/ext/test_special_attributes_bis.phpt @@ -54,9 +54,11 @@ array(1) { ["type"]=> string(8) "new.type" ["meta"]=> - array(1) { + array(2) { ["_dd.base_service"]=> string(31) "test_special_attributes_bis.php" + ["_dd.svc_src"]=> + string(1) "m" } ["metrics"]=> array(1) { diff --git a/tests/ext/traced_attribute.phpt b/tests/ext/traced_attribute.phpt index 8cf929ab422..cbc2dfafd50 100644 --- a/tests/ext/traced_attribute.phpt +++ b/tests/ext/traced_attribute.phpt @@ -79,6 +79,7 @@ spans(\DDTrace\SpanData) (3) { _dd.code_origin.frames.2.file => %s _dd.code_origin.frames.2.line => 40 _dd.code_origin.type => exit + _dd.svc_src => m a => b data => dog recursion (traced_attribute.php, recursion, cli) diff --git a/tests/ext/ust.phpt b/tests/ext/ust.phpt index 50bd80dea3a..08e02f7387f 100644 --- a/tests/ext/ust.phpt +++ b/tests/ext/ust.phpt @@ -97,6 +97,8 @@ array(2) { string(2) "-0" ["_dd.p.tid"]=> string(16) "%s" + ["_dd.svc_src"]=> + string(1) "m" ["env"]=> string(8) "env_test" ["runtime-id"]=> diff --git a/tracer/functions.c b/tracer/functions.c index c5d0fdb203f..aca31566a7a 100644 --- a/tracer/functions.c +++ b/tracer/functions.c @@ -502,6 +502,12 @@ static zval *ddtrace_span_data_readonly(zend_object *object, zend_string *member ZVAL_EMPTY_STRING(&span->property_version); } } + if (Z_TYPE_P(value) == IS_STRING && !zend_is_identical(&span->property_service, value)) { + zend_array *meta = ddtrace_property_array(&span->property_meta); + zval val; + ZVAL_NEW_STR(&val, zend_string_init("m", 1, 0)); + zend_hash_str_update(meta, ZEND_STRL("_dd.svc_src"), &val); + } } #if PHP_VERSION_ID >= 70400 diff --git a/tracer/hook/uhook_attributes.c b/tracer/hook/uhook_attributes.c index a1e6f32fec5..82c764788c4 100644 --- a/tracer/hook/uhook_attributes.c +++ b/tracer/hook/uhook_attributes.c @@ -117,6 +117,10 @@ static void dd_fill_span_data(dd_uhook_def *def, ddtrace_span_data *span) { zval *service = &span->property_service; zval_ptr_dtor(service); ZVAL_STR_COPY(service, def->service); + zend_array *meta = ddtrace_property_array(&span->property_meta); + zval val; + ZVAL_NEW_STR(&val, zend_string_init("m", 1, 0)); + zend_hash_str_update(meta, ZEND_STRL("_dd.svc_src"), &val); } if (def->type) { zval *type = &span->property_type; diff --git a/tracer/serializer.c b/tracer/serializer.c index f85e16b23eb..8a3374a7bda 100644 --- a/tracer/serializer.c +++ b/tracer/serializer.c @@ -739,6 +739,13 @@ void ddtrace_inherit_span_properties(ddtrace_span_data *span, ddtrace_span_data zend_array *parent_meta = ddtrace_property_array(&parent->property_meta); + zval *parent_svc_src = zend_hash_str_find(parent_meta, ZEND_STRL("_dd.svc_src")); + if (parent_svc_src) { + zend_array *child_meta = ddtrace_property_array(&span->property_meta); + Z_TRY_ADDREF_P(parent_svc_src); + zend_hash_str_update(child_meta, ZEND_STRL("_dd.svc_src"), parent_svc_src); + } + zval *prop_version = &span->property_version; zval_ptr_dtor(prop_version); zval *version;