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