Implement breakers stats.

This commit is contained in:
Orne Brocaar 2015-07-09 20:43:52 +02:00
parent 0faa1c886a
commit d799011039
3 changed files with 48 additions and 0 deletions

View File

@ -24,6 +24,7 @@ type node struct {
FS interface{} `json:"fs"` FS interface{} `json:"fs"`
Transport interface{} `json:"transport"` Transport interface{} `json:"transport"`
HTTP interface{} `json:"http"` HTTP interface{} `json:"http"`
Breakers interface{} `json:"breakers"`
} }
const sampleConfig = ` const sampleConfig = `
@ -131,6 +132,9 @@ func (e *Elasticsearch) gatherUrl(url string, acc plugins.Accumulator) error {
if err := e.parseInterface(acc, "http", tags, n.HTTP); err != nil { if err := e.parseInterface(acc, "http", tags, n.HTTP); err != nil {
return err return err
} }
if err := e.parseInterface(acc, "breakers", tags, n.Breakers); err != nil {
return err
}
} }
return nil return nil

View File

@ -85,4 +85,7 @@ func TestElasticsearch(t *testing.T) {
for key, val := range httpExpected { for key, val := range httpExpected {
assert.NoError(t, acc.ValidateTaggedValue(key, val, tags)) assert.NoError(t, acc.ValidateTaggedValue(key, val, tags))
} }
for key, val := range breakersExpected {
assert.NoError(t, acc.ValidateTaggedValue(key, val, tags))
}
} }

View File

@ -411,6 +411,32 @@ const statsResponse = `
"http": { "http": {
"current_open": 3, "current_open": 3,
"total_opened": 3 "total_opened": 3
},
"breakers": {
"fielddata": {
"limit_size_in_bytes": 623326003,
"limit_size": "594.4mb",
"estimated_size_in_bytes": 0,
"estimated_size": "0b",
"overhead": 1.03,
"tripped": 0
},
"request": {
"limit_size_in_bytes": 415550668,
"limit_size": "396.2mb",
"estimated_size_in_bytes": 0,
"estimated_size": "0b",
"overhead": 1.0,
"tripped": 0
},
"parent": {
"limit_size_in_bytes": 727213670,
"limit_size": "693.5mb",
"estimated_size_in_bytes": 0,
"estimated_size": "0b",
"overhead": 1.0,
"tripped": 0
}
} }
} }
} }
@ -691,3 +717,18 @@ var httpExpected = map[string]float64{
"http_current_open": 3, "http_current_open": 3,
"http_total_opened": 3, "http_total_opened": 3,
} }
var breakersExpected = map[string]float64{
"breakers_fielddata_estimated_size_in_bytes": 0,
"breakers_fielddata_overhead": 1.03,
"breakers_fielddata_tripped": 0,
"breakers_fielddata_limit_size_in_bytes": 623326003,
"breakers_request_estimated_size_in_bytes": 0,
"breakers_request_overhead": 1.0,
"breakers_request_tripped": 0,
"breakers_request_limit_size_in_bytes": 415550668,
"breakers_parent_overhead": 1.0,
"breakers_parent_tripped": 0,
"breakers_parent_limit_size_in_bytes": 727213670,
"breakers_parent_estimated_size_in_bytes": 0,
}