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

Side by Side Diff: go/trace/service/impl.go

Issue 1722163002: Metrics2: Store a registry of Counters (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Address comments Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « go/metrics2/metrics.go ('k') | perf/go/alerting/alerting.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package traceservice 1 package traceservice
2 2
3 // Generate the go code from the protocol buffer definitions. 3 // Generate the go code from the protocol buffer definitions.
4 //go:generate protoc --go_out=plugins=grpc:. traceservice.proto 4 //go:generate protoc --go_out=plugins=grpc:. traceservice.proto
5 5
6 import ( 6 import (
7 "bytes" 7 "bytes"
8 "crypto/md5" 8 "crypto/md5"
9 "encoding/binary" 9 "encoding/binary"
10 "fmt" 10 "fmt"
(...skipping 13 matching lines...) Expand all
24 TRACE_BUCKET_NAME = "traces" 24 TRACE_BUCKET_NAME = "traces"
25 TRACEID_BUCKET_NAME = "traceids" 25 TRACEID_BUCKET_NAME = "traceids"
26 LARGEST_TRACEID_KEY = "the largest trace64id" 26 LARGEST_TRACEID_KEY = "the largest trace64id"
27 27
28 // How many items to keep in the in-memory LRU cache. 28 // How many items to keep in the in-memory LRU cache.
29 MAX_INT64_ID_CACHED = 1024 * 1024 29 MAX_INT64_ID_CACHED = 1024 * 1024
30 ) 30 )
31 31
32 var ( 32 var (
33 tags = map[string]string{"module": "tracedb"} 33 tags = map[string]string{"module": "tracedb"}
34 » missingParamsCalls = metrics2.NewCounter("missing-params-calls", tags) 34 » missingParamsCalls = metrics2.GetCounter("missing-params-calls", tags)
35 » addParamsCalls = metrics2.NewCounter("add-params-calls", tags) 35 » addParamsCalls = metrics2.GetCounter("add-params-calls", tags)
36 » addCalls = metrics2.NewCounter("add-calls", tags) 36 » addCalls = metrics2.GetCounter("add-calls", tags)
37 » addCount = metrics2.NewCounter("added-count", tags) 37 » addCount = metrics2.GetCounter("added-count", tags)
38 » removeCalls = metrics2.NewCounter("remove-calls", tags) 38 » removeCalls = metrics2.GetCounter("remove-calls", tags)
39 » listCalls = metrics2.NewCounter("list-calls", tags) 39 » listCalls = metrics2.GetCounter("list-calls", tags)
40 » listMD5Calls = metrics2.NewCounter("list-md5-calls", tags) 40 » listMD5Calls = metrics2.GetCounter("list-md5-calls", tags)
41 » getParamsCalls = metrics2.NewCounter("get-params-calls", tags) 41 » getParamsCalls = metrics2.GetCounter("get-params-calls", tags)
42 » getValuesCalls = metrics2.NewCounter("get-values-calls", tags) 42 » getValuesCalls = metrics2.GetCounter("get-values-calls", tags)
43 » getValuesRawCalls = metrics2.NewCounter("get-values-raw-calls", tags) 43 » getValuesRawCalls = metrics2.GetCounter("get-values-raw-calls", tags)
44 » getTraceIDsCalls = metrics2.NewCounter("get-traceids-calls", tags) 44 » getTraceIDsCalls = metrics2.GetCounter("get-traceids-calls", tags)
45 » pingCalls = metrics2.NewCounter("ping-calls", tags) 45 » pingCalls = metrics2.GetCounter("ping-calls", tags)
46 ) 46 )
47 47
48 // bytesFromUint64 converts a uint64 to a []byte. 48 // bytesFromUint64 converts a uint64 to a []byte.
49 func bytesFromUint64(u uint64) []byte { 49 func bytesFromUint64(u uint64) []byte {
50 ret := make([]byte, 8, 8) 50 ret := make([]byte, 8, 8)
51 binary.LittleEndian.PutUint64(ret, u) 51 binary.LittleEndian.PutUint64(ret, u)
52 return ret 52 return ret
53 } 53 }
54 54
55 // CommitIDToByes serializes the CommitID to a []byte in the same format that Co mmitIDFromBytes reads. 55 // CommitIDToByes serializes the CommitID to a []byte in the same format that Co mmitIDFromBytes reads.
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 func (ts *TraceServiceImpl) Ping(ctx context.Context, empty *Empty) (*Empty, err or) { 699 func (ts *TraceServiceImpl) Ping(ctx context.Context, empty *Empty) (*Empty, err or) {
700 pingCalls.Inc(1) 700 pingCalls.Inc(1)
701 701
702 return &Empty{}, nil 702 return &Empty{}, nil
703 } 703 }
704 704
705 // Close closes the underlying datastore. Not part of the TraceServiceServer int erface. 705 // Close closes the underlying datastore. Not part of the TraceServiceServer int erface.
706 func (ts *TraceServiceImpl) Close() error { 706 func (ts *TraceServiceImpl) Close() error {
707 return ts.db.Close() 707 return ts.db.Close()
708 } 708 }
OLDNEW
« no previous file with comments | « go/metrics2/metrics.go ('k') | perf/go/alerting/alerting.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698