Merge pull request #139 from digitalocean/amarangone/latency-fix-back

restore 1f2df8db38
This commit is contained in:
Alexandre Marangone 2020-04-20 14:13:22 -07:00 committed by GitHub
commit 398e6a12bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 38 deletions

View File

@ -395,7 +395,7 @@ type cephOSDDF struct {
} `json:"summary"`
}
type cephOSDPerf struct {
type cephPerfStat struct {
PerfInfo []struct {
ID json.Number `json:"id"`
Stats struct {
@ -405,6 +405,10 @@ type cephOSDPerf struct {
} `json:"osd_perf_infos"`
}
type CephOSDPerfStat struct {
cephPerfStat `json:"osdstats"`
}
type cephOSDDump struct {
OSDs []struct {
OSD json.Number `json:"osd"`
@ -583,7 +587,7 @@ func (o *OSDCollector) collectOSDPerf() error {
return err
}
osdPerf := &cephOSDPerf{}
osdPerf := &CephOSDPerfStat{}
if err := json.Unmarshal(buf, osdPerf); err != nil {
return err
}

View File

@ -164,43 +164,45 @@ func TestOSDCollector(t *testing.T) {
cmdOut: map[string]string{
"ceph osd perf": `
{
"osd_perf_infos": [
{
"id": 4,
"perf_stats": {
"commit_latency_ms": 0,
"apply_latency_ms": 0
"osdstats": {
"osd_perf_infos": [
{
"id": 4,
"perf_stats": {
"commit_latency_ms": 0,
"apply_latency_ms": 0
}
},
{
"id": 3,
"perf_stats": {
"commit_latency_ms": 1,
"apply_latency_ms": 64
}
},
{
"id": 2,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 79
}
},
{
"id": 1,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 39
}
},
{
"id": 0,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 31
}
}
},
{
"id": 3,
"perf_stats": {
"commit_latency_ms": 1,
"apply_latency_ms": 64
}
},
{
"id": 2,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 79
}
},
{
"id": 1,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 39
}
},
{
"id": 0,
"perf_stats": {
"commit_latency_ms": 2,
"apply_latency_ms": 31
}
}
]
]
}
}`,
},
regexes: []*regexp.Regexp{