[release] v0.13.0-unstable11
This commit is contained in:
parent
6e06daa531
commit
cc7aaf17f2
3 changed files with 10 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.13.0-unstable10",
|
||||
"version": "0.13.0-unstable11",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
|
@ -20,6 +20,7 @@ type DataDef struct {
|
|||
Scale int
|
||||
Unit string
|
||||
Decumulate bool
|
||||
DecumulatePos bool
|
||||
Object string
|
||||
}
|
||||
|
||||
|
@ -36,6 +37,7 @@ type DataPush struct {
|
|||
Scale int
|
||||
Unit string
|
||||
Decumulate bool
|
||||
DecumulatePos bool
|
||||
Object string
|
||||
}
|
||||
|
||||
|
@ -169,15 +171,19 @@ func PushSetMetric(key string, value int, def DataDef) {
|
|||
lock <- true
|
||||
defer func() { <-lock }()
|
||||
|
||||
if def.Decumulate {
|
||||
if def.Decumulate || def.DecumulatePos {
|
||||
if lastInserted[key] != 0 {
|
||||
value = value - lastInserted[key]
|
||||
if def.DecumulatePos && value < 0 {
|
||||
value = 0
|
||||
}
|
||||
} else {
|
||||
value = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if dp, ok := dataBuffer[cacheKey]; ok {
|
||||
value = MergeMetric(def.SetOperation, dp.Value, value, dp.AvgIndex)
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ func GetSystemMetrics() {
|
|||
Label: "Docker Network Received " + ds.Name,
|
||||
SetOperation: "max",
|
||||
AggloType: "sum",
|
||||
Decumulate: true,
|
||||
DecumulatePos: true,
|
||||
Unit: "B",
|
||||
Object: "container@" + ds.Name,
|
||||
})
|
||||
|
@ -245,7 +245,7 @@ func GetSystemMetrics() {
|
|||
Label: "Docker Network Sent " + ds.Name,
|
||||
SetOperation: "max",
|
||||
AggloType: "sum",
|
||||
Decumulate: true,
|
||||
DecumulatePos: true,
|
||||
Unit: "B",
|
||||
Object: "container@" + ds.Name,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue