Skip to content

Update README regarding Env Vars, Reorder Env Detector in Env Var logic #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 17 additions & 10 deletions aws-distro-opentelemetry-node-autoinstrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ node --require '@aws/aws-distro-opentelemetry-node-autoinstrumentation/register'
## Sample Environment Variables for Application Signals

```shell
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \
export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics \
export OTEL_PROPAGATORS=xray,tracecontext,b3,b3multi \
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces \
export OTEL_TRACES_EXPORTER=console,otlp \
export OTEL_TRACES_SAMPLER=xray \
export OTEL_TRACES_SAMPLER_ARG=endpoint=http://localhost:2000,polling_interval=300 \
export OTEL_RESOURCE_ATTRIBUTES=service.name=test-adot-sdk-ec2-service-name \
export OTEL_NODE_DISABLED_INSTRUMENTATIONS=fs
export OTEL_RESOURCE_ATTRIBUTES=service.name=example-application-service-name
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true
export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces
export OTEL_TRACES_EXPORTER=console,otlp
export OTEL_TRACES_SAMPLER=xray
export OTEL_TRACES_SAMPLER_ARG=endpoint=http://localhost:2000,polling_interval=300
```

### General Recommendations

| Environment Variable | Description | Example |
| -------------------- | ----------- | ------- |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | Leave unset so that ADOT JS will use a recommended OTLP protocol | `http/protobuf` |
| `OTEL_PROPAGATORS` | Leave unset so that ADOT JS will use a recommended list of propagators | `xray,tracecontext,b3,b3multi` |
| `OTEL_NODE_DISABLED_INSTRUMENTATIONS` | Leave unset so that ADOT JS will disable a recommended list of instrumentations | `fs,dns` |
| `OTEL_NODE_RESOURCE_DETECTORS` | Leave unset so that ADOT JS will use a recommended list of Resource Detectors. If set, `env` should be at the end of the list | `aws,env` |
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ export class AwsOpentelemetryConfigurator {
defaultDetectors = getResourceDetectorsFromEnv();
// Add Env/AWS Resource Detectors if not present
const resourceDetectorsFromEnv: string[] = process.env.OTEL_NODE_RESOURCE_DETECTORS.split(',');
if (!resourceDetectorsFromEnv.includes('env')) {
defaultDetectors.push(envDetectorSync);
}
if (!resourceDetectorsFromEnv.includes('aws')) {
defaultDetectors.push(awsEc2Detector, awsEcsDetector, awsEksDetector);
}
if (!resourceDetectorsFromEnv.includes('env')) {
defaultDetectors.push(envDetectorSync);
}
} else {
/*
* envDetectorSync is used as opposed to envDetector (async), so it is guaranteed that the
Expand Down
Loading