Skip to content

Commit bd2a005

Browse files
alisabzevariobecny
andauthored
docs(opentelemetry-resources): fix wrong sample code in readme (#2289)
use semantic-conventions package to get ResourceAttributes in sample code Co-authored-by: Bartlomiej Obecny <[email protected]>
1 parent 39e6cb3 commit bd2a005

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/opentelemetry-resources/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the `Resource`.
99

10-
[This document][resource-semantic_conventions] defines standard attributes for resources.
10+
[This document][resource-semantic_conventions] defines standard attributes for resources which are accessible via [`@opentelemetry/semantic-conventions`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-semantic-conventions).
1111

1212
## Installation
1313

@@ -18,9 +18,11 @@ npm install --save @opentelemetry/resources
1818
## Usage
1919

2020
```typescript
21-
import { Resource, SERVICE_RESOURCE } from '@opentelemetry/resources';
21+
import { ResourceAttributes } from '@opentelemetry/semantic-conventions';
22+
import { Resource } from '@opentelemetry/resources';
23+
2224
const resource = new Resource({
23-
[SERVICE_RESOURCE.NAME]: 'api-service',
25+
[ResourceAttributes.SERVICE_NAME]: 'api-service',
2426
});
2527

2628
const another_resource = new Resource({

0 commit comments

Comments
 (0)