[
https://issues.apache.org/jira/browse/GEODE-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dan Smith updated GEODE-1494:
-----------------------------
Description:
The Statistics interface has methods to increment, set, and get the value of
various statistics. The statistics are sampled at the sample-rate by the stat
sampling thread.
We should add a way to provide a callback that computes the value of the
statistic. The callback can be called by the stat sampling thread to compute
the value at the sample time.
This is useful because some statistics are hard to update correctly using using
increment operations. For example, tracking the total number of entries in a
parallel async event queue is tricky, because buckets may move on and off of a
node while concurrent operations are also adding entries. But measuring the
current size of the queue is easy by just calling size on the underlying
regions.
Here are the proposed new methods on the statistics interface:
{code}
/**
* Provide a callback to compute the value of this statistic
* every sample interval and use that as the value of the stat.
*
*/
public void sampleInt(int id, IntSupplier supplier);
public void sampleLong(int id, LongSupplier supplier);
public void sampleDouble(int id, DoubleSupplier supplier);
public void sampleInt(String name, IntSupplier supplier);
public void sampleLong(String name, LongSupplier supplier);
public void sampleDouble(String name, DoubleSupplier supplier);
public void sampleInt(StatisticDescriptor descriptor, IntSupplier supplier);
public void sampleLong(StatisticDescriptor descriptor, LongSupplier supplier);
public void sampleDouble(StatisticDescriptor descriptor, DoubleSupplier
supplier);
{code}
was:
The Statistics interface has methods to increment, set, and get the value of
various statistics. The statistics are sampled at the sample-rate by the stat
sampling thread.
We should add a way to provide a callback that computes the value of the
statistic. The callback can be called by the stat sampling thread to compute
the value at the sample time.
This is useful because some statistics are hard to update correctly using using
increment operations. For example, tracking the total number of entries in a
parallel async event queue is tricky, because buckets may move on and off of a
node while concurrent operations are also adding entries. But measuring the
current size of the queue is easy by just calling size on the underlying
regions.
Here are the proposed new methods on the statistics interface:
{code}
/**
* Provide a callback to compute the value of this statistic
* every sample interval and use that as the value of the stat.
*
*/
public void sampleInt(int id, IntSupplier sampler);
public void sampleLong(int id, LongSupplier supplier);
public void sampleDouble(int id, DoubleSupplier supplier);
public void sampleInt(String name, IntSupplier sampler);
public void sampleLong(String name, LongSupplier supplier);
public void sampleDouble(String name, DoubleSupplier supplier);
public void sampleInt(StatisticDescriptor descriptor, IntSupplier sampler);
public void sampleLong(StatisticDescriptor descriptor, LongSupplier supplier);
public void sampleDouble(StatisticDescriptor descriptor, DoubleSupplier
supplier);
{code}
> Allow users to provide callbacks to sample statistics
> -----------------------------------------------------
>
> Key: GEODE-1494
> URL: https://issues.apache.org/jira/browse/GEODE-1494
> Project: Geode
> Issue Type: Improvement
> Reporter: Dan Smith
> Assignee: Dan Smith
>
> The Statistics interface has methods to increment, set, and get the value of
> various statistics. The statistics are sampled at the sample-rate by the stat
> sampling thread.
> We should add a way to provide a callback that computes the value of the
> statistic. The callback can be called by the stat sampling thread to compute
> the value at the sample time.
> This is useful because some statistics are hard to update correctly using
> using increment operations. For example, tracking the total number of entries
> in a parallel async event queue is tricky, because buckets may move on and
> off of a node while concurrent operations are also adding entries. But
> measuring the current size of the queue is easy by just calling size on the
> underlying regions.
> Here are the proposed new methods on the statistics interface:
> {code}
> /**
> * Provide a callback to compute the value of this statistic
> * every sample interval and use that as the value of the stat.
> *
> */
> public void sampleInt(int id, IntSupplier supplier);
> public void sampleLong(int id, LongSupplier supplier);
> public void sampleDouble(int id, DoubleSupplier supplier);
> public void sampleInt(String name, IntSupplier supplier);
> public void sampleLong(String name, LongSupplier supplier);
> public void sampleDouble(String name, DoubleSupplier supplier);
> public void sampleInt(StatisticDescriptor descriptor, IntSupplier supplier);
> public void sampleLong(StatisticDescriptor descriptor, LongSupplier
> supplier);
> public void sampleDouble(StatisticDescriptor descriptor, DoubleSupplier
> supplier);
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)