5.3. 분산 추적 데이터 수집 사용
5.3.1. OpenTelemetry 수집기를 사용하여 TempoStack으로 추적 전달 링크 복사링크가 클립보드에 복사되었습니다!
TempoStack으로 전달 추적을 구성하려면 OpenTelemetry 수집기를 배포하고 구성할 수 있습니다. 지정된 프로세서, 수신자 및 내보내기를 사용하여 배포 모드에서 OpenTelemetry 수집기를 배포할 수 있습니다. 다른 모드는 추가 리소스에 연결된 OpenTelemetry 수집기 설명서를 참조하십시오.
전제 조건
- Red Hat OpenShift distributed tracing data collection Operator가 설치되어 있습니다.
- Tempo Operator가 설치되어 있습니다.
- TempoStack은 클러스터에 배포됩니다.
프로세스
OpenTelemetry 수집기의 서비스 계정을 생성합니다.
ServiceAccount의 예
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment서비스 계정에 대한 클러스터 역할을 생성합니다.
ClusterRole의 예
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: otel-collector-example roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.ioYAML 파일을 생성하여
OpenTelemetryCollectorCR(사용자 정의 리소스)을 정의합니다.OpenTelemetryCollector 예
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
5.3.2. OpenTelemetry 수집기에 추적 및 메트릭 전송 링크 복사링크가 클립보드에 복사되었습니다!
사이드카 삽입을 사용하거나 사용하지 않고 추적 및 메트릭을 OpenTelemetry 수집기로 보낼 수 있습니다.
5.3.2.1. 사이드카 삽입을 사용하여 추적 및 메트릭을 OpenTelemetry 수집기로 전송 링크 복사링크가 클립보드에 복사되었습니다!
사이드카 삽입을 사용하여 OpenTelemetryCollector 인스턴스로 Telemetry 데이터를 보낼 수 있습니다.
Red Hat OpenShift distributed tracing data collection Operator를 사용하면 배포 워크로드에 사이드카를 삽입하고 계측을 자동으로 구성하여 Telemetry 데이터를 OpenTelemetry 수집기로 보낼 수 있습니다.
전제 조건
- Red Hat OpenShift distributed tracing platform(Tempo)이 설치되고 TempoStack 인스턴스가 배포됩니다.
웹 콘솔 또는 OpenShift CLI(
oc)를 통해 클러스터에 액세스할 수 있습니다.-
cluster-admin역할의 클러스터 관리자로 웹 콘솔에 로그인되어 있습니다. -
cluster-admin역할의 클러스터 관리자가 활성 OpenShift CLI(oc) 세션입니다. -
Red Hat OpenShift Dedicated의 경우
dedicated-admin역할의 계정이 있어야 합니다.
-
프로세스
OpenTelemtry 수집기에 대한 프로젝트를 생성합니다.
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observability서비스 계정을 생성합니다.
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-sidecar 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-sidecar namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.ioOpenTelemetry 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"1 tls: insecure: true service: pipelines: traces: receivers: [jaeger] processors: [memory_limiter, resourcedetection, batch] exporters: [otlp]- 1
- 이는 Tempo Operator를 사용하여
<example>배포된 TempoStack 인스턴스의 게이트웨이를 가리킵니다.
-
otel-collector-sidecar서비스 계정을 사용하여 배포를 생성합니다. -
Deployment오브젝트에sidecar.opentelemetry.io/inject: "true"주석을 추가합니다. 이렇게 하면 워크로드에서 OpenTelemetryCollector 인스턴스로 데이터를 보내는 데 필요한 모든 환경 변수가 삽입됩니다.
5.3.2.2. 사이드카 삽입 없이 OpenTelemetry 수집기에 추적 및 메트릭 전송 링크 복사링크가 클립보드에 복사되었습니다!
여러 환경 변수를 수동으로 설정해야 하는 사이드카 삽입 없이 OpenTelemetryCollector 인스턴스로 Telemetry 데이터를 보낼 수 있습니다.
전제 조건
- Red Hat OpenShift distributed tracing platform(Tempo)이 설치되고 TempoStack 인스턴스가 배포됩니다.
웹 콘솔 또는 OpenShift CLI(
oc)를 통해 클러스터에 액세스할 수 있습니다.-
cluster-admin역할의 클러스터 관리자로 웹 콘솔에 로그인되어 있습니다. -
cluster-admin역할의 클러스터 관리자가 활성 OpenShift CLI(oc) 세션입니다. -
Red Hat OpenShift Dedicated의 경우
dedicated-admin역할의 계정이 있어야 합니다.
-
프로세스
OpenTelemtry 수집기에 대한 프로젝트를 생성합니다.
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 namespace: observability roleRef: kind: ClusterRole name: otel-collector apiGroup: rbac.authorization.k8s.ioOpenTelemetryCollector 인스턴스를 배포합니다.
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]- 1
- 이는 Tempo Operator를 사용하여
<example>배포된 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