You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Ian Boston <ie...@tfd.co.uk> on 2013/03/01 08:30:36 UTC
Re: Monitoring and Statistics
On 28 February 2013 07:03, Ian Boston <ie...@tfd.co.uk> wrote:
>
> How do you all feel about a service or a singleton covering counters, set
> values and possibly running mean?. I am less keen on anything that's
> expensive to record as impact on the runtime must be close to zero.
ie: something like [1]. It was a lot more sophisticated initially, but
it was slower, created more GC traffic and in the end I thought, whats
the point, so I cut it back to really simple again.
To use.
import org.apache.sling.commons.monitor.Statistics;
Statistics statistics = StatisticsFactory.instance();
statistics.get("counter").incrementAndGet();
statistics.get("setvalue").set(System.currentTimeMillis());
or to avoid the get completely.
private static final AtomicLong counter =
StatisticsFactory.instance().get("counter");
counter.incrementAndGet();
The output of the servlet is of the form:
{
"_timenanos": 1362121529334796000,
"counter": 1,
"ObservationDispatcher.backlog": 101,
"ObservationDispatcher.added": 12191812191,
"ObservationDispatcher.removed": 12191812090
}
I thought about Statistics as a OSGI service, but decided not to to
avoid additional bindings. As a singleton only an import is needed.
WDYT, usable, or is JMX beans in each bundle going to be the way ?
Ian
1 http://svn.apache.org/repos/asf/sling/whiteboard/ieb/monitor/
>
> Ian
Re: Monitoring and Statistics
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Back to square one inventing our own soup ? ;-)
Is there really nothing available, that we can leverage ? I am feeling uncomfortable with this (not to speak of the singleton...)
Regards
Felix
Am 01.03.2013 um 08:30 schrieb Ian Boston:
> On 28 February 2013 07:03, Ian Boston <ie...@tfd.co.uk> wrote:
>>
>> How do you all feel about a service or a singleton covering counters, set
>> values and possibly running mean?. I am less keen on anything that's
>> expensive to record as impact on the runtime must be close to zero.
>
> ie: something like [1]. It was a lot more sophisticated initially, but
> it was slower, created more GC traffic and in the end I thought, whats
> the point, so I cut it back to really simple again.
>
> To use.
> import org.apache.sling.commons.monitor.Statistics;
>
> Statistics statistics = StatisticsFactory.instance();
> statistics.get("counter").incrementAndGet();
> statistics.get("setvalue").set(System.currentTimeMillis());
>
> or to avoid the get completely.
>
> private static final AtomicLong counter =
> StatisticsFactory.instance().get("counter");
>
>
> counter.incrementAndGet();
>
> The output of the servlet is of the form:
> {
> "_timenanos": 1362121529334796000,
> "counter": 1,
> "ObservationDispatcher.backlog": 101,
> "ObservationDispatcher.added": 12191812191,
> "ObservationDispatcher.removed": 12191812090
> }
>
> I thought about Statistics as a OSGI service, but decided not to to
> avoid additional bindings. As a singleton only an import is needed.
>
> WDYT, usable, or is JMX beans in each bundle going to be the way ?
>
> Ian
>
>
>
> 1 http://svn.apache.org/repos/asf/sling/whiteboard/ieb/monitor/
>
>
>>
>> Ian
--
Felix Meschberger | Principal Scientist | Adobe