AI prompts
base on Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe performance counters and other system stats, use ML models to estimate workload energy consumption based on these stats, and exports them as Prometheus metrics <img align="right" width="250px" src="https://user-images.githubusercontent.com/17484350/138557170-d8079b94-a517-4366-ade8-8d473e3f3f1d.jpg">
<!-- markdownlint-disable MD013 -->
<!-- Teporarily disable MD013 - Line length for the urls below -->
![GitHub Workflow Status (event)](https://img.shields.io/github/actions/workflow/status/sustainable-computing-io/kepler/unit_test.yml?branch=main&label=CI)
[![codecov](https://codecov.io/gh/sustainable-computing-io/kepler/graph/badge.svg?token=K9BDX9M86E)](https://codecov.io/gh/sustainable-computing-io/kepler)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7391/badge)](https://bestpractices.coreinfrastructure.org/projects/7391)[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/sustainable-computing-io/kepler/badge)](https://securityscorecards.dev/viewer/?uri=github.com/sustainable-computing-io/kepler)
<!-- markdownlint-enable MD013 -->
<!--
[![GoDoc](https://godoc.org/github.com/kubernetes/kube-state-metrics?status.svg)](https://godoc.org/github.com/kubernetes/kube-state-metrics)
-->
[![License][apache2-badge]][apache2-url] [![License][bsd2-badge]][bsd2-url]
[![License][gpl-badge]][gpl-url]
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/KeplerProject.svg?style=social&label=Follow%20%40KeplerProject)](https://twitter.com/KeplerProject)
# Kepler
Kepler (Kubernetes Efficient Power Level Exporter) uses eBPF to probe
energy-related system stats and exports them as Prometheus metrics.
As a CNCF Sandbox project, Kepler uses
[CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)
## Architecture
Kepler Exporter exposes a variety of
[metrics](https://sustainable-computing.io/design/metrics/) about the energy
consumption of Kubernetes components such as Pods and Nodes.
```mermaid
flowchart BT
classDef kernel fill:#e6f3ff,stroke:#4a90e2,color:#000
classDef collector fill:#f0fff0,stroke:#2ecc71,color:#000
classDef hardware fill:#fff0f5,stroke:#e74c3c,color:#000
classDef estimator fill:#fff5e6,stroke:#f39c12,color:#000
classDef mapping fill:#f5f0ff,stroke:#9b59b6,color:#000
classDef calculator fill:#f0f5ff,stroke:#3498db,color:#000
classDef attribution fill:#fff0f0,stroke:#e74c3c,color:#000
classDef export fill:#f5fff0,stroke:#27ae60,color:#000
classDef kernelLevel fill:#e6f3ff,stroke:#999,color:#000
classDef userSpace fill:#f5f5f5,stroke:#999,color:#000
classDef resourceCollection fill:#f0fff0,stroke:#999,color:#000
classDef hardwareMetrics fill:#fff0f5,stroke:#999,color:#000
classDef estimatorMetrics fill:#fff5e6,stroke:#999,color:#000
classDef powerModel fill:#f0f0ff,stroke:#999,color:#000
subgraph KL[Kernel Level]
direction BT
TP[Kernel Tracepoint]:::kernel --> EBPF[Kepler eBPF Program]:::kernel
EBPF --> |Performance Counter Stats|OM[Output Map]:::kernel
end
subgraph UP[Userspace Program]
direction BT
subgraph RC[Resource Info Collection]
direction BT
P1[Process Info Collector]:::collector --> |PID, Names|INFO[Process/Container/VM Info]:::collector
C1[Container Info Collector]:::collector --> |Container/Pod ID, Namespace|INFO
V1[VM Info Collector]:::collector --> |VM ID|INFO
end
subgraph HM[Hardware Metrics]
direction BT
H1[RAPL or hwmon]:::hardware --> |CPU/DRAM/Package Power|PWR[Hardware Power Readings]:::hardware
H2[NVIDIA/Intel GPU API]:::hardware --> |GPU Power|PWR
H3[Redfish or ACPI Power Meter]:::hardware --> |Platform Power|PWR
end
subgraph EM[Estimator Metrics]
direction BT
E1[ML Features: CPU Time]:::estimator --> |CPU/DRAM/Package Power|PWR
E2[ML Features: CPU Time]:::estimator --> |Platform Power|PWR
end
OM --> |Read Map Data|MAP[Activity Mapping]:::mapping
INFO --> MAP
MAP --> |Map via PID/cgroup ID|CALC[Energy Calculator]:::calculator
PWR --> CALC
end
subgraph PM[Power Model]
direction BT
CALC --> |Process Activity Ratio|ATTR[Idle and Dynamic Energy Attribution]:::attribution
ATTR --> |Per Process/Container/VM|EXP[Energy Metrics]:::attribution
end
EXP --> PROM[Prometheus Export]:::export
class KL kernelLevel
class UP userSpace
class RC resourceCollection
class HM hardwareMetrics
class EM estimatorMetrics
class PM powerModel
```
## Install Kepler
Instructions to install Kepler can be found in the
[Kepler docs](https://sustainable-computing.io/installation/kepler/).
## Visualise Kepler metrics with Grafana
To visualise the power consumption metrics made available by the Kepler
Exporter, import the pre-generated
[Kepler Dashboard](grafana-dashboards/Kepler-Exporter.json) into Grafana:
![Sample Grafana dashboard](doc/dashboard.png)
## Contribute to Kepler
Interested in contributing to Kepler? Follow the
[Contributing Guide](CONTRIBUTING.md) to get started!
## Talks & Demos
- [Kepler Demo](https://www.youtube.com/watch?v=P5weULiBl60)
- ["Sustainability the Container Native Way" - Open Source Summit NA 2022](doc/OSS-NA22.pdf)
A full list of talks and demos about Kepler can be found
[here](https://github.com/sustainable-computing-io/kepler-doc/tree/main/demos).
## Community Meetings
Please join the biweekly community meetings. The meeting calendar and agenda can
be found
[here](https://github.com/sustainable-computing-io/community/blob/main/community-event.md)
## License
With the exception of eBPF code, everything is distributed under the terms of
the [Apache License (version 2.0)].
### eBPF
All eBPF code is distributed under either:
- The terms of the [GNU General Public License, Version 2] or the
[BSD 2 Clause license], at your option.
- The terms of the [GNU General Public License, Version 2].
The exact license text varies by file. Please see the SPDX-License-Identifier
header in each file for details.
Files that originate from the authors of kepler use (GPL-2.0-only OR
BSD-2-Clause). Files generated from the Linux kernel i.e vmlinux.h use
GPL-2.0-only.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this project by you, as defined in the GPL-2 license, shall be
dual licensed as above, without any additional terms or conditions.
[apache license (version 2.0)]: LICENSE-APACHE
[apache2-badge]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[apache2-url]: https://opensource.org/licenses/Apache-2.0
[bsd 2 clause license]: LICENSE-BSD-2
[bsd2-badge]: https://img.shields.io/badge/License-BSD%202--Clause-orange.svg
[bsd2-url]: https://opensource.org/licenses/BSD-2-Clause
[gnu general public license, version 2]: LICENSE-GPL-2
[gpl-badge]: https://img.shields.io/badge/License-GPL%20v2-blue.svg
[gpl-url]: https://opensource.org/licenses/GPL-2.0
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=sustainable-computing-io/kepler&type=Date)](https://star-history.com/#sustainable-computing-io/kepler&Date)
", Assign "at most 3 tags" to the expected json: {"id":"3739","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"