Este conteúdo não está disponível no idioma selecionado.
Chapter 3. Distributed tracing and Service Mesh
3.1. Configuring Red Hat OpenShift distributed tracing platform with Service Mesh Copiar o linkLink copiado para a área de transferência!
Integrating Red Hat OpenShift distributed tracing platform with Red Hat OpenShift Service Mesh is made of up two parts: Red Hat OpenShift distributed tracing platform (Tempo) and Red Hat OpenShift distributed tracing data collection.
- Red Hat OpenShift distributed tracing platform (Tempo)
Provides distributed tracing to monitor and troubleshoot transactions in complex distributed systems. Tempo is based on the open source Grafana Tempo project.
For more about information about distributed tracing platform (Tempo), its features, installation, and configuration, see: Red Hat OpenShift distributed tracing platform (Tempo).
- Red Hat OpenShift distributed tracing data collection
Is based on the open source OpenTelemetry project, which aims to provide unified, standardized, and vendor-neutral telemetry data collection for cloud-native software. Red Hat OpenShift distributed tracing data collection product provides support for deploying and managing the OpenTelemetry Collector and simplifying the workload instrumentation.
The OpenTelemetry Collector can receive, process, and forward telemetry data in many formats, making it the ideal component for telemetry processing and interoperability between telemetry systems. The Collector provides a unified solution for collecting and processing metrics, traces, and logs.
For more information about distributed tracing data collection, its features, installation, and configuration, see: Red Hat OpenShift distributed tracing data collection.
3.1.1. Configuring Red Hat OpenShift distributed tracing data collection with Service Mesh Copiar o linkLink copiado para a área de transferência!
You can integrate Red Hat OpenShift Service Mesh with Red Hat OpenShift distributed tracing data collection to instrument, generate, collect, and export OpenTelemetry traces, metrics, and logs to analyze and understand the performance and behavior of the software.
Prerequisites
- You have installed the Tempo Operator. For more information see, Installing the Tempo Operator.
- You have installed the Red Hat OpenShift distributed tracing data collection Operator. For more information see, Installing the Red Hat build of OpenTelemetry.
-
You have installed a
TempoStackwhich is configured in atemponamespace. For more information see, Installing a TempoStack instance. - You have created an Istio instance.
- You have created an Istio CNI instance.
Procedure
Navigate to the Red Hat OpenShift distributed tracing data collection Operator and install the
OpenTelemetryCollectorresource in theistio-systemnamespace, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the Red Hat OpenShift Service Mesh Istio custom resource (CR) to enable tracing and define the distributed tracing data collection tracing providers in your
meshConfig, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
servicefield is theOpenTelemetrycollector service in theistio-systemnamespace.
Create an Istio Telemetry resource to enable tracers defined in
spec.values.meshConfig.ExtensionProviders, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow After you verify that you can see traces, lower the
randomSamplingPercentagevalue or set it todefaultto reduce the number of requests.NoteYou can use a single Istio Telemetry resource for both the Prometheus metrics provider and a tracing provider by setting
spec.metrics.overrides.disabledtofalse. This enables the Prometheus metrics provider. This is an optional step and you can skip it if you configured metrics through the OpenShift Cluster Monitoring method described in the previous step.Create the
bookinfonamespace by running the following command:oc create ns bookinfo
$ oc create ns bookinfoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Depending on the update strategy you are using, enable sidecar injection in the namespace by running the appropriate commands:
If you are using the
InPlaceupdate strategy, run the following command:oc label namespace curl istio-injection=enabled
$ oc label namespace curl istio-injection=enabledCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you are using the
RevisionBasedupdate strategy, run the following commands:Display the revision name by running the following command:
oc get istiorevisions.sailoperator.io
$ oc get istiorevisions.sailoperator.ioCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME TYPE READY STATUS IN USE VERSION AGE default Local True Healthy True v1.24.3 3m33s
NAME TYPE READY STATUS IN USE VERSION AGE default Local True Healthy True v1.24.3 3m33sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Label the namespace with the revision name to enable sidecar injection by running the following command:
oc label namespace curl istio.io/rev=default
$ oc label namespace curl istio.io/rev=defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Deploy the
bookinfoapplication in thebookinfonamespace by running the following command:oc apply -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfo
$ oc apply -f https://raw.githubusercontent.com/openshift-service-mesh/istio/release-1.24/samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Generate traffic to the
productpagepod to generate traces:oc exec -it -n bookinfo deployments/productpage-v1 -c istio-proxy -- curl localhost:9080/productpage
$ oc exec -it -n bookinfo deployments/productpage-v1 -c istio-proxy -- curl localhost:9080/productpageCopy to Clipboard Copied! Toggle word wrap Toggle overflow Validate the integration by running the following command to see traces in the UI:
oc get routes -n tempo tempo-sample-query-frontend
$ oc get routes -n tempo tempo-sample-query-frontendCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe OpenShift route for Jaeger UI must be created in the Tempo namespace. You can either manually create it for the
tempo-sample-query-frontendservice, or update theTempocustom resource with.spec.template.queryFrontend.jaegerQuery.ingress.type: route.
3.1.2. Configuring Red Hat OpenShift distributed tracing platform (Tempo) with Service Mesh ambient mode Copiar o linkLink copiado para a área de transferência!
You can configure a distributed tracing platform (Tempo) with OpenShift Service Mesh ambient mode by using waypoint or gateway proxies to generate Layer 7 (L7) spans. The ztunnel component generates only Layer 4 (L4) data, so L7 spans appear only when a workload or service uses an attached proxy.
Prerequisites
- You have installed the Tempo Operator. For more information see: Installing the Tempo Operator.
- You have installed the Red Hat OpenShift distributed tracing data collection Operator. For more information see: Installing the Red Hat build of OpenTelemetry
-
You have installed a
TempoStackwhich is configured in atemponamespace. For more information see: Installing a TempoStack instance. - You have created an Istio instance.
Procedure
Navigate to the Red Hat OpenShift distributed tracing data collection Operator and install the
OpenTelemetryCollectorresource in theistio-systemnamespace, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
spec.config.exporters.otlp.endpointdefines the Tempo sample distributor service in a namespace such astempo.
-
Update the Red Hat OpenShift Service Mesh Istio custom resource (CR) to define a tracing provider in the
spec.values.meshConfigfield, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
spec.values.meshConfig.extensionProviders.opentelemetry.servicedefines the OpenTelemetry collector service in theistio-systemnamespace.
-
Create an Istio Telemetry CR to enable the tracing provider defined in the
spec.values.meshConfig.ExtensionProvidersfield, similar to the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAfter you can see the traces, lower the
randomSamplingPercentagevalue or set it todefaultto reduce the number of requests. You can also use thespec.targetRefsfield to enable tracing at a gateway or a waypoint level.-
Optional: Use a single Istio Telemetry resource for both a Prometheus metrics provider and a tracing provider by setting
spec.metrics.overrides.disabledfield tofalse. This enables the Prometheus metrics provider. You do not need this step if you have configured metrics through the OpenShift Cluster Monitoring approach described in the previous step.
3.1.2.1. Verifying traces in ambient mode Copiar o linkLink copiado para a área de transferência!
You can verify that the traces for your application are in ambient mode. The following example uses the Bookinfo application.
Prerequisites
- You have deployed the Bookinfo application in ambient mode to use the following example. For more information, see Deploying the Bookinfo application in Istio ambient mode.
-
You have deployed a waypoint proxy and enrolled the
bookinfonamespace to use the waypoint. For more information, see Deploying a waypoint proxy.
Procedure
Send some traffic to the Bookinfo
productpageservice for generating traces by running the following command:curl "http://${GATEWAY_URL}/productpage" | grep "<title>"$ curl "http://${GATEWAY_URL}/productpage" | grep "<title>"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the Bookinfo application traces appear in a Tempo dashboard UI by running the following command:
oc get routes -n tempo tempo-sample-query-frontend
$ oc get routes -n tempo tempo-sample-query-frontendCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Select the
bookinfo-gateway-istio.booinfoor thewaypoint.bookinfoservice from the dashboard UI. Click Find Traces.
NoteThe route for Tempo dashboard UI can be created from the
TempoStackcustom resource (CR) with.spec.template.queryFrontend.jaegerQuery.ingress.type: routefield.