Skip to content

Commit

Permalink
Remove use of service.name in example & Add info about OTEL_SERVICE_N…
Browse files Browse the repository at this point in the history
…AME (#3018)
  • Loading branch information
geekrypter authored Jul 15, 2023
1 parent 832575d commit 0bb9121
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions content/en/docs/instrumentation/js/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ In the above example, the SDK detected the process and also added the

Below you will find instructions to get resources detected automatically for
you. However, you might run into the situation that no detector exists for the
resource you need. In that case you can use the environment
`OTEL_RESOURCE_ATTRIBUTES` to inject whatever you need. For example the
following script adds [Service][], [Host][] and [OS][] resource attributes:
resource you need. In that case, use the environment variable
`OTEL_RESOURCE_ATTRIBUTES` to inject whatever you need. Additionally, you can
use the environment variable `OTEL_SERVICE_NAME` to set value of the
`service.name` resource attribute. For example, the following script adds
[Service][], [Host][] and [OS][] resource attributes:

```console
$ env OTEL_RESOURCE_ATTRIBUTES="service.name=app.js,service.namespace=tutorial,service.version=1.0,service.instance.id=`uuidgen`,host.name=${HOSTNAME:},host.type=`uname -m`,os.name=`uname -s`,os.version=`uname -r`" \
$ env OTEL_SERVICE_NAME="app.js" OTEL_RESOURCE_ATTRIBUTES="service.namespace=tutorial,service.version=1.0,service.instance.id=`uuidgen`,host.name=${HOSTNAME},host.type=`uname -m`,os.name=`uname -s`,os.version=`uname -r`" \
node --require ./tracing.js app.js
...
EnvDetector found resource. Resource {
Expand Down

0 comments on commit 0bb9121

Please sign in to comment.