inception-health / otel-export-trace-action

MIT License
99 stars 33 forks source link

unable to send traces with authentication #199

Open Samyu09 opened 8 months ago

Samyu09 commented 8 months ago

i have configured auth server at openteleemtry end this way

config:
  extensions:
    basicauth/server:
      htpasswd:
        file: .htpasswd
        inline: |
          admin:admin
    basicauth/client:
      client_auth:
        username: admin
        password: admin
    health_check:
      endpoint: 0.0.0.0:13133
      check_collector_pipeline:
        enabled: true
        interval: "5m"
        exporter_failure_threshold: 5
    zpages:
      endpoint: 0.0.0.0:55679
  receivers:
    otlp:
      protocols:
        http:
          endpoint: 0.0.0.0:4318
          auth:
            authenticator: basicauth/server
        grpc:
          auth:
            authenticator: basicauth/server
          endpoint: 0.0.0.0:4317

and the github action to send traces is as follows

      - name: Export Trace
        uses: inception-health/otel-export-trace-action@latest
        with:
          otlpEndpoint: ${{ secrets.OTEL_ENDPOINT }}

          otlpHeaders: '{"Content-Type": "application/json", "authorization": "Basic ${{ secrets.BASIC_AUTH_TOKEN }}"}'

          githubToken: ${{ secrets.OTEL_TOK }}
          runId: ${{ github.event.workflow_run.id }}

any help ?? on customizing the otlpHeaders here so as to make it work???

joschi commented 4 weeks ago

The otlpHeaders configuration setting is using comma-separated key=value pairs, see also https://github.com/inception-health/otel-export-trace-action?tab=readme-ov-file#action-inputs.

Your example should work like this:

      - name: Export Trace
        uses: inception-health/otel-export-trace-action@latest
        with:
          otlpEndpoint: ${{ secrets.OTEL_ENDPOINT }}
          otlpHeaders: Content-Type=application/json, authorization=Basic ${{ secrets.BASIC_AUTH_TOKEN }}
          githubToken: ${{ secrets.OTEL_TOK }}
          runId: ${{ github.event.workflow_run.id }}