Skip to content

Commit d89e2b5

Browse files
authored
http server semconv 1.23 updates (#208)
* update http server span names to match spec ("GET" or "GET <route>"), per https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-spans.md#name * adding http client/server span attributes * do not normalize hyphen to underscore for http request/response header key, per https://opentelemetry.io/blog/2023/http-conventions-declared-stable/#common-attributes-across-http-client-and-server-spans
1 parent c39d385 commit d89e2b5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/HttpClientInstrumentation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function register(): void
3636
/** @psalm-suppress ArgumentTypeCoercion */
3737
$builder = $instrumentation
3838
->tracer()
39-
->spanBuilder(\sprintf('HTTP %s', $params[0]))
39+
->spanBuilder(\sprintf('%s', $params[0]))
4040
->setSpanKind(SpanKind::KIND_CLIENT)
4141
->setAttribute(TraceAttributes::URL_FULL, (string) $params[1])
4242
->setAttribute(TraceAttributes::HTTP_REQUEST_METHOD, $params[0])

src/SymfonyInstrumentation.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function register(): void
4040
/** @psalm-suppress ArgumentTypeCoercion */
4141
$builder = $instrumentation
4242
->tracer()
43-
->spanBuilder(\sprintf('HTTP %s', $request?->getMethod() ?? 'unknown'))
43+
->spanBuilder(\sprintf('%s', $request?->getMethod() ?? 'unknown'))
4444
->setSpanKind(SpanKind::KIND_SERVER)
4545
->setAttribute(TraceAttributes::CODE_FUNCTION, $function)
4646
->setAttribute(TraceAttributes::CODE_NAMESPACE, $class)
@@ -56,6 +56,7 @@ public static function register(): void
5656
->setAttribute(TraceAttributes::HTTP_REQUEST_METHOD, $request->getMethod())
5757
->setAttribute(TraceAttributes::HTTP_REQUEST_BODY_SIZE, $request->headers->get('Content-Length'))
5858
->setAttribute(TraceAttributes::URL_SCHEME, $request->getScheme())
59+
->setAttribute(TraceAttributes::URL_PATH, $request->getPathInfo())
5960
->startSpan();
6061
$request->attributes->set(SpanInterface::class, $span);
6162
} else {

0 commit comments

Comments
 (0)