akka/akka-core

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

开放

#21,240 创建于 2016年8月21日

 (5 条评论) (0 个反应) (0 位负责人)Scala (3,547 个派生)batch import
1 - triagedhelp wantedt:cluster-tools

仓库指标

星标
 (13,277 个星标)
PR 合并指标
 (平均合并 8天 19小时) (30 天内合并 10 个 PR)

描述

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.

贡献者指南