5장. Red Hat build of OpenTelemetry 사용
OpenTelemetry의 Red Hat 빌드를 설정하고 사용하여 OpenTelemetry 수집기 또는 TempoStack에 추적을 보낼 수 있습니다.
5.1. OpenTelemetry 수집기를 사용하여 TempoStack으로 추적 전달 링크 복사링크가 클립보드에 복사되었습니다!
TempoStack으로 전달 추적을 구성하려면 OpenTelemetry 수집기를 배포하고 구성할 수 있습니다. 지정된 프로세서, 수신자 및 내보내기를 사용하여 배포 모드에서 OpenTelemetry 수집기를 배포할 수 있습니다. 다른 모드는 추가 리소스에 연결된 OpenTelemetry 수집기 설명서를 참조하십시오.
사전 요구 사항
- Red Hat build of OpenTelemetry Operator가 설치되어 있습니다.
- Tempo Operator가 설치되어 있습니다.
- TempoStack은 클러스터에 배포됩니다.
프로세스
OpenTelemetry 수집기의 서비스 계정을 생성합니다.
서비스 계정의 예
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment서비스 계정에 대한 클러스터 역할을 생성합니다.
클러스터 역할의 예
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"]클러스터 역할을 서비스 계정에 바인딩합니다.
클러스터 역할 바인딩 예
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: otel-collector subjects: - kind: ServiceAccount name: otel-collector-deployment namespace: otel-collector-example roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.ioYAML 파일을 생성하여
OpenTelemetryCollectorCR(사용자 정의 리소스)을 정의합니다.OpenTelemetry 수집기 예
apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: otel 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-simplest-distributor:4317"1 tls: insecure: true service: pipelines: traces: receivers: [jaeger, opencensus, otlp, zipkin]2 processors: [memory_limiter, k8sattributes, resourcedetection, batch] exporters: [otlp]
tracegen 을 테스트로 배포할 수 있습니다.
apiVersion: batch/v1
kind: Job
metadata:
name: tracegen
spec:
template:
spec:
containers:
- name: tracegen
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/tracegen:latest
command:
- "./tracegen"
args:
- -otlp-endpoint=otel-collector:4317
- -otlp-insecure
- -duration=30s
- -workers=1
restartPolicy: Never
backoffLimit: 4