This commit is contained in:
Alex Marangone 2020-04-20 13:43:45 -07:00
parent 3f54974468
commit d3d112a2e4
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{