Skip to content

chore(stdout) ensure stdout and stderr are not terminals #2093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: reboot
Choose a base branch
from

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented May 21, 2025

Previously when stdout exporter is enabled, it writes to stdout (by default) and logs get written to stderr. This messes up the output. This PR ensures that when stdout exporter is enabled, and log (stderr) isn't redirected, the application quits.

sudo ./bin/kepler --exporter.stdout 

time=2025-05-21T08:45:43.484-04:00 level=ERROR source=cmd/kepler/main.go:53 msg="failed to initialize services" error="failed to initialize service stdout: stdout and stderr are both terminal streams; redirect stderr to a file"

sudo ./bin/kepler --exporter.stdout --no-exporter.prometheus 2>/dev/null

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Press Ctrl+C to shutdown
┌─────────┬─────────────┬─────────────┬────────────────┐
│  ZONE   │ DELTA ( W ) │ POWER ( W ) │ ABSOLUTE ( J ) │
├─────────┼─────────────┼─────────────┼────────────────┤
│    core │       0.86J │       0.43W │      33843.02J │
│ package │      20.84J │      10.42W │      64863.30J │
└─────────┴─────────────┴─────────────┴────────────────┘

Signed-off-by: Sunil Thaha <sthaha@redhat.com>
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 91.87%. Comparing base (75c6430) to head (8a60485).

Files with missing lines Patch % Lines
internal/exporter/stdout/stdout.go 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           reboot    #2093      +/-   ##
==========================================
- Coverage   92.16%   91.87%   -0.30%     
==========================================
  Files          30       30              
  Lines        2209     2216       +7     
==========================================
  Hits         2036     2036              
- Misses        131      136       +5     
- Partials       42       44       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vimalk78
Copy link
Collaborator

add description

@sthaha sthaha requested review from vprashar2929 and vimalk78 May 21, 2025 12:59
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.

2 participants