akka/akka-core

ClusterMetrics always fails to verify Sigar provisioning on Windows 7 and 10

Open

#21,240 opened on Aug 21, 2016

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Scala (13,277 stars) (3,547 forks)batch import
1 - triagedhelp wantedt:cluster-tools

Description

Running on Windows 10 with Akka 2.4.9 and kamon sigar-loader version 1.6.6-rev002.

In Provision.scala.

  def verifiedSigarInstance: SigarProxy = {
    val sigar = new Sigar()
    sigar.getPid
    sigar.getLoadAverage
    sigar.getCpuPerc
    sigar
  }

def verifiedSigarInstance will always throw an exception when it attempts to run sigar.getLoadAvarage. This causes the ClusterMetrics extension to repeatedly attempt to provision/verify sigar, but it never succeeds. Apparently getLoadAverage simply isn't implemented for the Windows OS in "sigar-loader" % "1.6.6-rev002" which is the most recent version available as of August 21 2016. This is also the version of sigar-loader referenced in the cluster metrics documentation.

Running a simple program with the following code will reproduce the error under Windows 10, and likely Windows 7 too.

import java.io.File;
import org.hyperic.sigar.Sigar;
import kamon.sigar.SigarProvisioner;

object ExampleMain extends App {

  SigarProvisioner.provision();
   val sigar = new Sigar()
   val loadAverage =  sigar.getLoadAverage 
} 

The exception is:

Aug 20, 2016 2:52:59 PM kamon.sigar.SigarProvisioner discoverLocation
INFO: Using location provided by hard coded value.
Aug 20, 2016 2:52:59 PM kamon.sigar.SigarProvisioner provision
INFO: Sigar library provisioned: C:\Users\cvanvranken\gits\Example\main\server-metrics\native\sigar-amd64-winnt.dll
Exception in thread "main" org.hyperic.sigar.SigarNotImplementedException: This method has not been implemented on this platform
    at org.hyperic.sigar.SigarNotImplementedException.<clinit>(SigarNotImplementedException.java:28)
    at org.hyperic.sigar.Sigar.getLoadAverage(Native Method)

This function should be implemented in the hyperic/sigar repo within file: src/os/win32/win32_sigar.c, for function sigar_loadavg_get.

There is a comment above the function which makes me think they do not intend to fix it, the comment says: "there is no api for this info. closest i've seen is enumerating the entire process table and calculating an average based on process times."

I think the verifiedSigarInstance function that ClusterMetrics calls should be changed so that the getLoadAverage function is not called when running on Windows, otherwise Sigar will be unuseable there. Alternatively sigar_loadavg_get needs to be implemented.

I commented on this for the corresponding issue in the hyperic/sigar repo and someone responded to me. He says that this is implemented in the Boundary fork of sigar.

Contributor guide