= Prometheus Trait

// Start of autogenerated code - DO NOT EDIT! (badges)
// End of autogenerated code - DO NOT EDIT! (badges)
// Start of autogenerated code - DO NOT EDIT! (description)
The Prometheus trait configures a Prometheus-compatible endpoint. It also creates a `PodMonitor` resource,
so that the endpoint can be scraped automatically, when using the Prometheus operator.

The metrics are exposed using Micrometer Metrics.

WARNING: The creation of the `PodMonitor` resource requires the https://github.com/coreos/prometheus-operator[Prometheus Operator]
custom resource definition to be installed.
You can set `pod-monitor` to `false` for the Prometheus trait to work without the Prometheus Operator.

WARNING: By default the metrics API is not available in JSON

The Prometheus trait is disabled by default.


This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.

// End of autogenerated code - DO NOT EDIT! (description)
// Start of autogenerated code - DO NOT EDIT! (configuration)
== Configuration

Trait properties can be specified when running any integration with the CLI:
[source,console]
----
$ kamel run --trait prometheus.[key]=[value] --trait prometheus.[key2]=[value2] integration.yaml
----
The following configuration options are available:

[cols="2m,1m,5a"]
|===
|Property | Type | Description

| prometheus.enabled
| bool
| Can be used to enable or disable a trait. All traits share this common property.

| prometheus.pod-monitor
| bool
| Whether a `PodMonitor` resource is created (default `true`).

| prometheus.pod-monitor-labels
| []string
| The `PodMonitor` resource labels, applicable when `pod-monitor` is `true`.

|===

// End of autogenerated code - DO NOT EDIT! (configuration)
== Examples

* To activate the metrics and default scrapping through a new PodMonitor:
+
[source,console]
$ kamel run -t prometheus.enable=true ...

* To activate the metrics when the Prometheus Operator is not available:
+
[source,console]
$ kamel run -t prometheus.enable=true -t pod-monitor=false ...

* To activate the metrics with JSON format available :
+
[source,console]
$ kamel run -t prometheus.enable=true -t builder.properties="quarkus.micrometer.export.json.enabled=true"...
