// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-microprofile-metrics"]
= MicroProfile Metrics
:page-aliases: extensions/microprofile-metrics.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-microprofile-metrics
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Expose metrics from Camel routes.
:cq-deprecated: false
:cq-jvm-since: 0.2.0
:cq-native-since: 0.2.0

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##0.2.0## [.badge-key]##Native since##[.badge-supported]##0.2.0##
endif::[]

Expose metrics from Camel routes.

[id="extensions-microprofile-metrics-whats-inside"]
== What's inside

* xref:{cq-camel-components}::microprofile-metrics-component.adoc[MicroProfile Metrics component], URI syntax: `microprofile-metrics:metricType:metricName`

Please refer to the above link for usage and configuration details.

[id="extensions-microprofile-metrics-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-microprofile-metrics[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-microprofile-metrics</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-microprofile-metrics-usage"]
== Usage
The xref:{cq-camel-components}::microprofile-metrics-component.adoc[microprofile-metrics] component automatically exposes a set of Camel application metrics. Some of these include:

[id="extensions-microprofile-metrics-usage-camel-context-metrics"]
=== Camel Context metrics

[cols="80,.^20]
|===
|Metric Name | Type

|`camel.context.status`

The status of the Camel Context represented by the `ServiceStatus` enum ordinal

| Gauge

|`camel.context.uptime`

The Camel Context uptime in milliseconds

| Gauge

|`camel.context.exchanges.completed.total`

The total number of completed exchanges

| Counter

|`camel.context.exchanges.failed.total`

The total number of failed exchanges

| Counter

|`camel.context.exchanges.inflight.total`

The total number of inflight exchanges

| Gauge

|`camel.context.exchanges.total`

The total number of all exchanges

| Counter

|`camel.context.externalRedeliveries.total`

The total number of all external redeliveries

| Counter

|`camel.context.failuresHandled.total`

The total number of all failures handled

| Counter

|===

[id="extensions-microprofile-metrics-usage-camel-route-metrics"]
=== Camel Route metrics

[cols="80,.^20]
|===
|Metric Name | Type

|`camel.route.count`

The number of routes

| Gauge

|`camel.route.running.count`

The number of running routes

| Gauge

|`camel.route.exchanges.completed.total`

The total number of completed exchanges for the route

| Counter

|`camel.route.exchanges.failed.total`

The total number of failed exchanges for the route

| Counter

|`camel.route.exchanges.inflight.total`

The total number of inflight exchanges for the route

| Gauge

|`camel.route.exchanges.total`

The total number of all exchanges for the route

| Counter

|`camel.route.externalRedeliveries.total`

The total number of all external redeliveries for the route

| Counter

|`camel.route.failuresHandled.total`

The total number of all failures handled for the route

| Counter
|===

All metrics are tagged with the name of the Camel Context and the id of the route where applicable.

You can also produce your own customized metrics in your Camel routes. For more information, refer to the xref:{cq-camel-components}::microprofile-metrics-component.adoc[microprofile-metrics] component documentation.

Metrics are exposed to Quarkus as application metrics and they can be browsed at http://localhost:8080/q/metrics/application.


[id="extensions-microprofile-metrics-additional-camel-quarkus-configuration"]
== Additional Camel Quarkus configuration

[width="100%",cols="80,5,15",options="header"]
|===
| Configuration property | Type | Default


|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-route-policy]]`link:#quarkus.camel.metrics.enable-route-policy[quarkus.camel.metrics.enable-route-policy]`

Set whether to enable the MicroProfileMetricsRoutePolicyFactory for capturing metrics on route processing times.
| `boolean`
| `true`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-message-history]]`link:#quarkus.camel.metrics.enable-message-history[quarkus.camel.metrics.enable-message-history]`

Set whether to enable the MicroProfileMetricsMessageHistoryFactory for capturing metrics on individual route node processing times. Depending on the number of configured route nodes, there is the potential to create a large volume of metrics. Therefore, this option is disabled by default.
| `boolean`
| `false`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-exchange-event-notifier]]`link:#quarkus.camel.metrics.enable-exchange-event-notifier[quarkus.camel.metrics.enable-exchange-event-notifier]`

Set whether to enable the MicroProfileMetricsExchangeEventNotifier for capturing metrics on exchange processing times.
| `boolean`
| `true`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-route-event-notifier]]`link:#quarkus.camel.metrics.enable-route-event-notifier[quarkus.camel.metrics.enable-route-event-notifier]`

Set whether to enable the MicroProfileMetricsRouteEventNotifier for capturing metrics on the total number of routes and total number of routes running.
| `boolean`
| `true`

|icon:lock[title=Fixed at build time] [[quarkus.camel.metrics.enable-camel-context-event-notifier]]`link:#quarkus.camel.metrics.enable-camel-context-event-notifier[quarkus.camel.metrics.enable-camel-context-event-notifier]`

Set whether to enable the MicroProfileMetricsCamelContextEventNotifier for capturing metrics about the CamelContext, such as status and uptime.
| `boolean`
| `true`
|===

[.configuration-legend]
{doc-link-icon-lock}[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.

