Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ZipkinBundle/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Integration/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -122,6 +124,7 @@ public function testSpanIsTaggedOnKernelException()
$this->assertArraySubset([
'tags' => [
'error' => self::EXCEPTION_MESSAGE,
'lc' => self::LOCAL_COMPONENT,
]
], $spans[0]->toArray());
}
Expand Down Expand Up @@ -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) {
Expand Down