akka/akka-core

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

Aberta

#21.240 aberto em 21 de ago. de 2016

 (5 comentários) (0 reação) (0 responsável)Scala (3.547 forks)batch import
1 - triagedhelp wantedt:cluster-tools

Métricas do repositório

Stars
 (13.277 estrelas)
Métricas de merge de PR
 (Mesclagem média 8d 19h) (10 fundiu PRs em 30d)

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.

Guia do colaborador