Skip to content

Latest commit

 

History

History
155 lines (108 loc) · 3.42 KB

File metadata and controls

155 lines (108 loc) · 3.42 KB

OpenTelemetry example

Introduction

This example shows how to use Camel with OpenTelemetry standard: example

The environment is the following:

Build

You will need to compile this example first:

mvn compile

All the following docker-compose commands should be run from this directory.

Run the example

You may want to remove any old containers to start cleaning:

docker rm -f kafka zookeeper prometheus jaeger otel-collector

We suggest using multiple terminal windows to start the following components:

  • Infrastructure components

  • Demo apps

    • TripBooking

    • FlightBooking

    • HotelBooking

    • CarBooking

  • Testing for sending HTTP requests

Startup infrastructure components

docker-compose -f containers/docker-compose.yml up

Startup demo apps

Please use four different shells for each application:

CarBooking
mvn clean spring-boot:run -f CarBooking/pom.xml
HotelBooking
mvn clean spring-boot:run -f HotelBooking/pom.xml
FlightBooking
mvn clean spring-boot:run -f FlightBooking/pom.xml
TripBooking
mvn clean spring-boot:run -f TripBooking/pom.xml

Testing

You can use any HTTP client (web browser, curl, httpie, postman etc.) for testing purposes.

cURL

Sync communication (over HTTP):

curl http://127.0.0.1:8080/camel/bookTrip

Async communication (over Kafka):

curl http://127.0.0.1:8080/camel/asyncBookTrip

Outcome

Tracing

Sync case

You should get a trace view similar to this one:

trace sync

DAG is the following:

trace sync dag
Async case

You should get a trace view similar to this one:

trace async

DAG is the following:

trace async dag

Metrics

You will get Camel-related metrics similar to these:

metrics

Logging

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}]
...

Help and contributions

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!