Skip to content

Commit 2a4b89b

Browse files
authored
Update auto-instrumentation packages to SemConv 1.30 (#327)
* update auto-instrumentation packages to SemConv 1.30.0 * Curl semconv 1.30 * amqp noting semconv recommendations, try to stick to semconv 1.24. Where attributes have been removed, replace with a string * rdkafka * guzzle * HttpAsyncClient * io * laravel * mongodb * mysqli * openaiphp * pdo * psr3 * psr6 * psr14 * psr15 * psr16 * psr18 * slim * symfony * wordpress * yii * symfony * logs * hard-code schema url for 8.0-supporting packages on 8.0 these packages won't be able to use the SemConv::Version enum * no-plugins for composer make targets this avoids the annoying 'do you trust...' composer questions * drop 7.4 testing * fixing build errors - bump psr3 + monolog deps to php8.1 - fix azure detector semconv, add composer dependency * skip failing cake test on 8.0 * fix message span names in semconv 1.27 the order of operation+queue switched
1 parent a4089b1 commit 2a4b89b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"ext-opentelemetry": "*",
1414
"ext-reflection": "*",
1515
"open-telemetry/api": "^1.0",
16-
"open-telemetry/sem-conv": "^1.24",
16+
"open-telemetry/sem-conv": "^1.30",
1717
"slim/slim": "^4"
1818
},
1919
"require-dev": {

src/SlimInstrumentation.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public static function register(): void
3232
$instrumentation = new CachedInstrumentation(
3333
'io.opentelemetry.contrib.php.slim',
3434
null,
35-
'https://opentelemetry.io/schemas/1.25.0'
35+
'https://opentelemetry.io/schemas/1.30.0',
3636
);
37+
3738
/**
3839
* requires extension >= 1.0.2beta2
3940
* @see https://github.com/open-telemetry/opentelemetry-php-instrumentation/pull/136
@@ -49,10 +50,10 @@ public static function register(): void
4950
$builder = $instrumentation->tracer()
5051
->spanBuilder(sprintf('%s', $request?->getMethod() ?? 'unknown'))
5152
->setSpanKind(SpanKind::KIND_SERVER)
52-
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
53+
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $function)
5354
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
5455
->setAttribute(TraceAttributes::CODE_FILEPATH, $filename)
55-
->setAttribute(TraceAttributes::CODE_LINENO, $lineno);
56+
->setAttribute(TraceAttributes::CODE_LINE_NUMBER, $lineno);
5657
$parent = Context::getCurrent();
5758
if ($request) {
5859
$parent = Globals::propagator()->extract($request->getHeaders());
@@ -83,7 +84,7 @@ public static function register(): void
8384
$scope->detach();
8485
$span = Span::fromContext($scope->context());
8586
if ($exception) {
86-
$span->recordException($exception, [TraceAttributes::EXCEPTION_ESCAPED => true]);
87+
$span->recordException($exception);
8788
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
8889
}
8990
if ($response) {
@@ -155,10 +156,10 @@ public static function register(): void
155156
$callable = $params[0];
156157
$name = CallableFormatter::format($callable);
157158
$builder = $instrumentation->tracer()->spanBuilder($name)
158-
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
159+
->setAttribute(TraceAttributes::CODE_FUNCTION_NAME, $function)
159160
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
160161
->setAttribute(TraceAttributes::CODE_FILEPATH, $filename)
161-
->setAttribute(TraceAttributes::CODE_LINENO, $lineno);
162+
->setAttribute(TraceAttributes::CODE_LINE_NUMBER, $lineno);
162163
$span = $builder->startSpan();
163164
Context::storage()->attach($span->storeInContext(Context::getCurrent()));
164165
},
@@ -170,7 +171,7 @@ public static function register(): void
170171
$scope->detach();
171172
$span = Span::fromContext($scope->context());
172173
if ($exception) {
173-
$span->recordException($exception, [TraceAttributes::EXCEPTION_ESCAPED => true]);
174+
$span->recordException($exception);
174175
$span->setStatus(StatusCode::STATUS_ERROR, $exception->getMessage());
175176
}
176177
$span->end();

0 commit comments

Comments
 (0)