== Micrometer Observation Example

=== Introduction

This example shows how to use Camel with Micrometer Observation to create observations for
incoming and outgoing Camel messages.

For Metrics we are using Micrometer Core, for Tracing we're using Micrometer Tracing with OpenTelemetry.

The example includes four sub maven modules that implement

* client
* service1
* service2
* loggingtracer

Where client -> service1 -> service2 using HTTP.

=== Build in the local environment

You will need to package this example first:

[source,sh]
----
$ mvn package
----

=== Run the example

Then using three different shells and run service1 and service2 before
the client. These services use an annotation _CamelObservation_ to
indicate that the service should be traced.

[source,sh]
----
$ java -jar service1/target/*.jar
----

When service1 is ready then start service2

[source,sh]
----
$ java -jar service2/target/*.jar
----

And then start the client that calls service1 every 30 seconds.

[source,sh]
----
$ java -jar client/target/*.jar
----

The client application explicitly instantiates and initializes the
Micrometer Observation Tracer with the _CamelContext_.

The shells will show _OBSERVATION EVENT_ messages indicating what event have
been observed.

=== Outcome

Running the docker containers using docker compose it is possible
to access to Prometheus, Jaeger and Grafana

[source,sh]
----
$ cd containers
$ docker-compose up
----

Jaeger: http://localhost:16686/

Prometheus: http://localhost:9090/

Grafana: http://localhost:3000/

=== Build and deploy on OpenShift

Refer to xref:ocp/README.adoc[dedicated guide]

=== Help and contributions

If you hit any problem using Camel or have some feedback, then please
https://camel.apache.org/community/support/[let us know].

We also love contributors, so
https://camel.apache.org/community/contributing/[get involved] :-)

The Camel riders!
