Skip to content

Commit 65a1389

Browse files
authored
refactor(instrumentation-connect): update semconv usage to ATTR_ exports (#2858)
1 parent af9ff12 commit 65a1389

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

plugins/node/opentelemetry-instrumentation-connect/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ See [examples/connect](https://github.com/open-telemetry/opentelemetry-js-contri
5555

5656
## Semantic Conventions
5757

58-
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)
58+
This package implements Semantic Convention v1.33.1.
5959

6060
Attributes collected:
6161

plugins/node/opentelemetry-instrumentation-connect/src/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
InstrumentationNodeModuleDefinition,
3333
isWrapped,
3434
} from '@opentelemetry/instrumentation';
35-
import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
35+
import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
3636
import {
3737
replaceCurrentStackRoute,
3838
addNewStackLayer,
@@ -101,7 +101,7 @@ export class ConnectInstrumentation extends InstrumentationBase {
101101
const spanName = `${connectTypeName} - ${connectName}`;
102102
const options: SpanOptions = {
103103
attributes: {
104-
[SEMATTRS_HTTP_ROUTE]: routeName.length > 0 ? routeName : '/',
104+
[ATTR_HTTP_ROUTE]: routeName.length > 0 ? routeName : '/',
105105
[AttributeNames.CONNECT_TYPE]: connectType,
106106
[AttributeNames.CONNECT_NAME]: connectName,
107107
},

plugins/node/opentelemetry-instrumentation-connect/test/instrumentation.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as assert from 'assert';
1717

1818
import { context, trace } from '@opentelemetry/api';
1919
import { RPCType, setRPCMetadata, RPCMetadata } from '@opentelemetry/core';
20-
import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
20+
import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
2121
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
2222
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
2323
import {
@@ -145,7 +145,7 @@ describe('connect', () => {
145145
assert.deepStrictEqual(span.attributes, {
146146
'connect.type': 'middleware',
147147
'connect.name': ANONYMOUS_NAME,
148-
[SEMATTRS_HTTP_ROUTE]: '/',
148+
[ATTR_HTTP_ROUTE]: '/',
149149
});
150150
assert.strictEqual(span.name, 'middleware - anonymous');
151151
});
@@ -164,7 +164,7 @@ describe('connect', () => {
164164
assert.deepStrictEqual(span.attributes, {
165165
'connect.type': 'middleware',
166166
'connect.name': 'middleware1',
167-
[SEMATTRS_HTTP_ROUTE]: '/',
167+
[ATTR_HTTP_ROUTE]: '/',
168168
});
169169
assert.strictEqual(span.name, 'middleware - middleware1');
170170
});
@@ -182,7 +182,7 @@ describe('connect', () => {
182182
assert.deepStrictEqual(span.attributes, {
183183
'connect.type': 'request_handler',
184184
'connect.name': '/foo',
185-
[SEMATTRS_HTTP_ROUTE]: '/foo',
185+
[ATTR_HTTP_ROUTE]: '/foo',
186186
});
187187
assert.strictEqual(span.name, 'request handler - /foo');
188188
});

0 commit comments

Comments
 (0)