*Hello Folks I am trying to emit metrics from my camel application. I have my camel context defined as follows*
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ctx="http://www.springframework.org/schema/context" xmlns:metrics="http://www.ryantenney.com/schema/metrics" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.ryantenney.com/schema/metrics http://www.ryantenney.com/schema/metrics/metrics-3.0.xsd"> <ctx:property-placeholder location="classpath:appConfigs.groovy" /> <camelContext xmlns="http://camel.apache.org/schema/spring"> <propertyPlaceholder id="placeholder" location="classpath:appConfigs.groovy" /> <routeBuilder ref="RoutesWithProcessors"/> <routeBuilder ref="VMMVendorIntegrationRoute"/> </camelContext> <bean id="RoutesWithProcessors" class="com.groovy.routes.RoutesWithProcessors"/> <bean id="VMMVendorIntegrationRoute" class="com.groovy.routes.VMMVendorIntegrationRoute"/> <bean id="CustomLogic" class="com.groovy.processors.CustomLogicImpl"/> <bean id="metricsRoutePolicyFactory" class="org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory"> <property name="metricsRegistry" ref="metrics"/> </bean> <metrics:metric-registry id="metrics" /> <metrics:annotation-driven metric-registry="metrics" /> <metrics:reporter type="console" metric-registry="metrics" period="15s" /> <metrics:register metric-registry="metrics"> <bean metrics:name="jvm.gc" class="com.codahale.metrics.jvm.GarbageCollectorMetricSet" /> <bean metrics:name="jvm.memory" class="com.codahale.metrics.jvm.MemoryUsageGaugeSet" /> <bean metrics:name="jvm.thread-states" class="com.codahale.metrics.jvm.ThreadStatesGaugeSet" /> <bean metrics:name="jvm.fd.usage" class="com.codahale.metrics.jvm.FileDescriptorRatioGauge" /> </metrics:register> </beans> *And I also have my camel route as follows* package com.groovy.routes import com.codahale.metrics.annotation.Counted import com.codahale.metrics.annotation.ExceptionMetered import com.codahale.metrics.annotation.Gauge import com.codahale.metrics.annotation.Metered import com.codahale.metrics.annotation.Timed import com.ryantenney.metrics.spring.config.annotation.EnableMetrics import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter import org.apache.camel.builder.RouteBuilder import org.springframework.context.annotation.Configuration import java.util.Properties import java.io.File /** * Created by Z001NLH on 11/5/2015. */ @Configuration @EnableMetrics class VMMVendorIntegrationRoute extends RouteBuilder{ URL url = VMMVendorIntegrationRoute.class.getClassLoader().getResource("appConfigs.groovy"); def config = new ConfigSlurper().parse(url) /* @Timed @Metered @ExceptionMetered*/ @Counted void configure() throws Exception { from("file:"+config.batchDownloadedDumpFile+"?fileName="+config.downloadedDataDumpFileName).routeId("VmmVendor-3").pollEnrich("file:"+config.batchDownloadedDumpFile+"?fileName="+config.downloadedDataDumpFileName).split().tokenizeXML("vendor").streaming().multicast().to("seda:TransformFile1","seda:TransformFile2").end() from("seda:TransformFile1").routeId("VmmVendor-4").to("xquery:xquery/Vendor_File1.xq").setHeader("CamelFileName",simple("exchangeId")).to("file:"+config.outputPath1).to("metrics:counter:fileTransformed1").end(); from("seda:TransformFile2").routeId("VmmVendor-5").to("xquery:xquery/Vendor_File2.xq").setHeader("CamelFileName",simple("exchangeId")).to("file:"+config.outputPath2).to("metrics:counter:fileTransformed2").end() } } *I have 2 Questions here - 1. The 15s metrics reporter is configured which prints metrics over the console. It prints logs as shown below. 2. The camel-metric component used inside the above routebuilder but statistics from those are printed every 1 minute only. Is there a way I can add the feed from this metrics ( metrics:counter:fileTransformed2 and metrics:counter:fileTransformed1) also in my above 15s reporter. Or can I use the metric registry declared in my camel-context file <metrics:metric-registry id="metrics" /> to process the values from the metric components in the route above?* Booting up camel routes... [main] INFO org.apache.camel.main.MainSupport - Apache Camel 2.15.1 starting [main] INFO org.apache.camel.core.xml.AbstractCamelContextFactoryBean - Using custom RoutePolicyFactory with id: metricsRoutePolicyFactory and implementation: org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicyFactory@62435e70 [main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.1 (CamelContext: camel-1) is starting [main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 204 type converters [main] INFO org.apache.camel.component.seda.SedaEndpoint - Endpoint Endpoint[seda://TransformFile1] is using shared queue: seda://TransformFile1 with size: 2147483647 [main] INFO org.apache.camel.component.seda.SedaEndpoint - Endpoint Endpoint[seda://TransformFile2] is using shared queue: seda://TransformFile2 with size: 2147483647 [main] INFO org.apache.camel.component.metrics.MetricsComponent - Creating new default MetricRegistry [main] INFO org.apache.camel.spring.SpringCamelContext - AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance. [main] INFO org.apache.camel.spring.SpringCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html [main] INFO org.apache.camel.spring.SpringCamelContext - Route: ProcessorRoute-1 started and consuming from: Endpoint[file://C:%5CUsers%5CZ001NLH%5CDesktop%5Cin2] [main] INFO org.apache.camel.spring.SpringCamelContext - Route: CamelSimple-1 started and consuming from: Endpoint[file://C:%5CUsers%5CZ001NLH%5CDesktop%5Cin3] [main] INFO org.apache.camel.spring.SpringCamelContext - Route: VmmVendor-3 started and consuming from: Endpoint[file://C:%5CUsers%5CZ001NLH%5CDesktop%5Cvmmadapters%5Cout?fileName=VMM_Vendor_Full_Feed.xml] [main] INFO org.apache.camel.spring.SpringCamelContext - Route: VmmVendor-4 started and consuming from: Endpoint[seda://TransformFile1] [main] INFO org.apache.camel.spring.SpringCamelContext - Route: VmmVendor-5 started and consuming from: Endpoint[seda://TransformFile2] [main] INFO org.apache.camel.spring.SpringCamelContext - Total 5 routes, of which 5 is started. [main] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.1 (CamelContext: camel-1) started in 0.928 seconds 11/9/15 1:05:58 PM ============================================================= -- Gauges ---------------------------------------------------------------------- jvm.fd.usage value = NaN jvm.gc.PS-MarkSweep.count value = 1 jvm.gc.PS-MarkSweep.time value = 96 jvm.gc.PS-Scavenge.count value = 7 jvm.gc.PS-Scavenge.time value = 73 jvm.memory.heap.committed value = 129499136 jvm.memory.heap.init value = 134217728 jvm.memory.heap.max value = 1888485376 jvm.memory.heap.usage value = 0.017718559235483326 jvm.memory.heap.used value = 33461240 jvm.memory.non-heap.committed value = 50593792 jvm.memory.non-heap.init value = 2555904 jvm.memory.non-heap.max value = -1 jvm.memory.non-heap.usage value = -4.9446632E7 jvm.memory.non-heap.used value = 49449312 jvm.memory.pools.Code-Cache.usage value = 0.048019154866536455 jvm.memory.pools.Compressed-Class-Space.usage value = 0.0038251951336860657 jvm.memory.pools.Metaspace.usage value = 0.9797299653867036 jvm.memory.pools.PS-Eden-Space.usage value = 0.013953747511823515 jvm.memory.pools.PS-Old-Gen.usage value = 0.009121000457921795 jvm.memory.pools.PS-Survivor-Space.usage value = 0.9984603155226934 jvm.memory.total.committed value = 180092928 jvm.memory.total.init value = 136773632 jvm.memory.total.max value = 1888485375 jvm.memory.total.used value = 82949256 jvm.thread-states.blocked.count value = 0 jvm.thread-states.count value = 13 jvm.thread-states.daemon.count value = 12 jvm.thread-states.deadlocks value = [] jvm.thread-states.new.count value = 0 jvm.thread-states.runnable.count value = 4 jvm.thread-states.terminated.count value = 0 jvm.thread-states.timed_waiting.count value = 6 jvm.thread-states.waiting.count value = 3 -- Counters -------------------------------------------------------------------- com.groovy.routes.VMMVendorIntegrationRoute.configure count = 0 -- Timers ---------------------------------------------------------------------- camel-1:CamelSimple-1.responses count = 0 mean rate = 0.00 calls/second 1-minute rate = 0.00 calls/second 5-minute rate = 0.00 calls/second 15-minute rate = 0.00 calls/second min = 0.00 milliseconds max = 0.00 milliseconds mean = 0.00 milliseconds stddev = 0.00 milliseconds median = 0.00 milliseconds 75% <= 0.00 milliseconds 95% <= 0.00 milliseconds 98% <= 0.00 milliseconds 99% <= 0.00 milliseconds 99.9% <= 0.00 milliseconds camel-1:ProcessorRoute-1.responses count = 0 mean rate = 0.00 calls/second 1-minute rate = 0.00 calls/second 5-minute rate = 0.00 calls/second 15-minute rate = 0.00 calls/second min = 0.00 milliseconds max = 0.00 milliseconds mean = 0.00 milliseconds stddev = 0.00 milliseconds median = 0.00 milliseconds 75% <= 0.00 milliseconds 95% <= 0.00 milliseconds 98% <= 0.00 milliseconds 99% <= 0.00 milliseconds 99.9% <= 0.00 milliseconds camel-1:VmmVendor-3.responses count = 0 mean rate = 0.00 calls/second 1-minute rate = 0.00 calls/second 5-minute rate = 0.00 calls/second 15-minute rate = 0.00 calls/second min = 0.00 milliseconds max = 0.00 milliseconds mean = 0.00 milliseconds stddev = 0.00 milliseconds median = 0.00 milliseconds 75% <= 0.00 milliseconds 95% <= 0.00 milliseconds 98% <= 0.00 milliseconds 99% <= 0.00 milliseconds 99.9% <= 0.00 milliseconds camel-1:VmmVendor-4.responses count = 0 mean rate = 0.00 calls/second 1-minute rate = 0.00 calls/second 5-minute rate = 0.00 calls/second 15-minute rate = 0.00 calls/second min = 0.00 milliseconds max = 0.00 milliseconds mean = 0.00 milliseconds stddev = 0.00 milliseconds median = 0.00 milliseconds 75% <= 0.00 milliseconds 95% <= 0.00 milliseconds 98% <= 0.00 milliseconds 99% <= 0.00 milliseconds 99.9% <= 0.00 milliseconds camel-1:VmmVendor-5.responses count = 0 mean rate = 0.00 calls/second 1-minute rate = 0.00 calls/second 5-minute rate = 0.00 calls/second 15-minute rate = 0.00 calls/second min = 0.00 milliseconds max = 0.00 milliseconds mean = 0.00 milliseconds stddev = 0.00 milliseconds median = 0.00 milliseconds 75% <= 0.00 milliseconds 95% <= 0.00 milliseconds 98% <= 0.00 milliseconds 99% <= 0.00 milliseconds 99.9% <= 0.00 milliseconds ----- Reji Mathews Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Metrics-over-Spring-metrics-tp5773518.html Sent from the Camel - Users mailing list archive at Nabble.com.
