Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Sending traces, logs, and metrics to the OpenTelemetry Collector
You can set up and use the Red Hat build of OpenTelemetry to send traces, logs, and metrics to the OpenTelemetry Collector or the TempoStack instance.
Sending traces and metrics to the OpenTelemetry Collector is possible with or without sidecar injection.
6.1. Sending traces and metrics to the OpenTelemetry Collector with sidecar injection Copia collegamentoCollegamento copiato negli appunti!
You can set up sending telemetry data to an OpenTelemetry Collector instance with sidecar injection.
The Red Hat build of OpenTelemetry Operator allows sidecar injection into deployment workloads and automatic configuration of your instrumentation to send telemetry data to the OpenTelemetry Collector.
Prerequisites
- The Red Hat OpenShift Distributed Tracing Platform is installed, and a TempoStack instance is deployed.
You have access to the cluster through the web console or the OpenShift CLI (
oc):-
You are logged in to the web console as a cluster administrator with the
cluster-adminrole. -
An active OpenShift CLI (
oc) session by a cluster administrator with thecluster-adminrole. -
For Red Hat OpenShift Dedicated, you must have an account with the
dedicated-adminrole.
-
You are logged in to the web console as a cluster administrator with the
Procedure
Create a project for an OpenTelemetry Collector instance.
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observability
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observabilityCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a service account.
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-sidecar namespace: observability
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-sidecar namespace: observabilityCopy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the permissions to the service account for the
k8sattributesandresourcedetectionprocessors.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the OpenTelemetry Collector as a sidecar.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- This points to the Gateway of the TempoStack instance deployed by using the
<example>Tempo Operator.
-
Create your deployment using the
otel-collector-sidecarservice account. -
Add the
sidecar.opentelemetry.io/inject: "true"annotation to yourDeploymentobject. This will inject all the needed environment variables to send data from your workloads to the OpenTelemetry Collector instance.
6.2. Sending traces and metrics to the OpenTelemetry Collector without sidecar injection Copia collegamentoCollegamento copiato negli appunti!
You can set up sending telemetry data to an OpenTelemetry Collector instance without sidecar injection, which involves manually setting several environment variables.
Prerequisites
- The Red Hat OpenShift Distributed Tracing Platform is installed, and a TempoStack instance is deployed.
You have access to the cluster through the web console or the OpenShift CLI (
oc):-
You are logged in to the web console as a cluster administrator with the
cluster-adminrole. -
An active OpenShift CLI (
oc) session by a cluster administrator with thecluster-adminrole. -
For Red Hat OpenShift Dedicated, you must have an account with the
dedicated-adminrole.
-
You are logged in to the web console as a cluster administrator with the
Procedure
Create a project for an OpenTelemetry Collector instance.
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observability
apiVersion: project.openshift.io/v1 kind: Project metadata: name: observabilityCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a service account.
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observability
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment namespace: observabilityCopy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the permissions to the service account for the
k8sattributesandresourcedetectionprocessors.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the OpenTelemetry Collector instance with the
OpenTelemetryCollectorcustom resource.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- This points to the Gateway of the TempoStack instance deployed by using the
<example>Tempo Operator.
Set the environment variables in the container with your instrumented application.
Expand Name Description Default value OTEL_SERVICE_NAMESets the value of the
service.nameresource attribute.""OTEL_EXPORTER_OTLP_ENDPOINTBase endpoint URL for any signal type with an optionally specified port number.
https://localhost:4317OTEL_EXPORTER_OTLP_CERTIFICATEPath to the certificate file for the TLS credentials of the gRPC client.
https://localhost:4317OTEL_TRACES_SAMPLERSampler to be used for traces.
parentbased_always_onOTEL_EXPORTER_OTLP_PROTOCOLTransport protocol for the OTLP exporter.
grpcOTEL_EXPORTER_OTLP_TIMEOUTMaximum time interval for the OTLP exporter to wait for each batch export.
10sOTEL_EXPORTER_OTLP_INSECUREDisables client transport security for gRPC requests. An HTTPS schema overrides it.
False