That’s a good trick! I couldn’t figure out the Spring magic required to call a 
static method, but that works for me. (I had written a small lifecycle bean, 
which also works, but this is better.)

I would try to have your collector running on a port other than 8080. That’s a 
pretty common port for web services, including Ignite’s own REST server if you 
have that running.

Regards,
Stephen

> On 4 Feb 2021, at 14:19, VincentCE <[email protected]> wrote:
> 
> Hi!
> 
> We would like to use the prometheus/opencensus exporter for our server nodes
> which we start using an xml configuration. Facundo.maldonado mentioned
> before that this can be done wrapping the collector and http server in
> another bean. This is what I tried which is probably not exactly as
> suggested:
> 
> <?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:util="http://www.springframework.org/schema/util";
>       xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
>        http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://www.springframework.org/schema/util
>        http://www.springframework.org/schema/util/spring-util.xsd";>
>    <bean abstract="true" id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
> 
>        <property name="peerClassLoadingEnabled" value="true"/>
> 
>        <property name="discoverySpi">
>            <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                <property name="ipFinder">
>                    <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>                        <property name="addresses">
>                            <list>
> 
>                                <value>127.0.0.1:47500..47509</value>
>                            </list>
>                        </property>
>                    </bean>
>                </property>
>            </bean>
>        </property>
> 
>        <property name="metricExporterSpi">
>            <bean
> class="org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi">
>              <property name="period" value="1000" />
>            </bean>
>        </property>
>    </bean>
> 
>    <bean id="opencensusWrapper"
> class="org.springframework.beans.factory.config.MethodInvokingBean">
>      <property name="staticMethod"
> value="io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector.createAndRegister"
> />
>    </bean>
> 
>   <bean id="httpServer" class="io.prometheus.client.exporter.HTTPServer">
>      <constructor-arg type = "java.lang.String" value = "localhost"/>
>      <constructor-arg type = "int" value = "8080"/>
>      <constructor-arg type = "boolean" value = "true"/>
>  </bean>
> </beans>
> 
> Using this config the ignite server node starts as desired and the same
> holds for the inner http server. However no metrics are collected (Nothing
> is displayed on http://localhost:8080/), it seems as if
> prometheusStatsCollector is not successfully registering with the internally
> used default registry. Can someone see the issue with the above
> configuration? 
> 
> Thanks!
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Reply via email to