MCPcopy
hub / github.com/grafana/dskit / Log

Method Log

log/ratelimit.go:39–48  ·  view source on GitHub ↗
(keyvals ...interface{})

Source from the content-addressed store, hash-verified

37}
38
39func (l *RateLimitedLogger) Log(keyvals ...interface{}) error {
40 if l.limiter.Allow() {
41 return l.next.Log(keyvals...)
42 }
43 counter := l.getCounterFromKeyvals(keyvals...)
44 if counter != nil {
45 counter.Inc()
46 }
47 return nil
48}
49
50func (l *RateLimitedLogger) getCounterFromKeyvals(keyvals ...interface{}) prometheus.Counter {
51 for i := 0; i < len(keyvals); i += 2 {

Callers 9

BenchmarkBufferedFunction · 0.45
TestOnFlushCallbackFunction · 0.45
testConcurrencyFunction · 0.45
baseMessageFunction · 0.45
TestEndToEnd_logfmtFunction · 0.45
TestEndToEnd_jsonFunction · 0.45
BenchmarkLazySprintfFunction · 0.45
TestLazySprintfFunction · 0.45

Calls 1

getCounterFromKeyvalsMethod · 0.95

Tested by 9

BenchmarkBufferedFunction · 0.36
TestOnFlushCallbackFunction · 0.36
testConcurrencyFunction · 0.36
baseMessageFunction · 0.36
TestEndToEnd_logfmtFunction · 0.36
TestEndToEnd_jsonFunction · 0.36
BenchmarkLazySprintfFunction · 0.36
TestLazySprintfFunction · 0.36