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

Unified Diff: client/cmd/isolate/archive.go

Issue 2918043003: Log eventlogs from legacy isolate archive command (Closed)
Patch Set: Address review comments Created 3 years, 7 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 | « no previous file | client/cmd/isolate/exp_archive.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/isolate/archive.go
diff --git a/client/cmd/isolate/archive.go b/client/cmd/isolate/archive.go
index 38e498f347514f33621b30cbea185be21122a02c..99ed9e3dca600977321e890cfe22d70a8ceb0e2e 100644
--- a/client/cmd/isolate/archive.go
+++ b/client/cmd/isolate/archive.go
@@ -7,10 +7,12 @@ package main
import (
"errors"
"fmt"
+ "log"
"os"
"path/filepath"
"time"
+ "github.com/golang/protobuf/proto"
"github.com/maruel/subcommands"
"github.com/luci/luci-go/client/archiver"
@@ -18,6 +20,7 @@ import (
"github.com/luci/luci-go/client/isolate"
"github.com/luci/luci-go/common/auth"
"github.com/luci/luci-go/common/data/text/units"
+ logpb "github.com/luci/luci-go/common/eventlog/proto"
"github.com/luci/luci-go/common/isolatedclient"
)
@@ -81,13 +84,30 @@ func (c *archiveRun) main(a subcommands.Application, args []string) error {
if err2 := arch.Close(); err == nil {
err = err2
}
+ stats := arch.Stats()
if !c.defaultFlags.Quiet {
duration := time.Since(start)
- stats := arch.Stats()
fmt.Fprintf(os.Stderr, "Hits : %5d (%s)\n", stats.TotalHits(), stats.TotalBytesHits())
fmt.Fprintf(os.Stderr, "Misses : %5d (%s)\n", stats.TotalMisses(), stats.TotalBytesPushed())
fmt.Fprintf(os.Stderr, "Duration: %s\n", units.Round(duration, time.Millisecond))
}
+
+ end := time.Now()
+
+ archiveDetails := &logpb.IsolateClientEvent_ArchiveDetails{
+ HitCount: proto.Int64(int64(stats.TotalHits())),
+ MissCount: proto.Int64(int64(stats.TotalMisses())),
+ HitBytes: proto.Int64(int64(stats.TotalBytesHits())),
+ MissBytes: proto.Int64(int64(stats.TotalBytesPushed())),
+ }
+ if item.Error() != nil {
+ archiveDetails.IsolateHash = []string{string(item.Digest())}
+ }
+ eventlogger := NewLogger(ctx, c.isolateFlags.EventlogEndpoint)
+ op := logpb.IsolateClientEvent_LEGACY_ARCHIVE.Enum()
+ if err := eventlogger.logStats(ctx, op, start, end, archiveDetails); err != nil {
+ log.Printf("Failed to log to eventlog: %v", err)
+ }
return err
}
« no previous file with comments | « no previous file | client/cmd/isolate/exp_archive.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698