From c214e09021bc5ddadcf48c0d73a954983d20c23a Mon Sep 17 00:00:00 2001 From: Ali Sabzevari Date: Wed, 16 Jun 2021 21:35:13 +0200 Subject: [PATCH] docs(opentelemetry-resources): fix wrong sample code in readme use semantic-conventions package to get ResourceAttributes in sample code --- packages/opentelemetry-resources/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/opentelemetry-resources/README.md b/packages/opentelemetry-resources/README.md index b6506a3583..b29aded79a 100644 --- a/packages/opentelemetry-resources/README.md +++ b/packages/opentelemetry-resources/README.md @@ -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 @@ -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({