Skip to content

Commit 34796e2

Browse files
refactor(instr-router): use exported strings for attributes (#2099)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
1 parent fae3010 commit 34796e2

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ registerInstrumentations({
4040

4141
See [examples/router](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/router) for a short example.
4242

43+
## Semantic Conventions
44+
45+
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)
46+
47+
Attributes collected:
48+
49+
| Attribute | Short Description |
50+
| ------------ | ---------------------------------- |
51+
| `http.route` | The matched route (path template). |
52+
4353
## Useful links
4454

4555
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>

plugins/node/opentelemetry-instrumentation-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"dependencies": {
5959
"@opentelemetry/instrumentation": "^0.50.0",
60-
"@opentelemetry/semantic-conventions": "^1.0.0"
60+
"@opentelemetry/semantic-conventions": "^1.22.0"
6161
},
6262
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-router#readme"
6363
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
InstrumentationNodeModuleFile,
2323
isWrapped,
2424
} from '@opentelemetry/instrumentation';
25-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
25+
import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
2626

2727
import * as http from 'http';
2828
import type * as Router from 'router';
@@ -182,7 +182,7 @@ export default class RouterInstrumentation extends InstrumentationBase<any> {
182182
[AttributeNames.NAME]: fnName,
183183
[AttributeNames.VERSION]: this._moduleVersion,
184184
[AttributeNames.TYPE]: type,
185-
[SemanticAttributes.HTTP_ROUTE]: route,
185+
[SEMATTRS_HTTP_ROUTE]: route,
186186
};
187187

188188
const parent = api.context.active();

0 commit comments

Comments
 (0)