[hyena] Fixes and improvements
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Fixes and improvements
- Date: Wed, 26 May 2010 02:33:00 +0000 (UTC)
commit 07be1df8c66ebef31aa64d3d578fffa57ca8c10d
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Feb 11 22:17:57 2010 -0800
Fixes and improvements
src/Hyena/Hyena.Metrics/DbSampleStore.cs | 2 +-
src/Hyena/Hyena.Metrics/Metric.cs | 1 +
src/Hyena/Hyena.Metrics/MetricsCollection.cs | 1 +
src/Hyena/Hyena.Metrics/Sample.cs | 5 ++++-
src/Hyena/Hyena.Metrics/Tests/MetricsTests.cs | 5 ++++-
5 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/Hyena/Hyena.Metrics/DbSampleStore.cs b/src/Hyena/Hyena.Metrics/DbSampleStore.cs
index 76e5b62..ff6a9f3 100644
--- a/src/Hyena/Hyena.Metrics/DbSampleStore.cs
+++ b/src/Hyena/Hyena.Metrics/DbSampleStore.cs
@@ -51,7 +51,7 @@ namespace Hyena.Metrics
public void Clear ()
{
- conn.Execute ("DELETE FROM {0}", TableName);
+ conn.Execute (String.Format ("DELETE FROM {0}", TableName));
}
}
}
diff --git a/src/Hyena/Hyena.Metrics/Metric.cs b/src/Hyena/Hyena.Metrics/Metric.cs
index 41b78b7..1a7502d 100644
--- a/src/Hyena/Hyena.Metrics/Metric.cs
+++ b/src/Hyena/Hyena.Metrics/Metric.cs
@@ -33,6 +33,7 @@ namespace Hyena.Metrics
{
public string Category { get; private set; }
public string Name { get; private set; }
+ public bool IsEventDriven { get; set; }
private Func<object> sample_func;
private ISampleStore store;
diff --git a/src/Hyena/Hyena.Metrics/MetricsCollection.cs b/src/Hyena/Hyena.Metrics/MetricsCollection.cs
index c3bf367..dee59be 100644
--- a/src/Hyena/Hyena.Metrics/MetricsCollection.cs
+++ b/src/Hyena/Hyena.Metrics/MetricsCollection.cs
@@ -51,6 +51,7 @@ namespace Hyena.Metrics
{
var sb = new StringBuilder ();
+ sb.AppendFormat ("ID: {0}\n", UniqueUserId);
foreach (var category in this.GroupBy<Metric, string> (m => m.Category)) {
sb.AppendFormat ("{0}:\n", category.Key);
foreach (var metric in category) {
diff --git a/src/Hyena/Hyena.Metrics/Sample.cs b/src/Hyena/Hyena.Metrics/Sample.cs
index 77adf75..5cab6a2 100644
--- a/src/Hyena/Hyena.Metrics/Sample.cs
+++ b/src/Hyena/Hyena.Metrics/Sample.cs
@@ -31,6 +31,9 @@ namespace Hyena.Metrics
{
public class Sample
{
+ [DatabaseColumn (Constraints = DatabaseColumnConstraints.PrimaryKey)]
+ private long Id { get; set; }
+
[DatabaseColumn]
public string MetricName { get; protected set; }
@@ -41,7 +44,7 @@ namespace Hyena.Metrics
public string Value { get; protected set; }
// For SqliteModelProvider's use
- internal Sample () {}
+ public Sample () {}
public Sample (Metric metric, object value)
{
diff --git a/src/Hyena/Hyena.Metrics/Tests/MetricsTests.cs b/src/Hyena/Hyena.Metrics/Tests/MetricsTests.cs
index 7d9beac..88ce8c4 100644
--- a/src/Hyena/Hyena.Metrics/Tests/MetricsTests.cs
+++ b/src/Hyena/Hyena.Metrics/Tests/MetricsTests.cs
@@ -53,8 +53,11 @@ namespace Hyena.Tests
metric.TakeSample ();
}
+ string metrics_str = metrics.ToString ();
+ Assert.IsTrue (metrics_str.Contains ("ID: myuniqueid"));
+
// tests/Makefile.am runs the tests with Locale=it_IT
- Assert.IsTrue (metrics.ToString ().Contains ("it-IT"));
+ Assert.IsTrue (metrics_str.Contains ("it-IT"));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]