Extending the OpenTelemetry java auto-instrumentation agent to publish green software metrics

Status:: 🟩
Links:: OpenTelemetry Java Agent Extension by RETIT

Metadata

Authors:: Brunnert, Andreas; Gutzy, Ferdinand
Title:: Extending the OpenTelemetry java auto-instrumentation agent to publish green software metrics
Date:: 2024
Publisher:: Gesellschaft fΓΌr Informatik e.V.
URL:: https://dl.gi.de/handle/20.500.12116/45524
DOI::

Notes & Annotations

Color-coded highlighting system used for annotations

πŸ“‘ Annotations (imported on 2025-01-19#10:26:16)

brunnert.gutzy.2024.extendingopentelemetryjava

We use OpenTelemetry4 as standard for capturing and transferring the metrics from the application to Prometheus5 as time series database. Grafana6 is used to visualize and calculate the carbon emissions per transaction as well as per server, container, or virtual machine involved in processing a transaction over time.

brunnert.gutzy.2024.extendingopentelemetryjava

The reason for this change is that we are now using freely available data8 from the Cloud Carbon Footprint (CCF)9 project to calculate the emissions, which are bundled with the application and do not change over time.

brunnert.gutzy.2024.extendingopentelemetryjava (image) (pg. 2)

Figure 2: Resource Profile

brunnert.gutzy.2024.extendingopentelemetryjava (pg. 2)

We use the same concepts to capture the resource demand (d) values for CPU (dCPU), memory (dMEM), storage (dSTO), and network (dNET) for each method (or transaction) by extending the existing measurement probes injected by the OTel Java AutoInstrumentation Agent using a SpanProcessor10.

brunnert.gutzy.2024.extendingopentelemetryjava (pg. 2)

As the total CPU utilization (CPUutil) is not directly related to the CPU demands of a single transaction of a system, we need to measure CPUutil in order to calculate the current power consumption of the CPU, and then we can allocate the power consumption proportionally to single transactions of the system. To do this, the CPU demand data needs to be converted into a utilization value (CPUutilT) by summing up all CPU demand values (measured in ms) of a transaction in a given time period (where t0 is the start timestamp of the time period in ms and tn is the end of the end timestamp of the time period in ms) and dividing this sum by the total time the CPU was busy in that time period

brunnert.gutzy.2024.extendingopentelemetryjava (pg. 3)

The R value can be omitted because all values are already scoped to a single functional unit, namely the transaction for which the resource demand values were measured.

brunnert.gutzy.2024.extendingopentelemetryjava (pg. 3)

The current implementation state of the emission calculation relies on many data sources that are based on assumptions and configurations. In addition, the data sources are static which is not realistic considering the GEF differences during day and night for renewable energy sources. Therefore, we are working on integrating other data sources that are more up-to-date with the current grid system on the one hand and the actual energy consumption of the system on the other hand. In addition, we plan to perform evaluations comparing our calculations with real measurements to see how well they represent the reality.