Skip to content

Commit

Permalink
Address PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
agoallikmaa committed Nov 21, 2023
1 parent 211932a commit 368c631
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Instrumentation/Yii/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"homepage": "https://opentelemetry.io/docs/php",
"readme": "./README.md",
"license": "Apache-2.0",
"minimum-stability": "dev",
"require": {
"php": "^8.0",
"ext-opentelemetry": "*",
"yiisoft/yii2": "^2.0.13",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/api": "^1",
"open-telemetry/sem-conv": "^1.22"
},
"require-dev": {
Expand Down
1 change: 1 addition & 0 deletions src/Instrumentation/Yii/src/YiiInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public static function register(): void

$span = Span::fromContext($scope->context());
$route = YiiInstrumentation::normalizeRouteName(get_class($controller), $action->actionMethod);
$span->updateName($route);
$span->setAttribute(TraceAttributes::HTTP_ROUTE, $route);
},
post: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_success()

$attributes = $this->storage[0]->getAttributes();
$this->assertCount(1, $this->storage);
$this->assertEquals('GET', $this->storage[0]->getName());
$this->assertEquals('SiteController.actionIndex', $this->storage[0]->getName());
$this->assertEquals('http://example.com/site/index', $attributes->get(TraceAttributes::URL_FULL));
$this->assertEquals('GET', $attributes->get(TraceAttributes::HTTP_REQUEST_METHOD));
$this->assertEquals('http', $attributes->get(TraceAttributes::URL_SCHEME));
Expand All @@ -39,7 +39,7 @@ public function test_exception()

$attributes = $this->storage[0]->getAttributes();
$this->assertCount(1, $this->storage);
$this->assertEquals('GET', $this->storage[0]->getName());
$this->assertEquals('SiteController.actionThrow', $this->storage[0]->getName());
$this->assertEquals('http://example.com/site/throw', $attributes->get(TraceAttributes::URL_FULL));
$this->assertEquals('GET', $attributes->get(TraceAttributes::HTTP_REQUEST_METHOD));
$this->assertEquals('http', $attributes->get(TraceAttributes::URL_SCHEME));
Expand All @@ -65,7 +65,7 @@ public function test_parent()

$attributes = $span->getAttributes();
$this->assertCount(1, $this->storage);
$this->assertEquals('GET', $this->storage[0]->getName());
$this->assertEquals('SiteController.actionIndex', $this->storage[0]->getName());
$this->assertEquals('http://example.com/site/index', $attributes->get(TraceAttributes::URL_FULL));
$this->assertEquals('GET', $attributes->get(TraceAttributes::HTTP_REQUEST_METHOD));
$this->assertEquals('http', $attributes->get(TraceAttributes::URL_SCHEME));
Expand Down

0 comments on commit 368c631

Please sign in to comment.