[hyena] Add Metric.PushSample method
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Add Metric.PushSample method
- Date: Wed, 26 May 2010 02:33:56 +0000 (UTC)
commit f3a89f9beecc991d0093876e5a0a340364b5954b
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Feb 12 13:55:26 2010 -0800
Add Metric.PushSample method
src/Hyena/Hyena.Metrics/Metric.cs | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/Hyena/Hyena.Metrics/Metric.cs b/src/Hyena/Hyena.Metrics/Metric.cs
index 1eb3048..07997cf 100644
--- a/src/Hyena/Hyena.Metrics/Metric.cs
+++ b/src/Hyena/Hyena.Metrics/Metric.cs
@@ -62,13 +62,27 @@ namespace Hyena.Metrics
{
}
+ public void PushSample (object sampleValue)
+ {
+ try {
+ store.Add (new Sample (this, sampleValue));
+ } catch (Exception e) {
+ Log.Exception ("Error taking sample", e);
+ }
+ }
+
public void TakeSample ()
{
if (sample_func == null) {
- throw new InvalidOperationException ("sampleFunc is null. Are you calling TakeSample on a non-event-driven metric?");
+ Log.Warning ("sampleFunc is null. Are you calling TakeSample on a non-event-driven metric?");
+ return;
}
- store.Add (new Sample (this, sample_func ()));
+ try {
+ store.Add (new Sample (this, sample_func ()));
+ } catch (Exception e) {
+ Log.Exception ("Error taking sample", e);
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]