You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by PhilG <pg...@gmail.com> on 2016/11/09 11:03:09 UTC

MetricsMessageHistoryFactory.java:138 Generate a NPE

Hello Guys,

I'm trying to play with Spring-boot camel and metrics to expose dashboard.

Hawtio is a great tools to check what it's going on at runtime but no
persistence is done. We would like to persist statistics in prometheus by
example.

I configure camel context with MetricsMessageHistoryFactory as:


    MetricsMessageHistoryFactory metricsMessageHistoryFactory = new
MetricsMessageHistoryFactory();
    metricsMessageHistoryFactory.setMetricsRegistry(metricRegistry);
    camelContext.setMessageHistoryFactory(metricsMessageHistoryFactory);

where metricRegistry is injected with:
  /**
   * Srping Boot metrics
   */
  @Autowired
  private MetricRegistry metricRegistry;


Everything is ok until I passed in OnExceptionRoute. It seems that the
routeId is set to Null in this case and generate a NPE (line
MetricsMessageHistoryFactory:138) in the exception route. Route causing the
NPE:$    

onException(NoAttachmentToProcessException.class)
        .routeId(RouteIds.TECHNICAL_ERROR_HANDLING.routeId())
        .log(LoggingLevel.ERROR,"TECHNICAL ERROR:
${exchangeProperty.CamelExceptionCaught}")


Any reason why routeId on log component is null ?

Thanks,
Phil

<http://camel.465427.n5.nabble.com/file/n5789943/CamelMetricsMessageHistoryFactory.png> 
 



--
View this message in context: http://camel.465427.n5.nabble.com/MetricsMessageHistoryFactory-java-138-Generate-a-NPE-tp5789943.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: MetricsMessageHistoryFactory.java:138 Generate a NPE

Posted by PhilG <pg...@gmail.com>.
Done https://issues.apache.org/jira/browse/CAMEL-10460 with TestU + Patch.
Let me know if it make sens.




--
View this message in context: http://camel.465427.n5.nabble.com/MetricsMessageHistoryFactory-java-138-Generate-a-NPE-tp5789943p5789960.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: MetricsMessageHistoryFactory.java:138 Generate a NPE

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah thanks for reporting. You are welcome to log a JIRA and provide a
patch or better as a github PR.
http://camel.apache.org/support.html

On Wed, Nov 9, 2016 at 12:03 PM, PhilG <pg...@gmail.com> wrote:
> Hello Guys,
>
> I'm trying to play with Spring-boot camel and metrics to expose dashboard.
>
> Hawtio is a great tools to check what it's going on at runtime but no
> persistence is done. We would like to persist statistics in prometheus by
> example.
>
> I configure camel context with MetricsMessageHistoryFactory as:
>
>
>     MetricsMessageHistoryFactory metricsMessageHistoryFactory = new
> MetricsMessageHistoryFactory();
>     metricsMessageHistoryFactory.setMetricsRegistry(metricRegistry);
>     camelContext.setMessageHistoryFactory(metricsMessageHistoryFactory);
>
> where metricRegistry is injected with:
>   /**
>    * Srping Boot metrics
>    */
>   @Autowired
>   private MetricRegistry metricRegistry;
>
>
> Everything is ok until I passed in OnExceptionRoute. It seems that the
> routeId is set to Null in this case and generate a NPE (line
> MetricsMessageHistoryFactory:138) in the exception route. Route causing the
> NPE:$
>
> onException(NoAttachmentToProcessException.class)
>         .routeId(RouteIds.TECHNICAL_ERROR_HANDLING.routeId())
>         .log(LoggingLevel.ERROR,"TECHNICAL ERROR:
> ${exchangeProperty.CamelExceptionCaught}")
>
>
> Any reason why routeId on log component is null ?
>
> Thanks,
> Phil
>
> <http://camel.465427.n5.nabble.com/file/n5789943/CamelMetricsMessageHistoryFactory.png>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/MetricsMessageHistoryFactory-java-138-Generate-a-NPE-tp5789943.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2