Skip to content
Merged
Changes from 5 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
63 changes: 63 additions & 0 deletions docs/file-based-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# File-based Configuration

> **Status:** [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md)
> For more information about the OpenTelemetry configuration specification, see:
> **[File-based configuration documentation](https://opentelemetry.io/docs/specs/otel/configuration/sdk/)**
You can configure OpenTelemetry using a YAML file. This method is disabled
by default and must be explicitly enabled.

To enable file-based configuration, set the following environment variable:

```bash
OTEL_EXPERIMENTAL_FILE_BASED_CONFIGURATION_ENABLED=true
```

By default, the value is false.

You can also specify the configuration file path (default: config.yaml):

```bash
OTEL_EXPERIMENTAL_CONFIG_FILE=/path/to/config.yaml
```

In your config file you can use environment variables in the format `${ENVIRONMENT_VARIABLE}`
instead of a fixed value.

You can also use `${ENVIRONMENT_VARIABLE:-value}`, where `value` is the fallback
if the environment variable is empty or not set.

## Configuration Examples

### Resource Configuration

You can configure resource attributes directly in YAML or via the
`OTEL_RESOURCE_ATTRIBUTES` environment variable.

``` yaml
resource:
# Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list.
# Entries must contain .name and .value
attributes:
- name: service.name
value: unknown_service
# Alternatively, configure via a comma-separated list (same format as OTEL_RESOURCE_ATTRIBUTES).
attributes_list: ${OTEL_RESOURCE_ATTRIBUTES}
```
### Resource Detectors Configuration
For more details and updates, see: [Resource Detectors list and documentation](https://opentelemetry.io/docs/zero-code/dotnet/configuration/#resource-detectors)
``` yaml
resource:
detection/development:
detectors:
azureappservice: # Detects Azure App Service resource information
container: # Detects container resource info (container.* attributes) [Core only]
host: # Detects host resource info (host.* attributes)
operatingsystem: # Detects OS-level attributes (os.*)
process: # Detects process-level attributes (process.*)
processruntime: # Detects process runtime attributes (process.runtime.*)
service: # Detects service.name and service.instance.id
```
Loading