-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Rabbitmq exchanges metricset #6607
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. Left a few comments but still need to have a closer look.
@@ -21,7 +21,7 @@ in <<configuration-metricbeat>>. Here is an example configuration: | |||
---- | |||
metricbeat.modules: | |||
- module: rabbitmq | |||
metricsets: ["node", "queue", "connection"] | |||
metricsets: ["node", "queue", "connection", "exchange"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminds me we should sort metricsets alphabetical (I can do that in a follow up PR).
@@ -0,0 +1,19 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance you could create a data.json here? The command you need is as following:
go test -tags=integration github.com/elastic/beats/metricbeat/module/rabbitmq/exchange/... -data
It assumes you have rabbitmq running on localhost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command does not generate the full json file (the message stats are missing). Am I missing something?
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"beat": {
"hostname": "host.example.com",
"name": "host.example.com"
},
"metricset": {
"host": "localhost:15672",
"module": "rabbitmq",
"name": "exchange",
"rtt": 115
},
"rabbitmq": {
"exchange": {
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "",
"type": "direct",
"vhost": "/"
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if something is wrong in the metricset if they are missing?
"rate": c.Float("rate"), | ||
}), | ||
}, | ||
"publish_in": s.Object{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make the above publish.total.count
and this one here publish.in
and the following publish.out
. Is it correct the the above is just the total?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of keeping it as publish_in
is that all the groups of metrics under messages
have the same structure, and they are also kept as a more direct mapping of source metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always in favor or having all the related metrics under on group but it's really hard to have a clear rule here. I'm good with both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I am not sure what "publish" is supposed to be. The official documentation says "Count of messages published.", but in my environment it is always 0, although publish_in and publish_out are both 0+.
Regarding the naming - it is up to you as I am not familiar with the metric set naming guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it as is for now
assert.EqualValues(t, false, event["auto_delete"]) | ||
assert.EqualValues(t, false, event["internal"]) | ||
|
||
messages := event["messages"].(common.MapStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if for the comparison here you could create a common.MapStr
with all fields inside with the expected values and then compare it? Would probably make the code a bit more readable and easier to extend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing that, but the Equals comparison fails for some reason, although the maps are identical (albeit in a different order):
Error: Not equal:
expected: common.MapStr{"return_unroutable":common.MapStr{"count":40, "details":common.MapStr{"rate":123.123}}, "redeliver":common.MapStr{"count":30, "details":common.MapStr{"rate":0.123}}, "publish":common.MapStr{"count":123, "details":common.MapStr{"rate":0.1}}, "publish_in":common.MapStr{"count":100, "details":common.MapStr{"rate":0.5}}, "publish_out":common.MapStr{"count":99, "details":common.MapStr{"rate":0.9}}, "ack":common.MapStr{"count":60, "details":common.MapStr{"rate":12.5}}, "deliver_get":common.MapStr{"details":common.MapStr{"rate":43.21}, "count":50}, "confirm":common.MapStr{"count":120, "details":common.MapStr{"rate":98.63}}}
actual : common.MapStr{"ack":common.MapStr{"count":60, "details":common.MapStr{"rate":12.5}}, "deliver_get":common.MapStr{"count":50, "details":common.MapStr{"rate":43.21}}, "confirm":common.MapStr{"count":120, "details":common.MapStr{"rate":98.63}}, "return_unroutable":common.MapStr{"count":40, "details":common.MapStr{"rate":123.123}}, "redeliver":common.MapStr{"count":30, "details":common.MapStr{"rate":0.123}}, "publish":common.MapStr{"count":123, "details":common.MapStr{"rate":0.1}}, "publish_in":common.MapStr{"count":100, "details":common.MapStr{"rate":0.5}}, "publish_out":common.MapStr{"details":common.MapStr{"rate":0.9}, "count":99}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets leave it as is then for now. I remember there was something like DeepEqual
but we can look into this later.
@kvalev branch needs rebase |
@kvalev will you find the time to finish this PR in the near future? I need this feature soon |
@kvalev I case you can't find the time to finish this PR, lets us know so we can take it over (or perhaps @CodingSpiderFox? ) to get it merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kvalev Just realised that there was also some feedback from our side missing. Sorry about that. Could you rebase the PR on master?
@@ -0,0 +1,19 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if something is wrong in the metricset if they are missing?
"rate": c.Float("rate"), | ||
}), | ||
}, | ||
"publish_in": s.Object{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it as is for now
I'm not good doing git stuff. Still learning. How can I do the rebase? Fork this repo, pull the branch kvalev and push it to my repo, rebase it on master and then open another PR? |
@ruflin I verified it again against my local RabbitMQ instance and it seems that in case the exchanges were not used recently (probably since last restart), the |
jenkins, test this please |
@kvalev I like the idea of populating some data before the test. It could also be part of the test instead of the docker image, like this it also work if done with a local instance. |
So what is the actual TODO here? |
I have created PR #6955 to resolve pending issues |
Continues with elastic#6607
Continues with elastic#6607
This pull requests add a new metricset for RabbitMQ exchanges.
Related to #6442