Skip to content

Latest commit

 

History

History
60 lines (50 loc) · 1.54 KB

web_api_metricSensors_chinese.md

File metadata and controls

60 lines (50 loc) · 1.54 KB

/metricSensors

此api用來指定未來可能會想要使用的CostfunctionMetricSensors,主要功能如下 (相關討論請看#1665) :

指定 MetricSensors

GET /sensors

cURL 範例

curl -X POST http://localhost:8001/sensors \
    -H "Content-Type: application/json" \
    -d '{
        "costs": [
                "org.astraea.common.cost.ReplicaLeaderCost",  
                "org.astraea.common.cost.NetworkIngressCost",
                "org.astraea.common.cost.NetworkEgressCost"
        ]
     }'

JSON Response 範例

  • costs: 目前已經註冊的MetricSensorsCostfunctionMetricStore會根據這些MetricSensors去撈取所需的metrics
{
   "costs":[
      "org.astraea.common.cost.NetworkIngressCost",
      "org.astraea.common.cost.ReplicaLeaderCost",
      "org.astraea.common.cost.NetworkEgressCost"
   ]
}

查詢已指定的 MetricSensors

GET /metricSensors

cURL 範例

查詢已經註冊的MetricSensorsCostfunction

curl -X GET http://localhost:8001/sensors

JSON Response 範例

{
  "costs":[
     "org.astraea.common.cost.NetworkCost$$Lambda$478/0x0000000840297840",
     "org.astraea.common.cost.ReplicaLeaderCost$$Lambda$476/0x0000000840297040"
  ]
}