English 中文(简体)
在环境变量中通过,进入开放电视公司
原标题:Pass in environment variables to OpenTelemetryCollector config

I have installed an OT Operator for Kubernetes, I now need to create an OT collector instance to start collecting and reporting metrics. The example on the page is super simple

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: simplest
spec:
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    processors:

    exporters:
      logging:

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: []
          exporters: [logging]

However my config has a bit more to it and requires an api key which I would like to pass in as an env variable. Is there anyway to do that?

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: simplest
spec:
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    processors:

    exporters:
      logging:
      otlp:
        endpoint: $ENDPOINT
        headers:
          api-key: $API_KEY

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: []
          exporters: [logging]
问题回答

Use ${env:ENV_VARIABLE} to read the environment variable. Details are available here. https://opentelemetry.io/docs/collector/configuration/#environment-variables





相关问题
Emitting logs to Open Telemetry Collector

I am new to Open Telemetry and I am trying its C++ API with a toy example that emit logs. I am using the OtlpHttpLogExporter to emit to the Open Telemetry Collector via http. And I configured the ...

springboot 3.1.6 webflux trace lost

I constructed the web client using the following method. @Bean public XXXApiService xxxApiClient(HttpClient httpClient, WebClient.Builder builder) { WebClient webClient = builder ...

热门标签