Test all metrics locally.
@@ -61,18 +61,22 @@ func main() {
srv.AddMetric(workerAvailability, 60, cloudSql)
srv.AddMetric(releaseDownloads, 3600, cloudSql)
- err = cloudSql.RegisterMetric(releaseDownloads)
+ // Test code - please delete later.
+ for _, m := range []metrics.Metric{pipelinePerformance, workerAvailability, releaseDownloads} {
+ name := m.Name()
+ err = cloudSql.RegisterMetric(m)
if err != nil {
- log.Fatalf("Could not register metric: %v", err)
+ log.Fatalf("Could not register metric %s: %v", name, err)
}
- ds, err := releaseDownloads.Collect()
+ ds, err := m.Collect()
if err != nil {
- log.Fatalf("Could not collect download statistics: %v", err)
+ log.Fatalf("Could not collect data for metric %s: %v", name, err)
}
- err = cloudSql.Publish(releaseDownloads.Name(), ds)
+ err = cloudSql.Publish(name, ds)
if err != nil {
- log.Fatalf("Failed to publish download statistics: %v", err)
+ log.Fatalf("Failed to publish metric %s: %v", name, err)
+ }
}
//srv.Start()
