open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.08k stars 2.37k forks source link

[exporter/azuremonitor] Unable to use APPLICATIONINSIGHTS_CONNECTION_STRING #36319

Open audunsolemdal opened 1 day ago

audunsolemdal commented 1 day ago

Component(s)

exporter/azuremonitor

What happened?

Description

According to the docs

Example using environment variable:

Ensure APPLICATIONINSIGHTS_CONNECTION_STRING is set in your environment, then configure the exporter without specifying a connection string or instrumentation key:

exporters:
  azuremonitor:

this should be possible according to the docs, but my otel-collector crashes when doing this.

Steps to Reproduce

Create an otel-collector with the following exporter config

exporters:
  azuremonitor:

container crashes

Expected Result

Able to use APPLICATION_INSIGHTS_CONNECTION_STRING as an environment variable on the pod sending data to the otel collector to simplify configuration overhead.

Actual Result

OTEL collector crashes if connection string is not set

Collector version

otel/opentelemetry-collector-k8s:0.111.0

Environment information

Environment

otel-collector helm chart

OpenTelemetry Collector configuration

config:
  exporters:
    debug:
      verbosity: detailed
    azuremonitor:

Log output

Error: failed to build pipelines: failed to create "azuremonitor" exporter for data type "logs": ConnectionString and InstrumentationKey cannot be empty                                                                        2024/11/12 12:41:54 collector server run finished with error: failed to build pipelines: failed to create "azuremonitor" exporter for data type "logs": ConnectionString and InstrumentationKey cannot be empty

Additional context

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/azuremonitorexporter/README.md#configuration-options

Relates to #34188

github-actions[bot] commented 1 day ago

Pinging code owners: