Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d7ea50

Browse files
env variable setting
1 parent 35a90ae commit 8d7ea50

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/DDTrace/Integrations/Symfony/V3/SymfonyBundle.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function boot()
6060
$appName = $this->getAppName();
6161
$symfonyRequestSpan = $scope->getSpan();
6262
$symfonyRequestSpan->setTag(Tags\SERVICE_NAME, $appName);
63+
$symfonyRequestSpan->setTag(Tags\ENV, $this->getAppEnv());
6364
$symfonyRequestSpan->setTag(Tags\SPAN_TYPE, Types\WEB_SERVLET);
6465
$request = null;
6566

@@ -223,4 +224,13 @@ private function getAppName()
223224
return 'symfony';
224225
}
225226
}
227+
228+
private function getAppEnv()
229+
{
230+
if ($appName = getenv('ddtrace_app_env')) {
231+
return $appName;
232+
} else {
233+
return 'none';
234+
}
235+
}
226236
}

src/DDTrace/Integrations/Symfony/V4/SymfonyBundle.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function boot()
5757
$scope = $tracer->startActiveSpan('symfony.request');
5858
$symfonyRequestSpan = $scope->getSpan();
5959
$symfonyRequestSpan->setTag(Tags\SERVICE_NAME, $this->getAppName());
60+
$symfonyRequestSpan->setTag(Tags\ENV, $this->getAppEnv());
6061
$symfonyRequestSpan->setTag(Tags\SPAN_TYPE, Types\WEB_SERVLET);
6162

6263
// public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
@@ -141,4 +142,13 @@ private function getAppName()
141142
return 'symfony';
142143
}
143144
}
145+
146+
private function getAppEnv()
147+
{
148+
if ($appName = getenv('ddtrace_app_env')) {
149+
return $appName;
150+
} else {
151+
return 'none';
152+
}
153+
}
144154
}

0 commit comments

Comments
 (0)