NullPointerException on unsupported architecture
What happened
When trying to use Kamon on aarch64, Kamon fails with a NPE:
Exception in thread "main" java.lang.NullPointerException
at kamon.sigar.SigarProvisioner.transfer(SigarProvisioner.java:209)
at kamon.sigar.SigarProvisioner.provision(SigarProvisioner.java:173)
at kamon.system.SystemMetrics$.collectSigarMetrics(SystemMetrics.scala:88)
at kamon.system.SystemMetrics$.startCollecting(SystemMetrics.scala:72)
at kamon.system.SystemMetrics.startCollecting(SystemMetrics.scala)
at com.example.myapp.startKamon(MyApp.java:94)
Investigating I found a 0 byte file native/libsigar-aarch64-linux.so in my application directory. Checking the contents of sigar-loader-1.6.5-rev003.jar I found that this architecture is not included.
Version info
java: openjdk version "1.8.0_275" Kamon: kamon-core_2.11-1.1.5.jar, kamon-system-metrics_2.11-1.0.1.jar sigar-loader: sigar-loader-1.6.5-rev003.jar
What I would expect to happen
- Have system metrics for this architecture
- Or have a meaningful error message and in best case just have no system metrics, but system continues to work.
Workaround
I build libsigar-aarch64-linux.so myself from this branch and repackaged it into sigar-loader-1.6.5-rev003.jar. This is an very inconvenient workflow, so it would be better to have it directly included.
You're using kamon 1.x, please upgrade to 2.x, we're not using Sigar anymore, Oshi is now in charge of getting system metrics!
Is there anything specific keeping you on that version of kamon?