The environment is the following:
-
Demo apps:
-
OpenTelemetry Collector
-
Jaeger
-
Prometheus
-
Apache Kafka (for async communication between apps cases)
You will need to compile this example first:
mvn compileAll the following docker-compose commands should be run from this directory.
You may want to remove any old containers to start cleaning:
docker rm -f kafka zookeeper prometheus jaeger otel-collectorWe suggest using multiple terminal windows to start the following components:
-
Infrastructure components
-
Demo apps
-
TripBooking
-
FlightBooking
-
HotelBooking
-
CarBooking
-
-
Testing for sending HTTP requests
Please use four different shells for each application:
You can use any HTTP client (web browser, curl, httpie, postman etc.) for testing purposes.
-
Prometheus UI: http://localhost:9090/graph
-
Jaeger UI: http://localhost:16686
MDC Logging is enabled, and tracing information printing into the logs to be able to find corresponding trace logs entries. For example:
...
11:52:18.923 INFO [d02a363f16e88d9f012a36563b5464f5,9a328d33319645ab] bookTrip-http - New book trip request with trace=00-d02a363f16e88d9f012a36563b5464f5-9570717e10d38afa-01
11:52:18.931 INFO [d02a363f16e88d9f012a36563b5464f5,9a328d33319645ab] bookTrip-http - Response: [{"bookingId":82,"car":"Volkswagen Jetta","startDate":"12-11-2018","endDate":"15-11-2018","price":152}, {"bookingId":907,"flight":"China Eastern Airlines 2782","startDate":"12-11-2018","endDate":"15-11-2018","price":133}, {"bookingId":926,"hotel":"Sheraton","startDate":"12-11-2018","endDate":"15-11-2018","price":200}]
...-
occlient installed (guide) -
already logged in into cluster (running
oc login) -
destination project already created (running
oc new-project otel-example)
Create kafka cluster named otel-cluster:
oc apply -f ocp/kafka.yamlCreate tempo monolithic named monolitic-example as distributed tracing storage:
oc apply -f ocp/tempo.yamlCreate roles to send traces via Collector, to the Tempo
oc apply -f ocp/roles.yamlCreate opentelemetry collector named otel-example used to collect everything coming from the agent on the applications and exporting the traces into the tempo storage and the metrics in a prometheus format:
oc apply -f ocp/otel-collector.yamlCreate the opentelementry instrumentation to allow to inject the agent parameter into the startup command in the application
oc apply -f ocp/otel-instrumentation.yamlInstall the distributed tracing UI plugin to show the traces on the OCP console doc
oc apply -f ocp/ui-plugin.yamlCreate the service monitor to allow the prometheus metrics exposed by the opentelemetry collector be scraped by the OpenShift metrics storage
oc apply -f ocp/service-monitor.yamlmvn clean install -Popenshift -DskipTestsnow once the pods are ready it is possible to call the Trip Booking entry point
Sync communication (over HTTP):
curl http://$(oc get route trip-booking -o go-template --template='{{.spec.host}}')/camel/bookTripAsync communication (over Kafka):
curl http://$(oc get route trip-booking -o go-template --template='{{.spec.host}}')/camel/asyncBookTripThe Distributed Tracing console is available on the OpenShift console in the Observe → Traces item
echo $(oc whoami --show-console)/observe/tracesTo query the metrics it is possible to use the integrated OpenShift monitoring console in the Observe → Metrics item
echo $(oc whoami --show-console)/monitoring/query-browsera query like
sum(camel_route_exchange_completed_total{service="otel-example-collector-headless"}) by(exported_job)to see the total exchanges for each service or just the mean time for each route
camel_route_exchange_processing_mean_time_milliseconds{service="otel-example-collector-headless"}will show you the exchanges for each route on each application
All the metrics for Camel JMX rules are available at Camel Metrics
If you hit any problem using Camel or have some feedback, then please let us know.
We also love contributors, so get involved :-)
The Camel riders!






