Revert "Rabbitmq plugin: connection-related metrics." (#2169)
This commit is contained in:
@@ -50,9 +50,8 @@ type RabbitMQ struct {
|
||||
ClientTimeout internal.Duration `toml:"client_timeout"`
|
||||
|
||||
// InsecureSkipVerify bool
|
||||
Nodes []string
|
||||
Queues []string
|
||||
Connections []string
|
||||
Nodes []string
|
||||
Queues []string
|
||||
|
||||
Client *http.Client
|
||||
}
|
||||
@@ -136,22 +135,10 @@ type Node struct {
|
||||
SocketsUsed int64 `json:"sockets_used"`
|
||||
}
|
||||
|
||||
// Connection ...
|
||||
type Connection struct {
|
||||
Name string
|
||||
State string
|
||||
Vhost string
|
||||
Host string
|
||||
Node string
|
||||
ReceiveCount int64 `json:"recv_cnt"`
|
||||
SendCount int64 `json:"send_cnt"`
|
||||
SendPend int64 `json:"send_pend"`
|
||||
}
|
||||
|
||||
// gatherFunc ...
|
||||
type gatherFunc func(r *RabbitMQ, acc telegraf.Accumulator, errChan chan error)
|
||||
|
||||
var gatherFunctions = []gatherFunc{gatherOverview, gatherNodes, gatherQueues, gatherConnections}
|
||||
var gatherFunctions = []gatherFunc{gatherOverview, gatherNodes, gatherQueues}
|
||||
|
||||
var sampleConfig = `
|
||||
# url = "http://localhost:15672"
|
||||
@@ -393,42 +380,6 @@ func gatherQueues(r *RabbitMQ, acc telegraf.Accumulator, errChan chan error) {
|
||||
errChan <- nil
|
||||
}
|
||||
|
||||
func gatherConnections(r *RabbitMQ, acc telegraf.Accumulator, errChan chan error) {
|
||||
// Gather information about connections
|
||||
connections := make([]Connection, 0)
|
||||
err := r.requestJSON("/api/connections", &connections)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
|
||||
for _, connection := range connections {
|
||||
if !r.shouldGatherConnection(connection) {
|
||||
continue
|
||||
}
|
||||
tags := map[string]string{
|
||||
"url": r.URL,
|
||||
"connection": connection.Name,
|
||||
"vhost": connection.Vhost,
|
||||
"host": connection.Host,
|
||||
"node": connection.Node,
|
||||
}
|
||||
|
||||
acc.AddFields(
|
||||
"rabbitmq_connection",
|
||||
map[string]interface{}{
|
||||
"recv_cnt": connection.ReceiveCount,
|
||||
"send_cnt": connection.SendCount,
|
||||
"send_pend": connection.SendPend,
|
||||
"state": connection.State,
|
||||
},
|
||||
tags,
|
||||
)
|
||||
}
|
||||
|
||||
errChan <- nil
|
||||
}
|
||||
|
||||
func (r *RabbitMQ) shouldGatherNode(node Node) bool {
|
||||
if len(r.Nodes) == 0 {
|
||||
return true
|
||||
@@ -457,20 +408,6 @@ func (r *RabbitMQ) shouldGatherQueue(queue Queue) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *RabbitMQ) shouldGatherConnection(connection Connection) bool {
|
||||
if len(r.Connections) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, name := range r.Connections {
|
||||
if name == connection.Name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func init() {
|
||||
inputs.Add("rabbitmq", func() telegraf.Input {
|
||||
return &RabbitMQ{
|
||||
|
||||
Reference in New Issue
Block a user