Skip to content

Commit

Permalink
Add contraints on keys and type cast correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sambhav committed Jun 12, 2018
1 parent d97f22b commit 7679876
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion plugins/inputs/solr/solr.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,24 @@ func addCacheMetricsToAcc(acc telegraf.Accumulator, core string, mBeansData *MBe
for key, value := range metrics.Stats {
splitKey := strings.Split(key, ".")
newKey := splitKey[len(splitKey)-1]
coreFields[newKey] = value
switch newKey {
case "cumulative_evictions",
"cumulative_hits",
"cumulative_inserts",
"cumulative_lookups",
"eviction",
"hits",
"inserts",
"lookups",
"size",
"warmupTime":
coreFields[newKey] = getInt(value)
case "hitratio",
"cumulative_hitratio":
coreFields[newKey] = getFloat(value)
default:
continue
}
}
acc.AddFields(
"solr_cache",
Expand Down

0 comments on commit 7679876

Please sign in to comment.