Skip to content

Commit

Permalink
Merge pull request #6 from duhang/duhang/issue-5-prospector-to-input
Browse files Browse the repository at this point in the history
Fix for issue #5 prospector to input
  • Loading branch information
shivas authored Sep 26, 2018
2 parents 67af338 + 1e008d2 commit 8e1c4ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions collector/filebeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ type Filebeat struct {
Started float64 `json:"started"`
} `json:"harvester"`

Prospector struct {
Input struct {
Log struct {
Files struct {
Renamed float64 `json:"renamed"`
Truncated float64 `json:"truncated"`
} `json:"files"`
} `json:"log"`
} `json:"prospector"`
} `json:"input"`
}

type filebeatCollector struct {
Expand Down Expand Up @@ -116,20 +116,20 @@ func NewFilebeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "filebeat", "prospector_log"),
"filebeat.prospector_log",
prometheus.BuildFQName(beatInfo.Beat, "filebeat", "input_log"),
"filebeat.input_log",
nil, prometheus.Labels{"files": "renamed"},
),
eval: func(stats *Stats) float64 { return stats.Filebeat.Prospector.Log.Files.Renamed },
eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Log.Files.Renamed },
valType: prometheus.UntypedValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "filebeat", "prospector_log"),
"filebeat.prospector_log",
prometheus.BuildFQName(beatInfo.Beat, "filebeat", "input_log"),
"filebeat.input_log",
nil, prometheus.Labels{"files": "truncated"},
),
eval: func(stats *Stats) float64 { return stats.Filebeat.Prospector.Log.Files.Truncated },
eval: func(stats *Stats) float64 { return stats.Filebeat.Input.Log.Files.Truncated },
valType: prometheus.UntypedValue,
},
},
Expand Down
12 changes: 6 additions & 6 deletions collector/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system", "load"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "1"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.M1 },
Expand All @@ -54,7 +54,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system", "load"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "5"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.M5 },
Expand All @@ -63,7 +63,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system", "load"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "15"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.M15 },
Expand All @@ -72,7 +72,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system_load", "norm"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "1"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.Norm.M1 },
Expand All @@ -81,7 +81,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system_load", "norm"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "5"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.Norm.M5 },
Expand All @@ -90,7 +90,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system_load", "norm"),
"system load 1m",
"system load",
nil, prometheus.Labels{"period": "15"},
),
eval: func(stats *Stats) float64 { return stats.System.Load.Norm.M15 },
Expand Down

0 comments on commit 8e1c4ac

Please sign in to comment.