認証を設定する

Collectorには2つのタイプの認証を設定できます。

  • サーバー型認証は、HTTP/gRPC リクエストの着信時に行われ、通常、レシーバによって使用されます。サーバー型のオーセンティケータには以下が含まれます。

    • 基本認証拡張

    • ベアラートークンエクステンション

    • OIDCエクステンション

  • クライアント型認証は、HTTP/gRPC リクエストの発信時に行われ、通常、エクスポータによって使用されます。クライアント型のオーセンティケータには以下が含まれます。

注: 詳しくは、OpenTelemetry の GitHub レポジトリから「Auth Configuration Settings」をご確認ください。

次の例は、異なる認証オプションをカバーしています:

extensions:
   oidc:
      # see the blog post on securing the otelcol for information
      # on how to setup an OIDC server and how to generate the TLS certs
      # required for this example
      # https://medium.com/opentelemetry/securing-your-opentelemetry-collector-1a4f9fa5bd6f
      issuer_url: http://localhost:8080/auth/realms/opentelemetry
      audience: account

oauth2client:
   client_id: someclientid
   client_secret: someclientsecret
   token_url: https://example.com/oauth2/default/v1/token
   scopes: ["api.metrics"]
   # tls settings for the token client
   tls:
      insecure: true
      ca_file: /var/lib/mycert.pem
      cert_file: certfile
      key_file: keyfile
   # timeout for the token client
   timeout: 2s

receivers:
   otlp/with_auth:
      protocols:
         grpc:
            endpoint: localhost:4318
            tls:
               cert_file: /tmp/certs/cert.pem
               key_file: /tmp/certs/cert-key.pem
            auth:
               ## oidc is the extension name to use as the authenticator for this receiver
               authenticator: oidc

   otlphttp/withauth:
      endpoint: http://localhost:9000
      auth:
         authenticator: oauth2client