This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.2. トレースとメトリクスを OpenTelemetry Collector に送信する
OpenTelemetry Collector へのトレースとメトリクスの送信は、サイドカー注入の有無にかかわらず可能です。
5.2.1. サイドカー注入を使用してトレースとメトリクスを OpenTelemetry Collector に送信する
サイドカー注入を使用して、OpenTelemetry Collector インスタンスへのテレメトリーデータの送信をセットアップできます。
Red Hat build of OpenTelemetry Operatorでは、デプロイメントワークロードへのサイドカー注入と、OpenTelemetry Collector にテレメトリーデータを送信するためのインストルメンテーションの自動設定が可能です。
前提条件
- Red Hat OpenShift distributed tracing platform (Tempo) がインストールされ、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: project.openshift.io/v1 kind: Project metadata: name: observability
Copy to Clipboard Copied! サービスアカウントを作成します。
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-sidecar namespace: observability
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-sidecar namespace: observability
Copy to Clipboard Copied! k8sattributes
および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-sidecar namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.io
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-sidecar namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.io
Copy to Clipboard Copied! OpenTelemetry Collector をサイドカーとしてデプロイします。
apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: otel namespace: observability spec: serviceAccount: otel-collector-sidecar mode: sidecar config: | serviceAccount: otel-collector-sidecar receivers: otlp: protocols: grpc: http: processors: batch: memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 resourcedetection: detectors: [openshift] timeout: 2s exporters: otlp: endpoint: "tempo-<example>-gateway:8090" tls: insecure: true service: pipelines: traces: receivers: [jaeger] processors: [memory_limiter, resourcedetection, batch] exporters: [otlp]
apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: otel namespace: observability spec: serviceAccount: otel-collector-sidecar mode: sidecar config: | serviceAccount: otel-collector-sidecar receivers: otlp: protocols: grpc: http: processors: batch: memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 resourcedetection: detectors: [openshift] timeout: 2s exporters: otlp: endpoint: "tempo-<example>-gateway:8090"
1 tls: insecure: true service: pipelines: traces: receivers: [jaeger] processors: [memory_limiter, resourcedetection, batch] exporters: [otlp]
Copy to Clipboard Copied! - 1
- これは、
<example>
Tempo Operator を使用してデプロイされた TempoStack インスタンスのゲートウェイを指します。
-
otel-collector-sidecar
サービスアカウントを使用してデプロイメントを作成します。 -
sidecar.opentelemetry.io/inject: "true"
アノテーションをDeployment
オブジェクトに追加します。これにより、ワークロードから OpenTelemetry Collector インスタンスにデータを送信するために必要なすべての環境変数が注入されます。
5.2.2. サイドカー注入を使用せずにトレースとメトリクスを OpenTelemetry Collector に送信する
サイドカー注入を使用せずに、テレメトリーデータを OpenTelemetry Collector インスタンスに送信するようにセットアップできます。これには、いくつかの環境変数を手動で設定する必要があります。
前提条件
- Red Hat OpenShift distributed tracing platform (Tempo) がインストールされ、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: project.openshift.io/v1 kind: Project metadata: name: observability
Copy to Clipboard Copied! サービスアカウントを作成します。
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observability
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observability
Copy to Clipboard Copied! k8sattributes
および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 namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.io
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 namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.io
Copy to Clipboard Copied! OpenTelemetryCollector
カスタムリソースを使用して OpenTelemetry Collector インスタンスをデプロイします。apiVersion: opentelemetry.io/v1alpha1 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" tls: insecure: true service: pipelines: traces: receivers: [jaeger, opencensus, otlp, zipkin] processors: [memory_limiter, k8sattributes, resourcedetection, batch] exporters: [otlp]
apiVersion: opentelemetry.io/v1alpha1 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]
Copy to Clipboard Copied! - 1
- これは、
<example>
Tempo Operator を使用してデプロイされた TempoStack インスタンスのゲートウェイを指します。
インストルメント化されたアプリケーションを使用してコンテナーに環境変数を設定します。
名前 説明 デフォルト値 OTEL_SERVICE_NAME
OTEL_SERVICE_NAME
Copy to Clipboard Copied! service.name
リソース属性の値を設定します。""
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_ENDPOINT
Copy to Clipboard Copied! オプションで指定したポート番号を持つシグナル型のベースエンドポイント URL。
https://localhost:4317
OTEL_EXPORTER_OTLP_CERTIFICATE
OTEL_EXPORTER_OTLP_CERTIFICATE
Copy to Clipboard Copied! gRPC クライアントの TLS 認証情報の証明書ファイルへのパス。
https://localhost:4317
OTEL_TRACES_SAMPLER
OTEL_TRACES_SAMPLER
Copy to Clipboard Copied! トレースに使用されるサンプラー。
parentbased_always_on
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_PROTOCOL
Copy to Clipboard Copied! OTLP エクスポーターのトランスポートプロトコル。
grpc
OTEL_EXPORTER_OTLP_TIMEOUT
OTEL_EXPORTER_OTLP_TIMEOUT
Copy to Clipboard Copied! OTLP エクスポーターが各バッチエクスポートを待機する最大時間間隔。
10s
OTEL_EXPORTER_OTLP_INSECURE
OTEL_EXPORTER_OTLP_INSECURE
Copy to Clipboard Copied! gRPC リクエストのクライアントトランスポートセキュリティーを無効にします。HTTPS スキーマはこれをオーバーライドします。
False