Skip to content

Commit 395010f

Browse files
dyladanpichlermarcrenovate-bot
authored
Http server semconv span stable (#4978)
Co-authored-by: Marc Pichler <marcpi@edu.aau.at> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
1 parent ee40d5d commit 395010f

File tree

9 files changed

+396
-38
lines changed

9 files changed

+396
-38
lines changed

experimental/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ All notable changes to experimental packages in this project will be documented
1010
### :rocket: (Enhancement)
1111

1212
* feat(api-logs): Add delegating no-op logger provider [#4861](https://github.com/open-telemetry/opentelemetry-js/pull/4861) @hectorhdzg
13-
* feat(instrumentation-http): Add support for client span semantic conventions 1.27 [#4940](https://github.com/open-telemetry/opentelemetry-js/pull/4940) @dyladan
13+
* feat(instrumentation-http): Add support for [Semantic Conventions 1.27+](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.27.0) [#4940](https://github.com/open-telemetry/opentelemetry-js/pull/4940) [#4978](https://github.com/open-telemetry/opentelemetry-js/pull/4978) @dyladan
14+
* Applies to both client and server spans
15+
* Generate spans compliant with Semantic Conventions 1.27+ when `OTEL_SEMCONV_STABILITY_OPT_IN` contains `http` or `http/dup`
16+
* Generate spans backwards compatible with previous attributes when `OTEL_SEMCONV_STABILITY_OPT_IN` contains `http/dup` or DOES NOT contain `http`
1417

1518
### :bug: (Bug Fix)
1619

experimental/packages/opentelemetry-instrumentation-http/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The following options are deprecated:
7676

7777
## Semantic Conventions
7878

79-
### Client Spans
79+
### Client and Server Spans
8080

8181
Prior to version `0.54`, this instrumentation created spans targeting an experimental semantic convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md).
8282

@@ -91,7 +91,7 @@ If neither `http` or `http/dup` is included in `OTEL_SEMCONV_STABILITY_OPT_IN`,
9191
Enabled when `OTEL_SEMCONV_STABILITY_OPT_IN` contains `http` OR `http/dup`.
9292
This is the recommended configuration, and will soon become the default behavior.
9393

94-
Follow all requirements and recommendations of HTTP Client Span Semantic Conventions [Version 1.27.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.27.0/docs/http/http-spans.md), including all required and recommended attributes.
94+
Follow all requirements and recommendations of HTTP Client and Server Span Semantic Conventions [Version 1.27.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.27.0/docs/http/http-spans.md), including all required and recommended attributes.
9595

9696
#### Legacy Behavior (default)
9797

experimental/packages/opentelemetry-instrumentation-http/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"@opentelemetry/core": "1.26.0",
7979
"@opentelemetry/instrumentation": "0.53.0",
8080
"@opentelemetry/semantic-conventions": "1.27.0",
81+
"forwarded-parse": "2.1.2",
8182
"semver": "^7.5.2"
8283
},
8384
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http",

experimental/packages/opentelemetry-instrumentation-http/src/http.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
528528
request,
529529
instrumentation.getConfig().startIncomingSpanHook
530530
),
531+
semconvStability: instrumentation._semconvStability,
531532
});
532533

533534
const spanOptions: SpanOptions = {
@@ -760,7 +761,8 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
760761
) {
761762
const attributes = getIncomingRequestAttributesOnResponse(
762763
request,
763-
response
764+
response,
765+
this._semconvStability
764766
);
765767
metricAttributes = Object.assign(
766768
metricAttributes,

0 commit comments

Comments
 (0)