Skip to content

Conversation

vimalk78
Copy link
Collaborator

@vimalk78 vimalk78 commented May 15, 2025

  • made logger to write on stderr
  • Added stdout exporter for Node energy/power
  • Added relavant config flags
  • Added tests

sample output:

❯ sudo ./bin/kepler --exporter.stdout
time=2025-05-19T12:26:44.231+05:30 level=INFO source=cmd/kepler/main.go:61 msg="Kepler version information" version=v0.0.5-18-g358af625 buildTime=2025-05-19_06:56:02 gitBranch=stdout-exporter gitCommit=358af625 goVersion=go1.24.1 goOS=linux goArch=amd64

Configuration
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
log:
    level: info
    format: text
host:
    sysfs: /sys
    procfs: /proc
dev:
    fake-cpu-meter:
        enabled: false
        zones: []
enable-pprof: false
rapl:
    zones: []
web:
    configFile: ""
exporter:
    stdout: true

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/initializer.go:31 msg="Initializing service" service=rapl
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/initializer.go:31 msg="Initializing service" service=prometheus
time=2025-05-19T12:26:44.231+05:30 level=INFO source=exporter/prometheus/prometheus.go:140 msg="Initializing Prometheus exporter" service=prometheus
time=2025-05-19T12:26:44.231+05:30 level=INFO source=exporter/prometheus/prometheus.go:147 msg="Enabling debug collector" service=prometheus collector=go
time=2025-05-19T12:26:44.231+05:30 level=INFO source=exporter/prometheus/prometheus.go:152 msg="Enabling collector" service=prometheus collector=build_info
time=2025-05-19T12:26:44.231+05:30 level=INFO source=exporter/prometheus/prometheus.go:152 msg="Enabling collector" service=prometheus collector=power
time=2025-05-19T12:26:44.231+05:30 level=INFO source=exporter/prometheus/prometheus.go:152 msg="Enabling collector" service=prometheus collector=cpu_info
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/initializer.go:31 msg="Initializing service" service=api-server
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/server/server.go:103 msg="Initializing HTTP server" service=api-server listening-on=[:28282]
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/initializer.go:31 msg="Initializing service" service=monitor
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/initializer.go:31 msg="Initializing service" service=stdout
time=2025-05-19T12:26:44.231+05:30 level=INFO source=cmd/kepler/main.go:50 msg="Starting Kepler"
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/run.go:21 msg="Running all services"
time=2025-05-19T12:26:44.231+05:30 level=WARN source=internal/service/run.go:31 msg="skipping service" service=rapl
time=2025-05-19T12:26:44.231+05:30 level=WARN source=internal/service/run.go:31 msg="skipping service" service=prometheus
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/run.go:40 msg="Running service" service=signal-handler
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/run.go:40 msg="Running service" service=monitor
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/service/run.go:40 msg="Running service" service=api-server
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/monitor/monitor.go:108 msg="Monitor is running..." service=monitor
time=2025-05-19T12:26:44.231+05:30 level=INFO source=internal/server/server.go:137 msg="Running HTTP server" service=api-server listening-on=[:28282]
Press Ctrl+C to shutdown
time=2025-05-19T12:26:44.232+05:30 level=INFO source=internal/service/run.go:40 msg="Running service" service=stdout
time=2025-05-19T12:26:44.232+05:30 level=INFO source=internal/monitor/monitor.go:254 msg="Computed power" service=monitor duration=137.186µs
time=2025-05-19T12:26:44.232+05:30 level=INFO source=exporter-toolkit@v0.14.0/web/tls_config.go:347 msg="Listening on" service=api-server address=[::]:28282
time=2025-05-19T12:26:44.232+05:30 level=INFO source=exporter-toolkit@v0.14.0/web/tls_config.go:350 msg="TLS is disabled." service=api-server http2=false address=[::]:28282
time=2025-05-19T12:26:46.233+05:30 level=INFO source=internal/monitor/monitor.go:254 msg="Computed power" service=monitor duration=441.464µs
Kepler Node Power
┌─────────┬─────────────┬─────────────┬────────────────┐
│  ZONE   │ DELTA ( W ) │ POWER ( W ) │ ABSOLUTE ( J ) │
├─────────┼─────────────┼─────────────┼────────────────┤
│    core │       4.75J │       2.37W │     110858.62J │
│ package │       7.43J │       3.71W │     127735.34J │
│    psys │      24.95J │      12.47W │     130272.99J │
│  uncore │       0.16J │       0.08W │      36360.84J │
└─────────┴─────────────┴─────────────┴────────────────┘
time=2025-05-19T12:26:48.234+05:30 level=INFO source=internal/monitor/monitor.go:254 msg="Computed power" service=monitor duration=632.113µs
Kepler Node Power
┌─────────┬─────────────┬─────────────┬────────────────┐
│  ZONE   │ DELTA ( W ) │ POWER ( W ) │ ABSOLUTE ( J ) │
├─────────┼─────────────┼─────────────┼────────────────┤
│    core │       3.81J │       1.90W │     110862.43J │
│ package │       5.89J │       2.94W │     127741.23J │
│    psys │      22.03J │      11.01W │     130295.02J │
│  uncore │       0.14J │       0.07W │      36360.99J │
└─────────┴─────────────┴─────────────┴────────────────┘
time=2025-05-19T12:26:50.234+05:30 level=INFO source=internal/monitor/monitor.go:254 msg="Computed power" service=monitor duration=1.224389ms
Kepler Node Power
┌─────────┬─────────────┬─────────────┬────────────────┐
│  ZONE   │ DELTA ( W ) │ POWER ( W ) │ ABSOLUTE ( J ) │
├─────────┼─────────────┼─────────────┼────────────────┤
│    core │       3.35J │       1.68W │     110865.78J │
│ package │       5.30J │       2.65W │     127746.53J │
│    psys │      20.93J │      10.47W │     130315.94J │
│  uncore │       0.13J │       0.07W │      36361.12J │
└─────────┴─────────────┴─────────────┴────────────────┘
^Ctime=2025-05-19T12:26:50.764+05:30 level=INFO source=exporter/stdout/stdout.go:107 msg="Exiting ticker" service=stdout
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/server/server.go:149 msg="shutting down HTTP server on context done" service=api-server
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/monitor/monitor.go:112 msg="Monitor has terminated." service=monitor
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/service/run.go:56 msg="shutting down" service=api-server
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/server/server.go:159 msg="shutting down API server on request" service=api-server
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/service/run.go:56 msg="shutting down" service=monitor
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/monitor/monitor.go:117 msg="shutting down monitor" service=monitor
time=2025-05-19T12:26:50.764+05:30 level=INFO source=internal/service/run.go:56 msg="shutting down" service=stdout
time=2025-05-19T12:26:50.764+05:30 level=INFO source=cmd/kepler/main.go:56 msg="Graceful shutdown completed"

@github-actions github-actions bot added the feat A new feature or enhancement label May 15, 2025
Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 95.50562% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.84%. Comparing base (5a6c763) to head (d9997cb).
Report is 3 commits behind head on reboot.

Files with missing lines Patch % Lines
internal/exporter/stdout/stdout.go 95.06% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           reboot    #2068      +/-   ##
==========================================
- Coverage   91.89%   91.84%   -0.06%     
==========================================
  Files          29       30       +1     
  Lines        2086     2171      +85     
==========================================
+ Hits         1917     1994      +77     
- Misses        128      134       +6     
- Partials       41       43       +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.

Comment on lines +89 to +96
func (e *Exporter) Init() error {
e.ticker = *time.NewTicker(e.interval)
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Club this with Run ?

@github-actions github-actions bot added the fix A bug fix label May 19, 2025
Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@vimalk78 vimalk78 force-pushed the stdout-exporter branch 3 times, most recently from c4dd39c to 522fc40 Compare May 19, 2025 07:25
Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@sthaha
Copy link
Collaborator

sthaha commented May 19, 2025

LGTM!

@vprashar2929 , do you want to give this a go as well before merging?

@sthaha sthaha merged commit 046e6bb into sustainable-computing-io:reboot May 19, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat A new feature or enhancement fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants