• Hackathons
  • Features
  • Blog

Carbon Metrics for Spring Boot

Drop-in autoconfigured carbon awareness metrics for Spring Boot apps.

  • 0 Raised
  • 0 Juries


  • This hackathon has categories available. Please select one if necessary.



The Problem

One of the hardest parts about making carbon-aware computing decisions as a software developer is knowing how to start seeing real data and measuring the impact of your everyday decisions.

The Green Software Foundation’s Software Carbon Intensity (SCI) specification helps us answer these questions!

What does this project do?

Carbon Metrics for Spring Boot provides a reference implementation and framework for automatically calculating SCI values for a running Spring Boot application.

The project has three goals:

  1. Make it easy to measure and see the carbon impact of my applications, while they're running and while they're doing specific work

  2. Make it easy to measure and see that impact across multiple services interacting with each other

  3. Make it easy for lots of developers to get that data and measure improvements towards their sustainability goals

We’ve built on industry-standard metrics and tracing tools like OpenTelemetry to make it easy to understand carbon intensity data in the same ways we use other business or technical measurements.

How does it use the Carbon Aware SDK?

We provide a drop-in dependency to add to your Spring Boot projects that automatically configures your app to pull data from the Carbon Aware SDK, compute SCI values, and publish software carbon intensity scores to your dashboard of choice.

It currently supports:

  • Pulling marginal carbon intensity from the Carbon-Aware SDK for the applications location

  • Estimating an application’s energy consumption based on system resource stats like processor utilization

  • Providing an embodied emissions value for your application through configuration

  • Regularly reporting software carbon intensity metrics to your dashboard of choice

Impact on CO2

We chose to focus on Java & Spring Boot as our technical stack to maximize the total impact of the project:

  • GitHub's public repositories show that Java is a consistent top language for all kinds of projects, big or small

  • JRebel's Java Technology Report shows that Spring Boot is currently used on over two thirds of Java projects

  • There are thousands of Java projects tucked away behind enterprises all around the world!

If we can make it easy for this community to get carbon awareness for little or no work and start making sustainable architectural decisions, we believe this is massive in both reach and impact.

Project Feasibility

The Carbon-Aware SDK makes measuring marginal carbon intensity easy, but there’s lots of work to do to make the three key measurements more accurate and available in all environments.

💡 Energy consumption is highly platform specific.  We currently estimate this broadly with CPU usage, but don't take into account hardware-specific profiles or other less-impactful hardware like GPUs or disk access.  We can leverage Spring Boot’s flexibility to create customized implementations that take advantage of platform-specific tooling or instrumentation to give real values in watts.  Integration with other projects like JoulerJX or Oshi might provide low-level system data on some platforms.

⚙️ Embodied emissions are complex to compute, and even harder in heterogeneous cloud environments. Our prototype doesn't try to compute this, but allows the user to preconfigure a known embodied emissions value (if they know it). We look forward to integrating with embodied emissions data provided by cloud environments in the future. We also think there are opportunities for fingerprinting hardware or building models that can give us better emboded emissions data when we don't have control over our environment.

Even without these two improvements, we believe some data is better than no data at all.  The tool can give comparable SCI values today, and we can improve these values from here. A core principle of the project was to make this low-configuration and batteries-included, while still allows it to be customized and extended. We have a backlog of work and experiments aimed at making it easier to use and provide more valuable insights:

  • Can we leverage location services and environmental indicators to automatically detect an application’s location?

  • Can we use distributed tracing data to identify applications that work together to do work, and provide SCI values for a whole distributed system?

  • Can we attribute parts of an applications SCI to individual APIs or subsystems in an application?  Something like Sense’s machine learning, but for your `/orders` endpoint instead of your washing machine.

🌱 Our Vision

Making an application’s carbon intensity visible is only the first step.  Armed with this information and easy-to-use dashboards, we believe architects, developers, and technology leaders can make data-driven modernization decisions to meet their sustainability goals.


Useful References