[
https://issues.apache.org/jira/browse/CAMEL-21661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-21661.
---------------------------------
Resolution: Fixed
> camel-micrometer - multiple registrations of gauge camel.exchanges.inflight
> ---------------------------------------------------------------------------
>
> Key: CAMEL-21661
> URL: https://issues.apache.org/jira/browse/CAMEL-21661
> Project: Camel
> Issue Type: Improvement
> Components: camel-micrometer
> Affects Versions: 4.8.3
> Reporter: Jonas Nilsson
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.8.4, 4.10.0
>
>
> Details in Zulip:
> [https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/WARN.20log.20in.20camel-micrometer.204.2E8.2E3.3F]
> Simple test route:
>
> {code:java}
> from("sftp:xxx")
> .routeId("SftpReadFileTest")
> .log("Received file ${header.CamelFileName}")
> .to("jms:test.queue");{code}
> Logging from first file (one WARN then DEBUG)
> {code:java}
> INFO SftpReadFileTest - Received file test_file.xml
> WARN i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored. Note that subsequent logs will be
> logged at debug level.
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.{code}
> Second file and beyond:
> {code:java}
> INFO SftpReadFileTest - Received file test_file2.xml
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.
> DEBUG i.m.core.instrument.MeterRegistry - This Gauge has been already
> registered (MeterId{name='camel.exchanges.inflight',
> tags=[tag(camelContext=test-camelspringboot-app),tag(kind=CamelExchangeEvent),tag(routeId=SftpReadFileTest)]}),
> the Gauge registration will be ignored.{code}
> {{ }}
> I suspect this is not due to a change in camel-micrometer, or rather, that
> this "bug" has been there all the time.
> But that Micrometer started to log this warning in the latest version,
> introduced in this commit:
> [https://github.com/micrometer-metrics/micrometer/commit/12d30723e6baff46a97b1b364e3085adbed543ee]
>
> I see that Camel 4.4.4 is using 1.12.10 of io.micrometer packages, and Camel
> 4.8.3 is using 1.13.9 where this new warning was added.
>
> I'm not super knowledgeable about Camel source code and how everything works
> behind the scenes, but I suspect it could be this ExchangeEvent handler that
> are trying to register the gauage over and over again? (and that this should
> only be done once, and then the value should be updated instead?):
> [https://github.com/apache/camel/blob/main/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifier.java#L143]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)