Skip to content

Commit

Permalink
docs(opentelemetry-resources): fix wrong sample code in readme (#2289)
Browse files Browse the repository at this point in the history
use semantic-conventions package to get ResourceAttributes in sample code

Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
  • Loading branch information
alisabzevari and obecny authored Jun 23, 2021
1 parent 39e6cb3 commit bd2a005
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/opentelemetry-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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`.

[This document][resource-semantic_conventions] defines standard attributes for resources.
[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).

## Installation

Expand All @@ -18,9 +18,11 @@ npm install --save @opentelemetry/resources
## Usage

```typescript
import { Resource, SERVICE_RESOURCE } from '@opentelemetry/resources';
import { ResourceAttributes } from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';

const resource = new Resource({
[SERVICE_RESOURCE.NAME]: 'api-service',
[ResourceAttributes.SERVICE_NAME]: 'api-service',
});

const another_resource = new Resource({
Expand Down

0 comments on commit bd2a005

Please sign in to comment.