jamesnetherton commented on code in PR #499: URL: https://github.com/apache/camel-quarkus-examples/pull/499#discussion_r3166184405
########## observability/README.adoc: ########## @@ -146,27 +146,155 @@ You can also directly leverage MicroProfile Health APIs to create checks. Class To be able to diagnose problems in Camel Quarkus applications, it's useful to instrument method calls, HTTP interactions etc with OpenTelemetry. -If you are running example in the Development mode, then Observability dev service is enabled (for more information, visit https://quarkus.io/guides/observability-devservices-lgtm[Observability Dev Services with Grafana OTel LGTM]). -Observability dev service will run OTel collector in the background and the `quarkus.otel.exporter.otlp.endpoint` property is automatically set to the OTel collector endpoint as seen from the outside of the Docker container. +This example is pre-configured to send traces to Tempo via OTLP on `http://localhost:4317`. The behavior differs based on how you run the application: -In production you would rather configure real OTel collector and you would configure the OpenTelemetry exporter in `application.properties` as follows: +==== Dev Mode (quarkus:dev) + +When running `mvn clean compile quarkus:dev`, the Quarkus Observability dev service is automatically enabled (see https://quarkus.io/guides/observability-devservices-lgtm[Observability Dev Services with Grafana OTel LGTM]). + +The dev service automatically: +- Starts a Grafana LGTM container with Tempo for tracing +- Overrides the `quarkus.otel.exporter.otlp.traces.endpoint` property to point to the dev service container +- Assigns a random port to Grafana (check logs for `grafana.endpoint=http://localhost:XXXXX`) + +To view traces in dev mode, find the Grafana endpoint in logs and browse to it. + +==== Docker Compose Mode (Recommended) + +When running the packaged application with Docker Compose (see Grafana Dashboards section above), traces are sent to the Tempo container at `localhost:4317`. + +The OpenTelemetry configuration in `application.properties` is already set: [source, text] ---- -# We are using a property placeholder to be able to use this example in convenient way in a cloud environment -quarkus.otel.exporter.otlp.traces.endpoint = http://${TELEMETRY_COLLECTOR_COLLECTOR_SERVICE_HOST:localhost}:4317 -# To enable tracing (it is disabled by default via camel-quarkus-observability-services) +quarkus.otel.exporter.otlp.traces.endpoint = http://localhost:4317 quarkus.otel.sdk.disabled=false ---- +Traces are automatically visible in Grafana at http://localhost:3000. + +==== Cloud/Kubernetes Deployment + +For cloud or Kubernetes deployments, override the OTLP endpoint using an environment variable: + +[source, shell] +---- +export QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://tempo-service:4317 +---- + +Or use property placeholders in `application.properties`: + +[source, text] +---- +quarkus.otel.exporter.otlp.traces.endpoint = http://${TEMPO_HOST:localhost}:4317 +---- + NOTE: For information about other OpenTelemetry exporters, refer to the Camel Quarkus OpenTelemetry https://camel.apache.org/camel-quarkus/next/reference/extensions/opentelemetry.html#extensions-opentelemetry-usage-exporters[extension documentation]. -To view tracing events find `grafana.endpoint` in your log (it will use random port) browse to eg. http://localhost:32768. -Then follow instructions at https://quarkus.io/guides/observability-devservices-lgtm#explore. +==== Understanding Traces The `platform-http` consumer route introduces a random delay to simulate latency, hence the overall time of each trace should be different. When viewing a trace, you should see a hierarchy of 8 spans showing the progression of the message exchange through each endpoint. +=== Grafana Dashboards + +This example includes a pre-configured Grafana dashboard to visualize metrics, distributed traces, and JVM statistics. + +==== Quick Start with Docker Compose (Recommended) + +The easiest way to visualize the dashboard with working metrics is using Docker Compose with static ports: + +[source,shell] +---- +# Start the observability stack (Grafana, Prometheus, Tempo) +$ docker-compose -f src/main/docker/docker-compose-grafana.yml up -d Review Comment: Nitpick - Replace references to `docker-compose` with `docker compose`. It's the preferred way of running it now IIRC. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
