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.Chapter 5. Using the Red Hat build of OpenTelemetry
You can set up and use the Red Hat build of OpenTelemetry to send traces to the OpenTelemetry Collector or the TempoStack.
5.1. Forwarding traces to a TempoStack by using the OpenTelemetry Collector Copy linkLink copied to clipboard!
To configure forwarding traces to a TempoStack, you can deploy and configure the OpenTelemetry Collector. You can deploy the OpenTelemetry Collector in the deployment mode by using the specified processors, receivers, and exporters. For other modes, see the OpenTelemetry Collector documentation linked in Additional resources.
Prerequisites
- The Red Hat build of OpenTelemetry Operator is installed.
- The Tempo Operator is installed.
- A TempoStack is deployed on the cluster.
Procedure
Create a service account for the OpenTelemetry Collector.
Example ServiceAccount
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment
apiVersion: v1 kind: ServiceAccount metadata: name: otel-collector-deployment
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a cluster role for the service account.
Example ClusterRole
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Bind the cluster role to the service account.
Example ClusterRoleBinding
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the YAML file to define the
OpenTelemetryCollector
custom resource (CR).Example OpenTelemetryCollector
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The Collector exporter is configured to export OTLP and points to the Tempo distributor endpoint,
"tempo-simplest-distributor:4317"
in this example, which is already created. - 2
- The Collector is configured with a receiver for Jaeger traces, OpenCensus traces over the OpenCensus protocol, Zipkin traces over the Zipkin protocol, and OTLP traces over the GRPC protocol.
You can deploy tracegen
as a test:
5.2. Sending traces and metrics to the OpenTelemetry Collector Copy linkLink copied to clipboard!
Sending traces and metrics to the OpenTelemetry Collector is possible with or without sidecar injection.
5.2.1. Sending traces and metrics to the OpenTelemetry Collector with sidecar injection Copy linkLink copied to clipboard!
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 (Tempo) 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-admin
role. -
An active OpenShift CLI (
oc
) session by a cluster administrator with thecluster-admin
role. -
For Red Hat OpenShift Dedicated, you must have an account with the
dedicated-admin
role.
-
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: observability
Copy 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: observability
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the permissions to the service account for the
k8sattributes
andresourcedetection
processors.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-sidecar
service account. -
Add the
sidecar.opentelemetry.io/inject: "true"
annotation to yourDeployment
object. This will inject all the needed environment variables to send data from your workloads to the OpenTelemetry Collector instance.
5.2.2. Sending traces and metrics to the OpenTelemetry Collector without sidecar injection Copy linkLink copied to clipboard!
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 (Tempo) 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-admin
role. -
An active OpenShift CLI (
oc
) session by a cluster administrator with thecluster-admin
role. -
For Red Hat OpenShift Dedicated, you must have an account with the
dedicated-admin
role.
-
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: observability
Copy 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: observability
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Grant the permissions to the service account for the
k8sattributes
andresourcedetection
processors.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the OpenTelemetry Collector instance with the
OpenTelemetryCollector
custom 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_NAME
OTEL_SERVICE_NAME
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sets the value of the
service.name
resource attribute.""
OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_ENDPOINT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Base endpoint URL for any signal type with an optionally specified port number.
https://localhost:4317
OTEL_EXPORTER_OTLP_CERTIFICATE
OTEL_EXPORTER_OTLP_CERTIFICATE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Path to the certificate file for the TLS credentials of the gRPC client.
https://localhost:4317
OTEL_TRACES_SAMPLER
OTEL_TRACES_SAMPLER
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sampler to be used for traces.
parentbased_always_on
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_PROTOCOL
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Transport protocol for the OTLP exporter.
grpc
OTEL_EXPORTER_OTLP_TIMEOUT
OTEL_EXPORTER_OTLP_TIMEOUT
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Maximum time interval for the OTLP exporter to wait for each batch export.
10s
OTEL_EXPORTER_OTLP_INSECURE
OTEL_EXPORTER_OTLP_INSECURE
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Disables client transport security for gRPC requests. An HTTPS schema overrides it.
False