title: How to debug which particular Camel Route has a kind of "CPU leak"? Is there a CU metrics per route?
body: <p>We run a bunch of too different data scraping routes on our Camel instances. And at about 1 week after a start of the Camel run, the CPU resources occupied by the Camel tend to grow and never be released:</p>
  <p><a href="https://i.stack.imgur.com/YYdKu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YYdKu.png" alt="enter image description here" /></a></p>
  <p>As they reach 100%, the throatling starts and we miss the data.</p>
  <p>The first and very simple approach is to set up 1 instances, and and keep an only route in 1 instanc to be observed, while the rest would be in another one, until we define which one causing a problem and then to debug some points/beans inside this particular route. But since the degradation takes week, this approach looks very slow.</p>
  <p>Is there a kind of CPU-per-route metric that can make us to estimate which route eats up the CPU resources?</p>
  <p>UPD: i'm also monitoring the route metrics, but unfortunately metric s per route just gives me timing, hwhich are not diverged and look increasing/go peaking/go oscilating simultaneously.</p>
  <p><a href="https://i.stack.imgur.com/rb55c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rb55c.png" alt="enter image description here" /></a></p>
  <pre><code>sum by(routeId)(rate(CamelMessageHistory_seconds_sum{}[5m]))
  </code></pre>
  <p>and</p>
  <p><code>rate(label_replace({__name__=~&quot;camel_proxy.*count&quot;},&quot;name_label&quot;,&quot;$1&quot;,&quot;__name__&quot;, &quot;(.+)&quot;)[5m:])</code></p>
  <p>are plotted to prolt Micrometer metrics like that:</p>
  <pre><code># HELP CamelRoutePolicy_seconds_max  
  # TYPE CamelRoutePolicy_seconds_max gauge
  CamelRoutePolicy_seconds_max{camelContext=&quot;camel-1&quot;,failed=&quot;false&quot;,routeId=&quot;realtime_positioning_raw&quot;,serviceName=&quot;MicrometerRoutePolicyService&quot;,} 1.3250687
  # HELP CamelRoutePolicy_seconds  
  # TYPE CamelRoutePolicy_seconds summary
  CamelRoutePolicy_seconds_count{camelContext=&quot;camel-1&quot;,failed=&quot;false&quot;,routeId=&quot;realtime_positioning_raw&quot;,serviceName=&quot;MicrometerRoutePolicyService&quot;,} 868.0
  CamelRoutePolicy_seconds_sum{camelContext=&quot;camel-1&quot;,failed=&quot;false&quot;,routeId=&quot;realtime_positioning_raw&quot;,serviceName=&quot;MicrometerRoutePolicyService&quot;,} 15.7921739
  </code></pre>
  <p>and</p>
  <pre><code># HELP camel_proxy_mqtt_kafka_stream_seconds  
  # TYPE camel_proxy_mqtt_kafka_stream_seconds summary
  camel_proxy_mqtt_kafka_stream_seconds_count{camelContext=&quot;camel-1&quot;,} 868.0
  camel_proxy_mqtt_kafka_stream_seconds_sum{camelContext=&quot;camel-1&quot;,} 14.5903913
  # HELP camel_proxy_mqtt_kafka_stream_seconds_max  
  # TYPE camel_proxy_mqtt_kafka_stream_seconds_max gauge
  camel_proxy_mqtt_kafka_stream_seconds_max{camelContext=&quot;camel-1&quot;,} 1.297158
  </code></pre>