An added gradle dependency on influxdb shouldn't affect whether the server
starts up or not. I made that same change, and the server started
successfully.

The InternalDistributedSystem creates and starts the GemFireStatSampler in
its initialize method like:

this.sampler = new GemFireStatSampler(this);
this.sampler.start();

The HostStatSampler (superclass of GemFireStatSampler) run method creates
and initializes the SampleCollector like:

this.sampleCollector = new SampleCollector(this);
this.sampleCollector.initialize(this, NanoTimer.getTime());

The SampleCollector initialize method sets the instance.

All of this happens regardless of the value of statistic-archive-file and
statistic-sampling-enabled.

I can reproduce the exception you're seeing if I set the
gemfire.statsDisabled system property like:

-Dgemfire.statsDisabled=true

Setting that property to true short-circuits the creation of the
GemFireStatSampler which causes the exact stack you reported.

The HostStatSampler run method does invoke initSpecialStats right before
creating the SampleCollector. I guess if that method throws an exception,
the SampleCollector might not be created. An exception in the
HostStatSampler run method should log something in the server log, though.

Do you have a full server log file that you can post?


Thanks,
Barry Oglesby


On Mon, Sep 26, 2016 at 3:10 PM, sri man <manv...@gmail.com> wrote:

> Hi,
>
> I am trying to experiment with exposing Geode stats to Grafana
> <http://grafana.org/> using a the time-series database InfluxDB
> <https://www.influxdata.com/time-series-platform/influxdb/>.
>
> Facing the below exception when I start the server after enabling stats and
> including influxDB java client <https://github.com/
> influxdata/influxdb-java> in
> the project.
> I am new to gradle (and also the above technologies ! ), not sure if I am
> doing something wrong here w.r.t including the influxdb-java client.
>
> When I enable statistics, the server doesn't start(the .... after the
>  start server command doesn't seem to stop), and I see the below exception
> in the server logs
>
> [warning 2016/09/26 17:47:45.408 EDT geode-server1 <main> tid=0x1]
> Statistics sampler is not available
> *java.lang.IllegalStateException: Statistics sampler is not available*
>         at
> org.apache.geode.internal.statistics.SampleCollector.
> getStatMonitorHandler(SampleCollector.java:127)
>         at
> org.apache.geode.internal.statistics.StatisticsMonitor.
> getStatMonitorHandler(StatisticsMonitor.java:139)
>         at
> org.apache.geode.internal.statistics.StatisticsMonitor.
> addListener(StatisticsMonitor.java:83)
>         at
> org.apache.geode.management.internal.beans.stats.MBeanStatsMonitor.
> addStatisticsToMonitor(MBeanStatsMonitor.java:59)
>         at
> org.apache.geode.management.internal.beans.MemberMBeanBridge.
> addCacheStats(MemberMBeanBridge.java:470)
>         at
> org.apache.geode.management.internal.beans.MemberMBeanBridge.init(
> MemberMBeanBridge.java:420)
>         at
> org.apache.geode.management.internal.beans.ManagementAdapter.
> handleCacheCreation(ManagementAdapter.java:161)
>         at
> org.apache.geode.management.internal.beans.ManagementListener.handleEvent(
> ManagementListener.java:119)
>         at
> org.apache.geode.distributed.internal.InternalDistributedSystem.
> notifyResourceEventListeners(InternalDistributedSystem.java:2077)
>         at
> org.apache.geode.distributed.internal.InternalDistributedSystem.
> handleResourceEvent(InternalDistributedSystem.java:525)
>         at
> org.apache.geode.internal.cache.GemFireCacheImpl.
> initialize(GemFireCacheImpl.java:1113)
>         at
> org.apache.geode.internal.cache.GemFireCacheImpl.
> basicCreate(GemFireCacheImpl.java:765)
>         at
> org.apache.geode.internal.cache.GemFireCacheImpl.create(
> GemFireCacheImpl.java:752)
>         at org.apache.geode.cache.CacheFactory.create(
> CacheFactory.java:181)
>         at org.apache.geode.cache.CacheFactory.create(
> CacheFactory.java:231)
>         at
> org.apache.geode.distributed.internal.DefaultServerLauncherCacheProv
> ider.createCache(DefaultServerLauncherCacheProvider.java:55)
>         at
> org.apache.geode.distributed.ServerLauncher.createCache(
> ServerLauncher.java:783)
>         at
> org.apache.geode.distributed.ServerLauncher.start(ServerLauncher.java:703)
>         at
> org.apache.geode.distributed.ServerLauncher.run(ServerLauncher.java:633)
>         at
> org.apache.geode.distributed.ServerLauncher.main(ServerLauncher.java:184)
> For now I have changed the method (private writeSample
> in StatArchiveWriter.java) to write to influxDB.
>
> *Geode Properties:*
> statistic-sampling-enabled=true
> statistic-archive-file=statsFile.gfs
>
> When I remove the above properties from the properties file the server
> starts up fine, which makes me think that my gradle changes should be fine.
>
> *Gradle changes:*
>
> 1. I have included the below line in geode-core/build.gradle
> <https://github.com/apache/incubator-geode/blob/develop/
> geode-core/build.gradle#L39>
>  dependencies.
>   compile 'org.influxdb:influxdb-java:' + project.'influxdb-client-
> version'
>
> 2. I have included the dependency version here
> https://github.com/apache/incubator-geode/blob/develop/
> gradle/dependency-versions.properties
>
> 3. Have added the influxdb jar name here
> https://github.com/apache/incubator-geode/blob/develop/
> geode-assembly/src/test/resources/expected_jars.txt
>
>
> Please let me know why one would see exception
> "java.lang.IllegalStateException: Statistics sampler is not available".
>
> Any feedback on the approach/usefulness of using InfluxDB-Grafana for geode
> stats is appreciated.
>
>
> Thanks,
> Srikanth Manvi
>

Reply via email to