6.2. サイドカー注入を使用せずにトレースとメトリクスを OpenTelemetry Collector に送信する
サイドカー注入を使用せずに、テレメトリーデータを OpenTelemetry Collector インスタンスに送信するようにセットアップできます。これには、いくつかの環境変数を手動で設定する必要があります。
前提条件
- Red Hat OpenShift Distributed Tracing Platform がインストールされ、TempoStack インスタンスがデプロイされている。
Web コンソールまたは OpenShift CLI (
oc) を使用してクラスターにアクセスできる。-
cluster-adminロールを持つクラスター管理者として Web コンソールにログインしている。 -
cluster-adminロールを持つクラスター管理者によるアクティブな OpenShift CLI (oc) セッション。 -
Red Hat OpenShift Dedicated を使用する場合は
dedicated-adminロールを持つアカウント。
-
手順
OpenTelemetry Collector インスタンスのプロジェクトを作成します。
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observabilityサービスアカウントを作成します。
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observabilityk8sattributesおよびresourcedetectionプロセッサーの権限をサービスアカウントに付与します。apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: otel-collector rules: - apiGroups: ["", "config.openshift.io"] resources: ["pods", "namespaces", "infrastructures", "infrastructures/status"] verbs: ["get", "watch", "list"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: otel-collector subjects: - kind: ServiceAccount name: otel-collector-deployment namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.ioOpenTelemetryCollectorカスタムリソースを使用して OpenTelemetry Collector インスタンスをデプロイします。apiVersion: opentelemetry.io/v1beta1 kind: OpenTelemetryCollector metadata: name: otel namespace: observability spec: mode: deployment serviceAccount: otel-collector-deployment config: receivers: jaeger: protocols: grpc: {} thrift_binary: {} thrift_compact: {} thrift_http: {} opencensus: otlp: protocols: grpc: {} http: {} zipkin: {} processors: batch: {} k8sattributes: {} memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 resourcedetection: detectors: [openshift] exporters: otlp: endpoint: "tempo-<example>-distributor:4317"1 tls: insecure: true service: pipelines: traces: receivers: [jaeger, opencensus, otlp, zipkin] processors: [memory_limiter, k8sattributes, resourcedetection, batch] exporters: [otlp]- 1
- これは、
<example>Tempo Operator を使用してデプロイされた TempoStack インスタンスのゲートウェイを指します。
計装されたアプリケーションを使用してコンテナーに環境変数を設定します。
Expand 名前 説明 デフォルト値 OTEL_SERVICE_NAMEservice.nameリソース属性の値を設定します。""OTEL_EXPORTER_OTLP_ENDPOINTオプションで指定したポート番号を持つシグナル型のベースエンドポイント URL。
https://localhost:4317OTEL_EXPORTER_OTLP_CERTIFICATEgRPC クライアントの TLS 認証情報の証明書ファイルへのパス。
https://localhost:4317OTEL_TRACES_SAMPLERトレースに使用されるサンプラー。
parentbased_always_onOTEL_EXPORTER_OTLP_PROTOCOLOTLP エクスポーターのトランスポートプロトコル。
grpcOTEL_EXPORTER_OTLP_TIMEOUTOTLP エクスポーターが各バッチエクスポートを待機する最大時間間隔。
10sOTEL_EXPORTER_OTLP_INSECUREgRPC リクエストのクライアントトランスポートセキュリティーを無効にします。HTTPS スキーマはこれをオーバーライドします。
False