Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding bulk requests errors metric #29

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions collector/nodestats_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type Pipeline struct {
In int `json:"in"`
Out int `json:"out"`
} `json:"events"`
BulkRequests struct {
Errors int `json:"with_errors"`
} `json:"bulk_requests"`
Name string `json:"name"`
} `json:"outputs"`
} `json:"plugins"`
Expand Down
18 changes: 18 additions & 0 deletions collector/nodestats_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type NodeStatsCollector struct {
PipelineQueueMaxUnreadEvents *prometheus.Desc

PipelineDeadLetterQueueSizeInBytes *prometheus.Desc

PipelineBulkRequestsWithErrors *prometheus.Desc
}

// NewNodeStatsCollector function
Expand Down Expand Up @@ -233,6 +235,13 @@ func NewNodeStatsCollector(logstashEndpoint string) (Collector, error) {
nil,
),

PipelineBulkRequestsWithErrors: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "bulk_requests_with_errors"),
"bulk_requests_with_errors",
[]string{"pipeline", "plugin", "plugin_id", "plugin_type"},
nil,
),

PipelinePluginMatches: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "plugin_matches_total"),
"plugin_matches",
Expand Down Expand Up @@ -623,6 +632,15 @@ func (c *NodeStatsCollector) collect(ch chan<- prometheus.Metric) (*prometheus.D
plugin.ID,
"output",
)
ch <- prometheus.MustNewConstMetric(
c.PipelineBulkRequestsWithErrors,
prometheus.CounterValue,
float64(plugin.BulkRequests.Errors),
pipelineID,
plugin.Name,
plugin.ID,
"output",
)
}

if pipeline.Queue.Type != "memory" {
Expand Down
6 changes: 6 additions & 0 deletions collector/nodestats_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ var noQueueJSON = []byte(`
"in": 0,
"out": 0
},
"bulk_requests": {
"with_errors": 1111,
"responses": {
"200": 1111
}
},
"name": "stdout"
}
]
Expand Down