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

Unified Diff: appengine/tsmon/middleware.go

Issue 1857643003: Revert of Migrate tsmon protos to proto3 (Closed) Base URL: git@github.com:luci/luci-go.git@master
Patch Set: Created 4 years, 8 months 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 | « appengine/tsmon/global_callback_test.go ('k') | appengine/tsmon/middleware_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/tsmon/middleware.go
diff --git a/appengine/tsmon/middleware.go b/appengine/tsmon/middleware.go
index f0c683db7132ac5a46d1bf8921dd36414a3a01ab..6cbff5015678978ef07176f983b5e7b68e46e886 100644
--- a/appengine/tsmon/middleware.go
+++ b/appengine/tsmon/middleware.go
@@ -11,6 +11,7 @@
"sync"
"time"
+ "github.com/golang/protobuf/proto"
"github.com/julienschmidt/httprouter"
"github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/info"
@@ -72,11 +73,11 @@
// Create the target.
tar := &target.Task{
- DataCenter: targetDataCenter,
- ServiceName: i.AppID(),
- JobName: i.ModuleName(),
- HostName: strings.SplitN(i.VersionID(), ".", 2)[0],
- TaskNum: -1,
+ DataCenter: proto.String(targetDataCenter),
+ ServiceName: proto.String(i.AppID()),
+ JobName: proto.String(i.ModuleName()),
+ HostName: proto.String(strings.SplitN(i.VersionID(), ".", 2)[0]),
+ TaskNum: proto.Int32(-1),
}
tsmon.Initialize(c, mon, store.NewInMemory(tar))
@@ -121,14 +122,14 @@
now := clock.Now(c)
if entity.TaskNum < 0 {
- if task.TaskNum >= 0 {
+ if *task.TaskNum >= 0 {
// We used to have a task number but we don't any more (we were inactive
// for too long), so clear our state.
logging.Warningf(c, "Instance %s got purged from Datastore, but is still alive. "+
"Clearing cumulative metrics", info.Get(c).InstanceID())
tsmon.ResetCumulativeMetrics(c)
}
- task.TaskNum = -1
+ task.TaskNum = proto.Int32(-1)
lastFlushed.Time = entity.LastUpdated
// Start complaining if we haven't been given a task number after some time.
@@ -140,7 +141,7 @@
return nil
}
- task.TaskNum = int32(entity.TaskNum)
+ task.TaskNum = proto.Int32(int32(entity.TaskNum))
tsmon.Store(c).SetDefaultTarget(task)
// Update the instance entity and put it back in the datastore asynchronously.
« no previous file with comments | « appengine/tsmon/global_callback_test.go ('k') | appengine/tsmon/middleware_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698