Rabbitmq plugin field problem

I saw the document about rabbitmq plugin and there is field "rabbitmq.exchange.messages".
But in my metricbeat with version 6.5.4-1, these fields still missing.
What version will have this field added?

elastic rabbitmq plugin document

Hi @Izek, thanks for posting your question here. 6.5.4 should support the rabbitmq.exchange.messages metrics. Do you have exchange metricset enabled in the rabbitmq config file?

Hi @Kaiyan_Sheng

Here is the document detail

"rabbitmq": {
        "exchange": {
            "arguments": {},
            "auto_delete": false,
            "durable": true,
            "internal": false,
            "messages": {
                "ack": {},
                "confirm": {},
                "deliver_get": {},
                "publish": {},
                "publish_in": {
                    "count": 607,
                    "details": {
                        "rate": 4
                    }
                },
                "publish_out": {
                    "count": 547,
                    "details": {
                        "rate": 4
                    }
                },
                "redeliver": {},
                "return_unroutable": {}
            },
            "name": "",
            "type": "direct",
            "user": "rmq-internal",
            "vhost": "/"
        }
    } 

And below is from metricbeat module test

  exchange...OK
    result:
    {
     "@timestamp": "2019-01-04T23:43:23.839Z",
     "metricset": {
      "host": "localhost:15672",
      "module": "rabbitmq",
      "name": "exchange",
      "rtt": 3840
     },
     "rabbitmq": {
      "exchange": {
       "arguments": {},
       "auto_delete": false,
       "durable": true,
       "internal": false,
       "name": "",
       "type": "direct",
       "vhost": "/"
      }
     }
    }

The message part is missing.
Also I cannot find those missing field in the field.yml file.

Thanks for the details. Can you check the metricbeat config file includes a similar part like this:

metricbeat.modules:
- module: rabbitmq
  metricsets: ["exchange"]

Please see https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-metricbeat.html for more details.

Here is my config.

- module: rabbitmq
  metricsets: ["node", "queue", "connection", "exchange"]
  enabled: true
  period: 60s
  hosts: ["http://test:15672"]
  username: test
  password: test

- module: rabbitmq
  metricsets: ["node", "queue", "connection", "exchange"]
  enabled: true
  period: 60s
  #hosts: ["http://localhost:15672"]
  hosts: ["http://localhost:15672"]
  username: test
  password: test

And I only have these much field in the index related to exchange

Hi @Kaiyan_Sheng,

Do you find anything about this?
Or is it a bug need to be fixed

@Izek Hello! Sorry for the late response! I'm confused by the question now :slight_smile: So you do see metrics from rabbitmq exchange metricset. That's good! So are you saying there are rabbitmq.exchange.messages.* metrics missing then?

Yes, for all the fields like ack, confirm, deliver_get are missing.
I try to query rabbitmq API directly and I can see the data there.

@Izek Yes ok now I see your question! Thanks for explaining it to me. I do have some suspicions on the rabbitmq exchange metricset schema might cause this problem. I will verify it and get back to you tomorrow! Thanks again!

@Izek Can you show us exactly which rabbitmq api query did you use here? @jsoriano When you get a chance, can you take a look at this issue please? Thanks!

I use this one "http://localhost:15672/api/exchanges".
RabbitMQ version is 3.6.5 and 3.6.15
The data inside message_stats is what I need

[{
	"name": "",
	"vhost": "/",
	"type": "direct",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "amq.direct",
	"vhost": "/",
	"type": "direct",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "amq.fanout",
	"vhost": "/",
	"type": "fanout",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "amq.headers",
	"vhost": "/",
	"type": "headers",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "amq.match",
	"vhost": "/",
	"type": "headers",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "amq.rabbitmq.log",
	"vhost": "/",
	"type": "topic",
	"durable": true,
	"auto_delete": false,
	"internal": true,
	"arguments": {}
}, {
	"name": "amq.rabbitmq.trace",
	"vhost": "/",
	"type": "topic",
	"durable": true,
	"auto_delete": false,
	"internal": true,
	"arguments": {}
}, {
	"name": "amq.topic",
	"vhost": "/",
	"type": "topic",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {}
}, {
	"name": "",
	"vhost": "clusterSvcHost",
	"type": "direct",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"name": "amq.direct",
	"vhost": "clusterSvcHost",
	"type": "direct",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"name": "amq.fanout",
	"vhost": "clusterSvcHost",
	"type": "fanout",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"name": "amq.headers",
	"vhost": "clusterSvcHost",
	"type": "headers",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"name": "amq.match",
	"vhost": "clusterSvcHost",
	"type": "headers",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"name": "amq.rabbitmq.trace",
	"vhost": "clusterSvcHost",
	"type": "topic",
	"durable": true,
	"auto_delete": false,
	"internal": true,
	"arguments": {},
	"policy": "ha-clustersvc"
}, {
	"message_stats": {
		"publish": 0,
		"publish_details": {
			"rate": 0.0
		},
		"publish_in": 2317414549,
		"publish_in_details": {
			"rate": 426.0
		},
		"publish_out": 5595401900,
		"publish_out_details": {
			"rate": 1069.6
		},
		"ack": 0,
		"ack_details": {
			"rate": 0.0
		},
		"deliver_get": 0,
		"deliver_get_details": {
			"rate": 0.0
		},
		"confirm": 0,
		"confirm_details": {
			"rate": 0.0
		},
		"return_unroutable": 0,
		"return_unroutable_details": {
			"rate": 0.0
		},
		"redeliver": 0,
		"redeliver_details": {
			"rate": 0.0
		}
	},
	"name": "amq.topic",
	"vhost": "clusterSvcHost",
	"type": "topic",
	"durable": true,
	"auto_delete": false,
	"internal": false,
	"arguments": {},
	"policy": "ha-clustersvc"
}]

Hi @Izek,

There are some things that can create confusion here.

First, the document you mention from the config. I have tried to reproduce it and with current code this actually only contains publish_in and publish_out fields. The one in the repository may have been generated with an old or in development version of the code.

Also, note that Metricbeat is tested with rabbitmq 5.7, even if the stats seem to follow the same format, there can be some differences, we'd have to check.

Another point is that the message_stats object is commonly used by rabbitmq management interface to collect stats of different kinds of objects, but not all objects use all fields (exchanges don't have the same metrics as queues, but internally they use the same object for stats). Metricbeat only collects the metrics that are meaningful for each kind of object, so we don't store loads of zero metrics.
This is an opinionated behaviour and is prone to missing fields, we can review the decissions here if we see some object reporting non-zero metrics for some field we are not collecting.

Now, for the case you mention, actually you have an exchange with non-zero values in publish_in and publish_out metrics, this should have been collected. Are you using the same user in metricbeat and in the query to the API? Different users can have different visibility. You may also need to configure the vhost.

It is also weird that the event that is being collected with module test has an exchange with an empty name, we may be incorrectly handling some error.

I will open an issue as follow up of this, at least to regenerate the example data and to check support of Rabbitmq 3.6.

Issue created for follow up actions https://github.com/elastic/beats/issues/10014

Please keep the discussion here and we'll update the issue with more actions if needed.

Hi @jsoriano,

I use same user wherever query api or in metricbeat.
And yes, the publish_in and publish_out are successfully collected.
I will try to use admin account to do the test again to see there have any different or not.

Do you mean that these fields are successfully collected by metricbeat? AFAIK these are all the stats that can be collected from exchanges, so it'd be the expected behaviour.

Do you know of some scenario in which more (non-zero) metrics are reported for exchanges?

Yes, but only these two field. nothing else.
I also expect it can collect everything inside the message_stats but there have no those fields in the field.yml file.
I try to add it manually but not work.

And I try to hit the version 3.6.x API, for the other fields, not collect metric even it is non-zero.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.