Skip to content
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ This repository contains the JSON schema definitions of the OpenTelemetry [decla
## Starter templates

The [examples](./examples) directory contains a variety of sample configuration files to help get started and illustrate useful patterns. The following are noteworthy:

* [sdk-migration-config.yaml](./examples/sdk-migration-config.yaml): Includes env var substitution references to all [standard env vars](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md) which map cleanly to declarative configuration (see notes in the example for the set of env vars that are not referenced). Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][]. This is a great starting point for transitioning from env var based configuration to file based configuration.
* [sdk-config.yaml](./examples/sdk-config.yaml): Represents the typical default configuration. This is a good starting point if you are not using env var based configuration or wish to transition fully to file based configuration. Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][].

* [getting-started.yaml](./examples/getting-started.yaml): A typical default configuration file to get started with declarative configuration. This is a good starting point if you are new to declarative configuration.
- [sdk-migration-config.yaml](./examples/sdk-migration-config.yaml): Includes env var substitution references to all [standard env vars](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md) which map cleanly to declarative configuration (see notes in the example for the set of env vars that are not referenced). Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][]. This is a great starting point for transitioning from env var based configuration to file based configuration.
* [sdk-config.yaml](./examples/sdk-config.yaml): Represents a comprehensive default configuration. This is a good starting point if you wish to have a template with more settings than `getting-started.yaml` and you are not using env var based configuration or wish to transition fully to file based configuration. Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][].

## Code generation

Expand Down
55 changes: 55 additions & 0 deletions examples/getting-started.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# getting-started.yaml is a good starting point for configuring the SDK, including exporting to
# localhost via OTLP.
#
# NOTE: With the exception of env var substitution syntax (i.e. ${MY_ENV}), SDKs ignore
# environment variables when interpreting config files. This including ignoring all env
# vars defined in https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/.
Comment thread
zeitlinger marked this conversation as resolved.
#
# For schema documentation, including required properties, semantics, default behavior, etc,
# see: https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema-docs.md

file_format: "1.0-rc.2"

resource:
# Read resource attributes from the OTEL_RESOURCE_ATTRIBUTES environment variable.
# This aligns well with the OpenTelemetry Operator and other deployment methods.
Comment thread
jack-berg marked this conversation as resolved.
attributes_list: ${OTEL_RESOURCE_ATTRIBUTES}
detection/development: # /development properties may not be supported in all SDKs
detectors:
- service: # will add "service.instance.id" and "service.name" from the OTEL_SERVICE_NAME env var
Comment thread
zeitlinger marked this conversation as resolved.
- host:
- process:
- container:

propagator:
composite:
- tracecontext:
- baggage:

# Read backend endpoint from the OTEL_EXPORTER_OTLP_ENDPOINT environment variable.
# This aligns well with the OpenTelemetry Operator and other deployment methods.

tracer_provider:
Comment thread
zeitlinger marked this conversation as resolved.
sampler:
parent_based:
root:
always_on:
processors:
- batch:
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/traces
Comment thread
zeitlinger marked this conversation as resolved.

meter_provider:
readers:
- periodic:
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/metrics

logger_provider:
processors:
- batch:
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/logs
2 changes: 1 addition & 1 deletion examples/sdk-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sdk-config.yaml is a typical starting point for configuring the SDK, including exporting to
# sdk-config.yaml is a comprehensive starting point for configuring the SDK, including exporting to
# localhost via OTLP.
#
# NOTE: With the exception of env var substitution syntax (i.e. ${MY_ENV}), SDKs ignore
Expand Down
6 changes: 3 additions & 3 deletions examples/sdk-migration-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tracer_provider:
max_export_batch_size: ${OTEL_BSP_MAX_EXPORT_BATCH_SIZE:-512}
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:-http://localhost:4318/v1/traces}
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/traces
tls:
ca_file: ${OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE}
key_file: ${OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY}
Expand Down Expand Up @@ -90,7 +90,7 @@ meter_provider:
timeout: ${OTEL_METRIC_EXPORT_TIMEOUT:-30000}
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-http://localhost:4318/v1/metrics}
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/metrics
tls:
ca_file: ${OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE}
key_file: ${OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY}
Expand All @@ -110,7 +110,7 @@ logger_provider:
max_export_batch_size: ${OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:-512}
exporter:
otlp_http:
endpoint: ${OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:-http://localhost:4318/v1/logs}
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}/v1/logs
tls:
ca_file: ${OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE}
key_file: ${OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY}
Expand Down
3 changes: 2 additions & 1 deletion validator/shelltests/examples.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
make validator-validate-examples
>>>
Validating getting-started.yaml
Validating kitchen-sink.yaml
Validating sdk-config.yaml
Validating sdk-migration-config.yaml
>>>= 0
>>>= 0
Loading