Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/services/otelhealth/otelhealth.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ func ConfigureHooks(orig services.HealthCheckerConfig, meter metric.Meter) (serv
if err != nil {
return services.HealthCheckerConfig{}, err
}
uptimeSeconds, err := meter.Float64Gauge("uptime_seconds", metric.WithDescription("Uptime of the service"))
uptimeSeconds, err := meter.Float64Counter("uptime_seconds", metric.WithDescription("Uptime of the service in seconds"))
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uptime_seconds is now a Counter and the description says "Uptime of the service in seconds", but it doesn’t indicate the value is cumulative/monotonic (i.e., total uptime accumulated since start). Consider updating the description to explicitly reflect counter semantics to avoid confusion in dashboards/alerts.

Also, this metric represents seconds; most other OTel duration metrics in this repo set an explicit unit (e.g. metric.WithUnit("s") in pkg/settings/limits/time.go). Consider adding metric.WithUnit("s") here as well for consistency and better backend rendering.

Suggested change
uptimeSeconds, err := meter.Float64Counter("uptime_seconds", metric.WithDescription("Uptime of the service in seconds"))
uptimeSeconds, err := meter.Float64Counter(
"uptime_seconds",
metric.WithDescription("Total cumulative uptime of the service in seconds since start"),
metric.WithUnit("s"),
)

Copilot uses AI. Check for mistakes.
if err != nil {
return services.HealthCheckerConfig{}, err
}
cfg.AddUptime = func(ctx context.Context, d time.Duration) {
if orig.AddUptime != nil {
orig.AddUptime(ctx, d)
}
uptimeSeconds.Record(ctx, d.Seconds())
uptimeSeconds.Add(ctx, d.Seconds())
}
cfg.IncVersion = func(ctx context.Context, ver string, sha string) {
if orig.IncVersion != nil {
Expand Down
Loading