Skip to content

Commit

Permalink
Rename baseplate_log_latency_seconds to baseplate_log_write_duration_…
Browse files Browse the repository at this point in the history
…seconds (#689)

* Rename baseplate_log_latency_seconds to baseplate_logger_write_duration_seconds

The new name makes it clear that this captures the duration of local logging calls as
opposed to end-to-end logging latency to the centralized collector.

* Name metric after its baseplate component: logger -> log

* Update help: log calls -> log writes
  • Loading branch information
reptile-deer-66 authored Feb 26, 2025
1 parent d062b18 commit e0b5310
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions log/core_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
)

var (
logLatencySeconds = promauto.With(prometheusbpint.GlobalRegistry).NewHistogram(
logWriteDurationSeconds = promauto.With(prometheusbpint.GlobalRegistry).NewHistogram(
prometheus.HistogramOpts{
Name: "baseplate_log_latency_seconds",
Help: "Latency of log calls",
Name: "baseplate_log_write_duration_seconds",
Help: "Latency of log writes",
Buckets: []float64{
0.000_005,
0.000_010,
Expand Down Expand Up @@ -45,7 +45,7 @@ func (w wrappedCore) With(fields []zapcore.Field) zapcore.Core {

func (w wrappedCore) Write(entry zapcore.Entry, fields []zapcore.Field) error {
defer func(start time.Time) {
logLatencySeconds.Observe(time.Since(start).Seconds())
logWriteDurationSeconds.Observe(time.Since(start).Seconds())
}(time.Now())
return w.Core.Write(entry, wrapFields(fields))
}
Expand Down

0 comments on commit e0b5310

Please sign in to comment.