11.2. サイドカーなしで移行
サイドカーをデプロイせずに、distributed tracing platform (Jaeger) から Red Hat build of OpenTelemetry に移行できます。
前提条件
- Red Hat OpenShift distributed tracing platform (Jaeger) がクラスターで使用されている。
- Red Hat build of OpenTelemetry がインストールされている。
手順
- OpenTelemetry Collector デプロイメントを設定します。
OpenTelemetry Collector のデプロイ先となるプロジェクトを作成します。
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observability
OpenTelemetry Collector インスタンスを実行するためのサービスアカウントを作成します。
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observability
プロセッサーに必要な権限を設定するためのクラスターロールを作成します。
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: otel-collector rules: 1 2 - apiGroups: ["", "config.openshift.io"] resources: ["pods", "namespaces", "infrastructures", "infrastructures/status"] verbs: ["get", "watch", "list"]
ClusterRoleBinding を作成して、サービスアカウントの権限を設定します。
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.io
OpenTelemetry Collector インスタンスを作成します。
注記この Collector は、トレースを TempoStack インスタンスにエクスポートします。Red Hat Tempo Operator を使用して TempoStack インスタンスを作成し、正しいエンドポイントを配置する必要があります。
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: {} processors: batch: {} k8sattributes: {} memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 resourcedetection: detectors: [openshift] exporters: otlp: endpoint: "tempo-example-gateway:8090" tls: insecure: true service: pipelines: traces: receivers: [jaeger] processors: [memory_limiter, k8sattributes, resourcedetection, batch] exporters: [otlp]
- トレースエンドポイントを OpenTelemetry Operator に指定します。
トレースをアプリケーションから Jaeger に直接エクスポートする場合は、API エンドポイントを Jaeger エンドポイントから OpenTelemetry Collector エンドポイントに変更します。
Golang を使用する
jaegerexporter
でトレースをエクスポートする場合の例exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url))) 1
- 1
- URL は OpenTelemetry Collector API エンドポイントを指します。