Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Unified Diff: milo/appengine/buildbot/pubsub.go

Issue 2418063002: Milo: Add ts_mon metrics for master json datastore success (Closed)
Patch Set: fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/pubsub.go
diff --git a/milo/appengine/buildbot/pubsub.go b/milo/appengine/buildbot/pubsub.go
index 903e0299691f566c717ca01263ac96354d5be845..c12147af74e2d693d7092679271bab5f0bb8e1a7 100644
--- a/milo/appengine/buildbot/pubsub.go
+++ b/milo/appengine/buildbot/pubsub.go
@@ -10,6 +10,7 @@ import (
"compress/zlib"
"encoding/base64"
"encoding/json"
+ "fmt"
"net/http"
"strings"
"time"
@@ -43,6 +44,15 @@ var (
field.Bool("finished"),
// Status can be one of 3 options. "New", "Replaced", "Rejected".
field.String("status"))
+
+ masterCounter = metric.NewCounter(
+ "luci/milo/buildbot_pubsub/masters",
+ "The number of buildbot master jsons received by Milo from PubSub",
+ nil,
+ field.Bool("internal"),
+ field.String("master"),
+ // Status can be one of 2 options. "success", "failure".
+ field.String("status"))
)
type pubSubMessage struct {
@@ -147,8 +157,8 @@ func unmarshal(
return bm.Builds, bm.Master, nil
}
-// getOSInfo fetches the os family and version of hte build from the
-// master json on a best-effort basis.
+// getOSInfo fetches the os family and version of the slave the build was
+// running on from the master json on a best-effort basis.
func getOSInfo(c context.Context, b *buildbotBuild, m *buildbotMaster) (
family, version string) {
// Fetch the master info from datastore if not provided.
@@ -212,12 +222,15 @@ func expireBuild(c context.Context, b *buildbotBuild) error {
func doMaster(c context.Context, master *buildbotMaster, internal bool) int {
// Store the master json into the datastore.
err := putDSMasterJSON(c, master, internal)
+ fullname := fmt.Sprintf("master.%s", master.Name)
if err != nil {
logging.WithError(err).Errorf(
c, "Could not save master in datastore %s", err)
+ masterCounter.Add(c, 1, internal, fullname, "failure")
// This is transient, we do want PubSub to retry.
return 500
}
+ masterCounter.Add(c, 1, internal, fullname, "success")
// Extract current builds data out of the master json, and use it to
// clean up expired builds.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698