Skip to content

Commit 99e1375

Browse files
authored
update instrumentations to semconv 1.32 (#369)
SemConv 1.32 deprecates a couple of attributes which we use extensively: - code.function.name is now an FQN (including class name) - code.namespace is deprecated (included in code.function.name) - code.linenumber is deprecated and replaced with code.line.number Updated all packages to conform, updated min semconv to 1.32, and made a couple of minor changes"
1 parent f0e5715 commit 99e1375

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"open-telemetry/context": "^1",
1414
"open-telemetry/exporter-otlp": "^1",
1515
"open-telemetry/exporter-zipkin": "^1",
16-
"open-telemetry/sem-conv": "^1.30",
16+
"open-telemetry/sem-conv": "^1.32",
1717
"php-http/discovery": "^1.14",
1818
"php-http/message": "^1.12"
1919
},

src/OtelBundle/Console/ConsoleListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
$this->tracer = $tracerProvider->getTracer(
2929
OtelBundle::instrumentationName(),
3030
OtelBundle::instrumentationVersion(),
31-
'https://opentelemetry.io/schemas/1.30.0',
31+
'https://opentelemetry.io/schemas/1.32.0',
3232
);
3333
}
3434

@@ -54,14 +54,14 @@ public function startCommand(ConsoleCommandEvent $event): void
5454
$name = $command
5555
? $command->getName()
5656
: null;
57-
$class = $command
58-
? get_class($command)
57+
$fqn = $command
58+
? sprintf('%s::%s', get_class($command), 'run')
5959
: null;
6060

61+
$fqn =
6162
$span = $this->tracer
6263
->spanBuilder($name ?? 'command')
63-
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, 'run')
64-
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
64+
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $fqn)
6565
->startSpan();
6666

6767
Context::storage()->attach($span->storeInContext(Context::getCurrent()));

0 commit comments

Comments
 (0)