Skip to content

dab init should automatically include default OTEL settings  #3161

@JerryNixon

Description

@JerryNixon

Problem

Currently, when running dab init, the generated dab-config.json does NOT include default configuration for OpenTelemetry telemetry using the standard OTEL_* environment variables (such as OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, etc.). This makes DAB out-of-the-box telemetry support useless compared to typical .NET applications and Aspire scenarios.

Proposal

When dab init is run in the CLI, if the telemetry section is being generated (or whenever the user chooses to include telemetry), automatically add the following default values to dab-config.json:

"telemetry": {
  "open-telemetry": {
    "enabled": true,
    "endpoint": "@env('OTEL_EXPORTER_OTLP_ENDPOINT')",
    "headers": "@env('OTEL_EXPORTER_OTLP_HEADERS')",
    "exporter-protocol": "@env('OTEL_EXPORTER_OTLP_PROTOCOL')",
    "service-name": "@env('OTEL_SERVICE_NAME')"
  }
}

These defaults should follow the documented OTEL env variable mapping, so users can use standard .NET/OTEL workflows with container orchestrators and Aspire. If the env vars are not set at runtime, the config values should remain as-is or fall back gracefully.

Benefit

  • Aligns DAB telemetry configuration with the "expected" .NET/Aspire experience
  • Simplifies Aspire integration and containerized telemetry export
  • Reduces user error/misconfiguration
  • DAB users don't need to hand-edit config to enable standard OTEL telemetry flows

Implementation Guidance

  • Extend CLI config template logic to include the above section when telemetry is requested/enabled
  • Consider surfacing a CLI flag to toggle inclusion of OTEL env mappings
  • Document the behavior in dab init help and in DAB docs

This is a feature request for improved developer out-of-the-box experience. See OpenTelemetry config docs for reference.

Metadata

Metadata

Labels

clienhancementNew feature or requesthas-prtelemetryfeature requests/ bug reports related to telemetry

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions