Skip to content

metrics: fall back to mockWriter on file open failure#608

Open
SAY-5 wants to merge 1 commit intourunc-dev:mainfrom
SAY-5:say5/metrics-nil-fallback-595
Open

metrics: fall back to mockWriter on file open failure#608
SAY-5 wants to merge 1 commit intourunc-dev:mainfrom
SAY-5:say5/metrics-nil-fallback-595

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #595.

NewZerologMetrics returned nil when timestamps were enabled but the destination file couldn't be opened. The caller in cmd/urunc/main.go assigns the result to a global used by metrics.Capture() in 19+ sites; the next event then nil-derefs and crashes urunc silently — most often when a user enables [timestamps] in /etc/urunc/config.toml before /var/log/urunc/ exists. Return &mockWriter{} (the same fallback the disabled branch uses) and log a warning. Container creation now degrades to no-metrics instead of panicking.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 2, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 644852c
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/69f5f445da2f4f00086b425b

@abhaygoudannavar
Copy link
Copy Markdown

hey @SAY-5 fix to #595 is already been implemented in the PR #596 take a look in it and feel free to suggest any changes needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(metrics): NewZerologMetrics returns nil on file open failure causing panic

2 participants