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

Add HTTP metrics and TCP #635

Open
wants to merge 1 commit 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,14 @@ Further Information
| elasticsearch_thread_pool_queue_count | gauge | 14 | Thread Pool operations queued
| elasticsearch_thread_pool_rejected_count | counter | 14 | Thread Pool operations rejected
| elasticsearch_thread_pool_threads_count | gauge | 14 | Thread Pool current threads count
| elasticsearch_transport_tcp_connections_open_current | gauge | 1 | Number of connections opened for cluster communication
| elasticsearch_transport_outbound_connections_total | counter | 1 | Total number of outbound transport connections
| elasticsearch_transport_rx_packets_total | counter | 1 | Count of packets received
| elasticsearch_transport_rx_size_bytes_total | counter | 1 | Total number of bytes received
| elasticsearch_transport_tx_packets_total | counter | 1 | Count of packets sent
| elasticsearch_transport_tx_size_bytes_total | counter | 1 | Total number of bytes sent
| elasticsearch_http_connections_opened_current | gauge | 1 | Current number of opened connections
| elasticsearch_http_connections_opened_total | counter | 1 | Total number of opened connections
| elasticsearch_clusterinfo_last_retrieval_success_ts | gauge | 1 | Timestamp of the last successful cluster info retrieval
| elasticsearch_clusterinfo_up | gauge | 1 | Up metric for the cluster info collector
| elasticsearch_clusterinfo_version_info | gauge | 6 | Constant metric with ES version information as labels
Expand Down
50 changes: 49 additions & 1 deletion collector/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func getRoles(node NodeStatsNodeResponse) map[string]bool {
}
}
}
if len(node.HTTP) == 0 {
if node.HTTP == nil {
roles["client"] = false
}
return roles
Expand Down Expand Up @@ -1462,6 +1462,30 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
return defaultNodeLabelValues(cluster, node)
},
},
{
Type: prometheus.GaugeValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "transport", "tcp_connections_open_current"),
"Current number of connections open for cluster communication",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Transport.ServerOpen)
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "transport", "outbound_connections_total"),
"Count of outbound transport connections",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.Transport.OutboundConn)
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
Expand Down Expand Up @@ -1510,6 +1534,30 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.GaugeValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "http", "connections_opened_current"),
"Current number of open HTTP connections",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.HTTP.CurrentOpen)
},
Labels: defaultNodeLabelValues,
},
{
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "http", "connections_opened_total"),
"Total number of HTTP connections opened ",
defaultNodeLabels, nil,
),
Value: func(node NodeStatsNodeResponse) float64 {
return float64(node.HTTP.TotalOpen)
},
Labels: defaultNodeLabelValues,
},
},
gcCollectionMetrics: []*gcCollectionMetric{
{
Expand Down
15 changes: 8 additions & 7 deletions collector/nodes_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type NodeStatsNodeResponse struct {
ThreadPool map[string]NodeStatsThreadPoolPoolResponse `json:"thread_pool"`
JVM NodeStatsJVMResponse `json:"jvm"`
Breakers map[string]NodeStatsBreakersResponse `json:"breakers"`
HTTP map[string]interface{} `json:"http"`
HTTP *NodeStatsHTTPResponse `json:"http"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a pointer?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to change this condition:
if len(node.HTTP) == 0 {
to if node.HTTP == nil {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @sysadmind, any update/concern on this ?

Transport NodeStatsTransportResponse `json:"transport"`
Process NodeStatsProcessResponse `json:"process"`
}
Expand Down Expand Up @@ -101,11 +101,12 @@ type NodeStatsNetworkResponse struct {

// NodeStatsTransportResponse is a representation of a transport statistics about sent and received bytes in cluster communication
type NodeStatsTransportResponse struct {
ServerOpen int64 `json:"server_open"`
RxCount int64 `json:"rx_count"`
RxSize int64 `json:"rx_size_in_bytes"`
TxCount int64 `json:"tx_count"`
TxSize int64 `json:"tx_size_in_bytes"`
ServerOpen int64 `json:"server_open"`
OutboundConn int64 `json:"total_outbound_connections"`
RxCount int64 `json:"rx_count"`
RxSize int64 `json:"rx_size_in_bytes"`
TxCount int64 `json:"tx_count"`
TxSize int64 `json:"tx_size_in_bytes"`
}

// NodeStatsThreadPoolPoolResponse is a representation of a statistics about each thread pool, including current size, queue and rejected tasks
Expand Down Expand Up @@ -333,7 +334,7 @@ type NodeStatsProcessCPUResponse struct {
// NodeStatsHTTPResponse defines node stats HTTP connections structure
type NodeStatsHTTPResponse struct {
CurrentOpen int64 `json:"current_open"`
TotalOpen int64 `json:"total_open"`
TotalOpen int64 `json:"total_opened"`
}

// NodeStatsFSResponse is a representation of a file system information, data path, free disk space, read/write stats
Expand Down