This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 4c5c9633c39083de8b5dec9dd291340a69d12a9d
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Wed Jan 22 15:53:55 2020 +0100

    chore(trait): Use container args to configure Prometheus agent
---
 deploy/prometheus-jmx-exporter.yaml            | 586 +++++++++++++++++++++
 deploy/resources.go                            | 673 +++++++++++++++++++++++--
 docs/modules/ROOT/pages/traits/prometheus.adoc |   9 +-
 pkg/apis/camel/v1/integration_types_support.go |  20 +
 pkg/trait/prometheus.go                        |  83 ++-
 pkg/trait/prometheus_test.go                   |  26 +-
 6 files changed, 1312 insertions(+), 85 deletions(-)

diff --git a/deploy/prometheus-jmx-exporter.yaml 
b/deploy/prometheus-jmx-exporter.yaml
new file mode 100644
index 0000000..aff0fc9
--- /dev/null
+++ b/deploy/prometheus-jmx-exporter.yaml
@@ -0,0 +1,586 @@
+startDelaySecs: 5
+ssl: false
+blacklistObjectNames: ["java.lang:*"]
+rules:
+  # Context level
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      type: context
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      type: context
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=consumers, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+
+
+  # Route level
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+
+  # Processor level
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+
+  # Consumers
+  - pattern: 'org.apache.camel<context=([^,]+), type=consumers, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      consumer: $2
+      type: consumers
+    type: GAUGE
+
+  # Services
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MaxDuration'
+    name: org.apache.camel.MaxDuration
+    help: Maximum Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MeanDuration'
+    name: org.apache.camel.MeanDuration
+    help: Mean Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MinDuration'
+    name: org.apache.camel.MinDuration
+    help: Minimum Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>TotalDuration'
+    name: org.apache.camel.TotalDuration
+    help: Total Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>ThreadsBlocked'
+    name: org.apache.camel.ThreadsBlocked
+    help: Threads Blocked
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>ThreadsInterrupted'
+    name: org.apache.camel.ThreadsInterrupted
+    help: Threads Interrupted
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumLogicalRuntimeFaults'
+    name: org.apache.cxf.NumLogicalRuntimeFaults
+    help: Number of logical runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumLogicalRuntimeFaults'
+    name: org.apache.cxf.NumLogicalRuntimeFaults
+    help: Number of logical runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>AvgResponseTime'
+    name: org.apache.cxf.AvgResponseTime
+    help: Average Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>AvgResponseTime'
+    name: org.apache.cxf.AvgResponseTime
+    help: Average Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumInvocations'
+    name: org.apache.cxf.NumInvocations
+    help: Number of invocations
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumInvocations'
+    name: org.apache.cxf.NumInvocations
+    help: Number of invocations
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MaxResponseTime'
+    name: org.apache.cxf.MaxResponseTime
+    help: Maximum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>MaxResponseTime'
+    name: org.apache.cxf.MaxResponseTime
+    help: Maximum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MinResponseTime'
+    name: org.apache.cxf.MinResponseTime
+    help: Minimum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MinResponseTime'
+    name: org.apache.cxf.MinResponseTime
+    help: Minimum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>TotalHandlingTime'
+    name: org.apache.cxf.TotalHandlingTime
+    help: Total Handling Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>TotalHandlingTime'
+    name: org.apache.cxf.TotalHandlingTime
+    help: Total Handling Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumRuntimeFaults'
+    name: org.apache.cxf.NumRuntimeFaults
+    help: Number of runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumRuntimeFaults'
+    name: org.apache.cxf.NumRuntimeFaults
+    help: Number of runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumUnCheckedApplicationFaults'
+    name: org.apache.cxf.NumUnCheckedApplicationFaults
+    help: Number of unchecked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumUnCheckedApplicationFaults'
+    name: org.apache.cxf.NumUnCheckedApplicationFaults
+    help: Number of unchecked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumCheckedApplicationFaults'
+    name: org.apache.cxf.NumCheckedApplicationFaults
+    help: Number of checked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumCheckedApplicationFaults'
+    name: org.apache.cxf.NumCheckedApplicationFaults
+    help: Number of checked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
\ No newline at end of file
diff --git a/deploy/resources.go b/deploy/resources.go
index 60513dc..04dc010 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -19,8 +19,6 @@ limitations under the License.
 
 package deploy
 
-var Resources map[string]string
-
 func init() {
        Resources = make(map[string]string)
 
@@ -7971,6 +7969,46 @@ spec:
       - org.apache.camel.dataformat.zipfile.ZipFileDataFormat
 
 `
+       Resources["cr-example.yaml"] =
+               `
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Integration
+metadata:
+  name: example
+spec:
+  sources:
+  - content: |-
+      // This is Camel K Groovy example route
+
+      rnd = new Random()
+
+      from('timer:groovy?period=1s')
+          .routeId('groovy')
+          .setBody()
+              .constant('Hello Camel K!')
+          .process {
+              it.in.headers['RandomValue'] = rnd.nextInt()
+          }
+          .to('log:info?showHeaders=true')
+    name: routes.groovy
+`
        Resources["crd-build.yaml"] =
                `
 # ---------------------------------------------------------------------------
@@ -8272,46 +8310,6 @@ spec:
       JSONPath: .status.replicas
 
 `
-       Resources["cr-example.yaml"] =
-               `
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-apiVersion: camel.apache.org/v1
-kind: Integration
-metadata:
-  name: example
-spec:
-  sources:
-  - content: |-
-      // This is Camel K Groovy example route
-
-      rnd = new Random()
-
-      from('timer:groovy?period=1s')
-          .routeId('groovy')
-          .setBody()
-              .constant('Hello Camel K!')
-          .process {
-              it.in.headers['RandomValue'] = rnd.nextInt()
-          }
-          .to('log:info?showHeaders=true')
-    name: routes.groovy
-`
        Resources["operator-deployment.yaml"] =
                `
 # ---------------------------------------------------------------------------
@@ -9338,6 +9336,595 @@ spec:
     - mvn:org.apache.camel.k/camel-k-runtime-main
     - mvn:org.apache.camel.k/camel-k-loader-yaml
 `
+       Resources["prometheus-jmx-exporter.yaml"] =
+               `
+startDelaySecs: 5
+ssl: false
+blacklistObjectNames: ["java.lang:*"]
+rules:
+  # Context level
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      type: context
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      type: context
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      type: context
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=context, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=consumers, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      type: context
+    type: GAUGE
+
+
+  # Route level
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      route: $2
+      type: routes
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=routes, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      route: $2
+      type: routes
+    type: GAUGE
+
+  # Processor level
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesCompleted'
+    name: org.apache.camel.ExchangesCompleted
+    help: Exchanges Completed
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesFailed'
+    name: org.apache.camel.ExchangesFailed
+    help: Exchanges Failed
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesInflight'
+    name: org.apache.camel.ExchangesInflight
+    help: Exchanges Inflight
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExchangesTotal'
+    name: org.apache.camel.ExchangesTotal
+    help: Exchanges Total
+    type: COUNTER
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>FailuresHandled'
+    name: org.apache.camel.FailuresHandled
+    help: Failures Handled
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>ExternalRedeliveries'
+    name: org.apache.camel.ExternalRedeliveries
+    help: External Redeliveries
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MaxProcessingTime'
+    name: org.apache.camel.MaxProcessingTime
+    help: Maximum Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MeanProcessingTime'
+    name: org.apache.camel.MeanProcessingTime
+    help: Mean Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>MinProcessingTime'
+    name: org.apache.camel.MinProcessingTime
+    help: Minimum Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>LastProcessingTime'
+    name: org.apache.camel.LastProcessingTime
+    help: Last Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>DeltaProcessingTime'
+    name: org.apache.camel.DeltaProcessingTime
+    help: Delta Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>Redeliveries'
+    name: org.apache.camel.Redeliveries
+    help: Redeliveries
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>TotalProcessingTime'
+    name: org.apache.camel.TotalProcessingTime
+    help: Total Processing Time
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=processors, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      processor: $2
+      type: processors
+    type: COUNTER
+
+  # Consumers
+  - pattern: 'org.apache.camel<context=([^,]+), type=consumers, 
name="([^"]+)"><>InflightExchanges'
+    name: org.apache.camel.InflightExchanges
+    help: Inflight Exchanges
+    labels:
+      context: $1
+      consumer: $2
+      type: consumers
+    type: GAUGE
+
+  # Services
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MaxDuration'
+    name: org.apache.camel.MaxDuration
+    help: Maximum Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MeanDuration'
+    name: org.apache.camel.MeanDuration
+    help: Mean Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>MinDuration'
+    name: org.apache.camel.MinDuration
+    help: Minimum Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>TotalDuration'
+    name: org.apache.camel.TotalDuration
+    help: Total Duration
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>ThreadsBlocked'
+    name: org.apache.camel.ThreadsBlocked
+    help: Threads Blocked
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.camel<context=([^,]+), type=services, 
name="([^"]+)"><>ThreadsInterrupted'
+    name: org.apache.camel.ThreadsInterrupted
+    help: Threads Interrupted
+    labels:
+      context: $1
+      service: $2
+      type: services
+    type: GAUGE
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumLogicalRuntimeFaults'
+    name: org.apache.cxf.NumLogicalRuntimeFaults
+    help: Number of logical runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumLogicalRuntimeFaults'
+    name: org.apache.cxf.NumLogicalRuntimeFaults
+    help: Number of logical runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>AvgResponseTime'
+    name: org.apache.cxf.AvgResponseTime
+    help: Average Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>AvgResponseTime'
+    name: org.apache.cxf.AvgResponseTime
+    help: Average Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumInvocations'
+    name: org.apache.cxf.NumInvocations
+    help: Number of invocations
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumInvocations'
+    name: org.apache.cxf.NumInvocations
+    help: Number of invocations
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MaxResponseTime'
+    name: org.apache.cxf.MaxResponseTime
+    help: Maximum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>MaxResponseTime'
+    name: org.apache.cxf.MaxResponseTime
+    help: Maximum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MinResponseTime'
+    name: org.apache.cxf.MinResponseTime
+    help: Minimum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>MinResponseTime'
+    name: org.apache.cxf.MinResponseTime
+    help: Minimum Response Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>TotalHandlingTime'
+    name: org.apache.cxf.TotalHandlingTime
+    help: Total Handling Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>TotalHandlingTime'
+    name: org.apache.cxf.TotalHandlingTime
+    help: Total Handling Time
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumRuntimeFaults'
+    name: org.apache.cxf.NumRuntimeFaults
+    help: Number of runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumRuntimeFaults'
+    name: org.apache.cxf.NumRuntimeFaults
+    help: Number of runtime faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumUnCheckedApplicationFaults'
+    name: org.apache.cxf.NumUnCheckedApplicationFaults
+    help: Number of unchecked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumUnCheckedApplicationFaults'
+    name: org.apache.cxf.NumUnCheckedApplicationFaults
+    help: Number of unchecked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+), operation=([^,]+)><>NumCheckedApplicationFaults'
+    name: org.apache.cxf.NumCheckedApplicationFaults
+    help: Number of checked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+      operation: $5
+  - pattern: 'org.apache.cxf<bus.id=([^,]+), type=([^,]+), service=([^,]+), 
port=([^,]+)><>NumCheckedApplicationFaults'
+    name: org.apache.cxf.NumCheckedApplicationFaults
+    help: Number of checked application faults
+    type: GAUGE
+    labels:
+      bus.id: $1
+      type: $2
+      service: $3
+      port: $4
+`
        Resources["user-cluster-role.yaml"] =
                `
 # ---------------------------------------------------------------------------
@@ -9374,3 +9961,5 @@ rules:
 `
 
 }
+
+var Resources map[string]string
diff --git a/docs/modules/ROOT/pages/traits/prometheus.adoc 
b/docs/modules/ROOT/pages/traits/prometheus.adoc
index f358769..ea5dfaf 100755
--- a/docs/modules/ROOT/pages/traits/prometheus.adoc
+++ b/docs/modules/ROOT/pages/traits/prometheus.adoc
@@ -1,12 +1,11 @@
 = Prometheus Trait
 
 // Start of autogenerated code - DO NOT EDIT! (description)
-The Prometheus trait exposes the integration with a `Service` and a 
`ServiceMonitor` resources
-so that the Prometheus endpoint can be scraped.
+The Prometheus trait configures the Prometheus JMX exporter and exposes the 
integration with a `Service`
+and a `ServiceMonitor` resources so that the Prometheus endpoint can be 
scraped.
 
-WARNING: Creating the `ServiceMonitor` resource requires the 
https://github.com/coreos/prometheus-operator[Prometheus Operator]
-custom resource definition to be installed. You can set `service-monitor` to 
`false` for the Prometheus trait to work without
-the Prometheus operator.
+WARNING: The creation of the `ServiceMonitor` resource requires the 
https://github.com/coreos/prometheus-operator[Prometheus Operator] custom 
resource definition to be installed.
+You can set `service-monitor` to `false` for the Prometheus trait to work 
without the Prometheus operator.
 
 It's disabled by default.
 
diff --git a/pkg/apis/camel/v1/integration_types_support.go 
b/pkg/apis/camel/v1/integration_types_support.go
index 2b2e61f..21b8c0e 100644
--- a/pkg/apis/camel/v1/integration_types_support.go
+++ b/pkg/apis/camel/v1/integration_types_support.go
@@ -108,6 +108,26 @@ func (in *IntegrationSpec) AddDependency(dependency 
string) {
        in.Dependencies = append(in.Dependencies, newDep)
 }
 
+// AddOrReplaceGeneratedResources --
+func (in *IntegrationStatus) AddOrReplaceGeneratedResources(resources 
...ResourceSpec) {
+       newResources := make([]ResourceSpec, 0)
+       for _, resource := range resources {
+               replaced := false
+               for i, r := range in.GeneratedResources {
+                       if r.Name == resource.Name {
+                               in.GeneratedResources[i] = resource
+                               replaced = true
+                               break
+                       }
+               }
+               if !replaced {
+                       newResources = append(newResources, resource)
+               }
+       }
+
+       in.GeneratedResources = append(in.GeneratedResources, newResources...)
+}
+
 // Configurations --
 func (in *IntegrationSpec) Configurations() []ConfigurationSpec {
        if in == nil {
diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go
index f489874..874829e 100644
--- a/pkg/trait/prometheus.go
+++ b/pkg/trait/prometheus.go
@@ -19,24 +19,27 @@ package trait
 
 import (
        "fmt"
+       "path"
        "strconv"
-
-       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
-       "github.com/apache/camel-k/pkg/util/envvar"
+       "strings"
 
        corev1 "k8s.io/api/core/v1"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
        "k8s.io/apimachinery/pkg/util/intstr"
 
        monitoringv1 
"github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
+
+       "github.com/apache/camel-k/deploy"
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       "github.com/apache/camel-k/pkg/util"
 )
 
-// The Prometheus trait exposes the integration with a `Service` and a 
`ServiceMonitor` resources
-// so that the Prometheus endpoint can be scraped.
+// The Prometheus trait configures the Prometheus JMX exporter and exposes the 
integration with a `Service`
+// and a `ServiceMonitor` resources so that the Prometheus endpoint can be 
scraped.
 //
-// WARNING: Creating the `ServiceMonitor` resource requires the 
https://github.com/coreos/prometheus-operator[Prometheus Operator]
-// custom resource definition to be installed. You can set `service-monitor` 
to `false` for the Prometheus trait to work without
-// the Prometheus operator.
+// WARNING: The creation of the `ServiceMonitor` resource requires the 
https://github.com/coreos/prometheus-operator[Prometheus Operator]
+//custom resource definition to be installed.
+// You can set `service-monitor` to `false` for the Prometheus trait to work 
without the Prometheus operator.
 //
 // It's disabled by default.
 //
@@ -51,10 +54,12 @@ type prometheusTrait struct {
        ServiceMonitorLabels string `property:"service-monitor-labels"`
 }
 
-const prometheusPortName = "prometheus"
+const (
+       prometheusJmxExporterConfigFileName  = "prometheus-jmx-exporter.yaml"
+       prometheusJmxExporterConfigMountPath = "/etc/prometheus"
+       prometheusPortName                   = "prometheus"
+)
 
-// The Prometheus trait must be executed prior to the deployment trait
-// as it mutates environment variables
 func newPrometheusTrait() *prometheusTrait {
        return &prometheusTrait{
                BaseTrait:      newBaseTrait("prometheus"),
@@ -64,10 +69,35 @@ func newPrometheusTrait() *prometheusTrait {
 }
 
 func (t *prometheusTrait) Configure(e *Environment) (bool, error) {
-       return e.IntegrationInPhase(v1.IntegrationPhaseDeploying, 
v1.IntegrationPhaseRunning), nil
+       return t.Enabled != nil && *t.Enabled && e.IntegrationInPhase(
+               v1.IntegrationPhaseInitialization,
+               v1.IntegrationPhaseDeploying,
+               v1.IntegrationPhaseRunning,
+       ), nil
 }
 
 func (t *prometheusTrait) Apply(e *Environment) (err error) {
+       if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
+               // Add the Camel management and Prometheus agent dependencies
+               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"mvn:org.apache.camel/camel-management")
+               // TODO: We may want to make the Prometheus version configurable
+               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
"mvn:io.prometheus.jmx/jmx_prometheus_javaagent:0.3.1")
+
+               // Add the default Prometheus JMX exporter configuration
+               // TODO: Support user-provided configuration
+               configMap := t.getJmxExporterConfigMap(e)
+               e.Resources.Add(configMap)
+               
e.Integration.Status.AddOrReplaceGeneratedResources(v1.ResourceSpec{
+                       Type: v1.ResourceTypeData,
+                       DataSpec: v1.DataSpec{
+                               Name:       prometheusJmxExporterConfigFileName,
+                               ContentRef: configMap.Name,
+                       },
+                       MountPath: prometheusJmxExporterConfigMountPath,
+               })
+               return nil
+       }
+
        container := e.getIntegrationContainer()
        if container == nil {
                e.Integration.Status.SetCondition(
@@ -79,13 +109,6 @@ func (t *prometheusTrait) Apply(e *Environment) (err error) 
{
                return nil
        }
 
-       if t.Enabled == nil || !*t.Enabled {
-               // Deactivate the Prometheus Java agent
-               // Note: the AB_PROMETHEUS_OFF environment variable acts as an 
option flag
-               envvar.SetVal(&container.Env, "AB_PROMETHEUS_OFF", "true")
-               return nil
-       }
-
        condition := v1.IntegrationCondition{
                Type:   v1.IntegrationConditionPrometheusAvailable,
                Status: corev1.ConditionTrue,
@@ -93,7 +116,8 @@ func (t *prometheusTrait) Apply(e *Environment) (err error) {
        }
 
        // Configure the Prometheus Java agent
-       envvar.SetVal(&container.Env, "AB_PROMETHEUS_PORT", 
strconv.Itoa(t.Port))
+       options := []string{strconv.Itoa(t.Port), 
path.Join(prometheusJmxExporterConfigMountPath, 
prometheusJmxExporterConfigFileName)}
+       container.Args = append(container.Args, 
"-javaagent:dependencies/io.prometheus.jmx.jmx_prometheus_javaagent-0.3.1.jar="+strings.Join(options,
 ":"))
 
        // Add the container port
        containerPort := t.getContainerPort()
@@ -191,3 +215,22 @@ func (t *prometheusTrait) getServiceMonitorFor(e 
*Environment) (*monitoringv1.Se
        }
        return &smt, nil
 }
+
+func (t *prometheusTrait) getJmxExporterConfigMap(e *Environment) 
*corev1.ConfigMap {
+       return &corev1.ConfigMap{
+               TypeMeta: metav1.TypeMeta{
+                       Kind:       "ConfigMap",
+                       APIVersion: "v1",
+               },
+               ObjectMeta: metav1.ObjectMeta{
+                       Name:      e.Integration.Name + "-prometheus",
+                       Namespace: e.Integration.Namespace,
+                       Labels: map[string]string{
+                               "camel.apache.org/integration": 
e.Integration.Name,
+                       },
+               },
+               Data: map[string]string{
+                       "content": 
deploy.Resources["prometheus-jmx-exporter.yaml"],
+               },
+       }
+}
diff --git a/pkg/trait/prometheus_test.go b/pkg/trait/prometheus_test.go
index f5f7ab0..144feb7 100644
--- a/pkg/trait/prometheus_test.go
+++ b/pkg/trait/prometheus_test.go
@@ -21,10 +21,6 @@ import (
        "context"
        "testing"
 
-       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
-       "github.com/apache/camel-k/pkg/util/kubernetes"
-       "github.com/apache/camel-k/pkg/util/test"
-
        "github.com/stretchr/testify/assert"
 
        monitoringv1 
"github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
@@ -32,6 +28,9 @@ import (
        appsv1 "k8s.io/api/apps/v1"
        corev1 "k8s.io/api/core/v1"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       "github.com/apache/camel-k/pkg/util/kubernetes"
 )
 
 func TestConfigurePrometheusTraitInRightPhaseDoesSucceed(t *testing.T) {
@@ -62,7 +61,11 @@ func TestApplyNominalPrometheusTraitDoesSucceed(t 
*testing.T) {
 
        container := 
environment.Resources.GetContainerByName(defaultContainerName)
        assert.NotNil(t, container)
-       test.EnvVarHasValue(t, container.Env, "AB_PROMETHEUS_PORT", "9779")
+
+       assert.Equal(t, container.Args, []string{
+               
"-javaagent:dependencies/io.prometheus.jmx.jmx_prometheus_javaagent-0.3.1.jar=9779:/etc/prometheus/prometheus-jmx-exporter.yaml",
+       })
+
        ports := container.Ports
        assert.Len(t, ports, 1)
        assert.Equal(t, "prometheus", ports[0].Name)
@@ -147,19 +150,6 @@ func TestApplyPrometheusTraitWithServiceDoesNotSucceed(t 
*testing.T) {
        assert.Equal(t, corev1.ConditionFalse, condition.Status)
 }
 
-func TestApplyDisabledPrometheusTraitShouldDeactivateJavaAgent(t *testing.T) {
-       trait, environment := createNominalPrometheusTest()
-       trait.Enabled = new(bool)
-
-       err := trait.Apply(environment)
-
-       assert.Nil(t, err)
-
-       container := 
environment.Resources.GetContainerByName(defaultContainerName)
-       assert.NotNil(t, container)
-       test.EnvVarHasValue(t, container.Env, "AB_PROMETHEUS_OFF", "true")
-}
-
 func TestPrometheusTraitGetServiceMonitor(t *testing.T) {
        trait, environment := createNominalPrometheusTest()
 

Reply via email to