blob: 5573b33830b3c3deba06cb1314d049132b50f2b5 [file] [log] [blame]
== Metrics
This example shows using Micrometer metrics with Camel JBang.
=== Install JBang
First install JBang according to https://www.jbang.dev
When JBang is installed then you should be able to run from a shell:
[source,sh]
----
$ jbang --version
----
This will output the version of JBang.
To run this example you can either install Camel on JBang via:
[source,sh]
----
$ jbang app install camel@apache/camel
----
Which allows to run CamelJBang with `camel` as shown below.
=== How to run
Then you can run this example using:
[source,sh]
----
$ camel run metrics.yaml
----
Or run with JBang using the longer command line (without installing camel as app in JBang):
[source,sh]
----
$ jbang camel@apache/camel run metrics.yaml
----
=== Run directly from github
The example can also be run directly by referring to the github URL as shown:
[source,sh]
----
$ jbang camel@apache/camel run https://github.com/apache/camel-kamelets-examples/tree/main/jbang/metrics
----
=== Developer Web Console
You can enable the developer console via `--console` flag as show:
[source,sh]
----
$ camel run metrics.yaml --console
----
Then you can browse: http://localhost:8080/q/dev to introspect the running Camel application,
such as browsing the micrometer, where you can see the captured statistics.
The web console outputs data in text/html by default when using a web browser.
However you can obtain the data in JSon format such as the micrometer with the following curl command:
[source,bash]
----
curl -s -H "Accept: application/json" http://localhost:8080/q/dev/micrometer
----
And if you have `jq` installed to nicely format and output JSon in color then run:
[source,bash]
----
curl -s -H "Accept: application/json" http://localhost:8080/q/dev/micrometer | jq
----
The metrics can also be displayed from the shell via:
[source,sh]
----
$ camel get metric
----
=== 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!