Hi devs,

I'd like to propose adding the oshi-core library to the Cassandra Sidecar
project for collecting system information. This information can be useful
to operate Cassandra clusters better and can help capacity planning and
operational troubleshooting. With CASSSIDECAR-366
<https://issues.apache.org/jira/browse/CASSSIDECAR-366>, proposing to
expose disk information via Sidecar that can help capacity planning. While
CASSSIDECAR-366 focuses on disk metrics as the initial use case, I believe
this dependency provides valuable capabilities we can leverage over time.
Here are more details

What is oshi-core?

OSHI (Operating System and Hardware Information)
<https://github.com/oshi/oshi> is a cross-platform JNA-based Java
library for retrieving system and hardware information. It does not require
the installation of any additional native libraries and aims to provide a
cross-platform implementation to retrieve information including:


   - Disk/filesystem metrics (initial use case)
   - CPU utilization and load averages
   - Memory and swap usage
   - Network interface statistics
   - Process information
   - System uptime and boot time


Why oshi-core instead of JDK's FileStore?

JDK's FileStore API lacks mount point information - you can't tell which
device (/dev/sda1, /dev/nvme0n1) corresponds to each store. This could be
crucial from the operational perspective. This library provides information
that JDK does not provide.

oshi-core dependency analysis:

   - It supports Linux, MacOS, Windows & UNIX based platforms (AIX,
   Solaris, etc...) [ref
   <https://github.com/oshi/oshi?tab=readme-ov-file#supported-platforms>]
   - It internally uses the JNA library to interact with native OS. JNA
   supports all major processor architectures including x86, amd64, aarch64
   and others [ref
   
<https://github.com/java-native-access/jna/blob/0deb54b46dc04f655e3c1d46e848fd26bf47c09a/native/Makefile#L10>
   ]
   - Cassandra is already using the JNA library
   - Found that Apache Flink is using oshi-core for system metrics [ref
   <https://github.com/apache/flink/blob/master/pom.xml#L591>] [ref
   
<https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/util/SystemResourcesMetricsInitializer.java#L37>
   ]
   - Uses MIT license


I propose we add oshi-core 6.9.1 as a dependency to Sidecar. While we're
starting with disk metrics (CASSSIDECAR-366), this positions us to add
other system information endpoints as operational needs arise.

Any thoughts or concerns?

Thanks!
Harikrishna

Reply via email to