Skip to content

Commit

Permalink
docs(opentelemetry-resources): fix wrong sample code in readme
Browse files Browse the repository at this point in the history
use semantic-conventions package to get ResourceAttributes in sample code
  • Loading branch information
alisabzevari committed Jun 16, 2021
1 parent 6398bb8 commit c214e09
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 c214e09

Please sign in to comment.