Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update readme on how to use OTEL_NODE_RESOURCE_DETECTORS
  • Loading branch information
maryliag committed Apr 17, 2024
commit 2b497dfeff6e8746e0b8d43b363b7e39d259576a
18 changes: 17 additions & 1 deletion experimental/packages/opentelemetry-sdk-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,25 @@ Configure a resource. Resources may also be detected by using the `autoDetectRes

### resourceDetectors

Configure resource detectors. By default, the resource detectors are [envDetector, processDetector].
Configure resource detectors. By default, the resource detectors are [envDetector, processDetector, hostDetector].
NOTE: In order to enable the detection, the parameter `autoDetectResources` has to be `true`.

You can also use the environment variable `OTEL_NODE_RESOURCE_DETECTORS` to enable only certain detectors, or completely disable them:

- `env`
- `host`
- `os`
- `process`
- `serviceinstance`
- `all` - enable all resource detectors above
- `none` - disable resource detection

For example, to enable only the `env`, `host` detectors:

```shell
export OTEL_NODE_RESOURCE_DETECTORS="env,host"
```

### sampler

Configure a custom sampler. By default, all traces will be sampled.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ npm install --save @opentelemetry/resources
## Usage

```typescript
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';

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

const anotherResource = new Resource({
Expand Down