diff --git a/src/ZipkinBundle/Middleware.php b/src/ZipkinBundle/Middleware.php index 8e5359a..6705c89 100644 --- a/src/ZipkinBundle/Middleware.php +++ b/src/ZipkinBundle/Middleware.php @@ -83,6 +83,7 @@ public function onKernelRequest(GetResponseEvent $event) $span->tag(Tags\HTTP_HOST, $request->getHost()); $span->tag(Tags\HTTP_METHOD, $request->getMethod()); $span->tag(Tags\HTTP_PATH, $request->getPathInfo()); + $span->tag(Tags\LOCAL_COMPONENT, 'symfony'); foreach ($this->tags as $key => $value) { $span->tag($key, $value); } diff --git a/tests/Integration/build.sh b/tests/Integration/build.sh index be9af5a..f6b89b8 100755 --- a/tests/Integration/build.sh +++ b/tests/Integration/build.sh @@ -4,11 +4,12 @@ APP_FOLDER=test-app SYMFONY_VERSION=${1:-dev-master} LIBRARY_BRANCH=dev-${2:-master} SAMPLER=${3:-default} +COMPOSER="$(which php) -d memory_limit=-1 /vendor/bin/composer" # Deletes old executions of the build rm -rf ${APP_FOLDER} -composer create-project symfony/website-skeleton:${SYMFONY_VERSION} ${APP_FOLDER} || exit 1 +${COMPOSER} create-project symfony/website-skeleton:${SYMFONY_VERSION} ${APP_FOLDER} || exit 1 cd ${APP_FOLDER} # Includes zipkin-instrumentation-symfony to the composer.json of the app @@ -22,7 +23,7 @@ cat composer.json.dist \ rm composer.lock -composer require symfony/web-server-bundle --dev +${COMPOSER} require symfony/web-server-bundle --dev # includes configuration files to run the middleware in the app cp ../tracing.${SAMPLER}.yaml ./config/tracing.yaml diff --git a/tests/Unit/MiddlewareTest.php b/tests/Unit/MiddlewareTest.php index 8182933..82a9409 100644 --- a/tests/Unit/MiddlewareTest.php +++ b/tests/Unit/MiddlewareTest.php @@ -24,6 +24,7 @@ class MiddlewareTest extends PHPUnit_Framework_TestCase const TAG_KEY = 'key'; const TAG_VALUE = 'value'; const EXCEPTION_MESSAGE = 'message'; + const LOCAL_COMPONENT = 'symfony'; public function testSpanIsNotCreatedOnNonMasterRequest() { @@ -71,6 +72,7 @@ public function testSpanIsCreatedOnKernelRequest() 'http.host' => self::HTTP_HOST, 'http.method' => self::HTTP_METHOD, 'http.path' => self::HTTP_PATH, + 'lc' => self::LOCAL_COMPONENT, self::TAG_KEY => self::TAG_VALUE, ] ], $spans[0]->toArray()); @@ -122,6 +124,7 @@ public function testSpanIsTaggedOnKernelException() $this->assertArraySubset([ 'tags' => [ 'error' => self::EXCEPTION_MESSAGE, + 'lc' => self::LOCAL_COMPONENT, ] ], $spans[0]->toArray()); } @@ -192,6 +195,7 @@ public function testSpanIsTaggedOnKernelTerminate($responseStatusCode) 'http.method' => self::HTTP_METHOD, 'http.path' => self::HTTP_PATH, 'http.status_code' => (string) $responseStatusCode, + 'lc' => self::LOCAL_COMPONENT, ]; if ($responseStatusCode > 399) {