-
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 node only reports metrics of itself by default #6971
Conversation
return &apiOverview, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() (common.MapStr, error) { |
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.
exported method MetricSet.Fetch should have comment or be unexported
}, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() ([]common.MapStr, error) { | ||
content, err := m.HTTP.FetchContent() | ||
type ApiOverview struct { |
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.
exported type ApiOverview should have comment or be unexported
type ApiOverview should be APIOverview
return &apiOverview, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() (common.MapStr, error) { |
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.
exported method MetricSet.Fetch should have comment or be unexported
}, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() ([]common.MapStr, error) { | ||
content, err := m.HTTP.FetchContent() | ||
type ApiOverview struct { |
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.
exported type ApiOverview should have comment or be unexported
type ApiOverview should be APIOverview
8a51a6a
to
b5cb2d8
Compare
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 like the change to the default to only have 1 node by default. I'm wondering if there should be a config option to still be able to receive information for all nodes. This has the advantage that it allows to monitor rabbitmq nodes also in the case Metricbeat can't be installed on each node and is monitored from a central place. This can also happen in a follow up PR. WDYT?
}, nil | ||
} | ||
|
||
func (m *MetricSet) Fetch() ([]common.MapStr, error) { | ||
content, err := m.HTTP.FetchContent() | ||
type apiOverview struct { |
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 normally keep all the mapping code in data.json
. But happy to change this convention :-)
Ok, agree to allow the user to still collect metrics from all the nodes. |
b5cb2d8
to
6963b42
Compare
overview *helper.HTTP | ||
} | ||
|
||
type AllMetricSet struct { |
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.
exported type AllMetricSet should have comment or be unexported
@@ -27,33 +34,108 @@ func init() { | |||
) | |||
} | |||
|
|||
type MetricSet struct { | |||
type SelfMetricSet struct { |
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.
exported type SelfMetricSet should have comment or be unexported
package node | ||
|
||
const ( | ||
ConfigModeSelf = "self" |
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.
exported const ConfigModeSelf should have comment (or a comment on this block) or be unexported
Added |
6963b42
to
2350220
Compare
CHANGELOG.asciidoc
Outdated
@@ -86,6 +86,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di | |||
- Don't stop Metricbeat if aerospike server is down. {pull}6874[6874] | |||
- disk reads and write count metrics in RabbitMQ queue metricset made optional. {issue}6876[6876] | |||
- Add mapping for docker metrics per cpu. {pull}6843[6843] | |||
- RabbitMQ node metricset only collects metrics of the instance it connects to, `node.mode: all` can be used to collect all nodes as before. {issue}6556[6556] {pull}6971[6971] |
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 we should move it to breaking changes.
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.
Going forth and back on this too. It is a breaking change but because the previous implementation was a bug instead of a feature.
We could move it under breaking change but mention there that it was a bug?
2350220
to
36d43ae
Compare
@@ -1 +1,10 @@ | |||
This is the `node` metricset of the RabbitMQ module. | |||
|
|||
It collects metrics of nodes, it has two modes that can be selected with the |
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 is the node
metricset of the RabbitMQ module and collects metrics about RabbitMQ nodes.
The metricset has two modes to collect data which can be selected with the node.mode
setting:
It collects metrics of nodes, it has two modes that can be selected with the | ||
`node.mode` setting: | ||
|
||
* `self`: collects metrics only from the node from whose endpoint `metricbeat` |
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.
collects metrics only from the node metricbeat
is connected to.
Should we add a note here that the recommended one is localhost? In the docker case multiple nodes will be configured in the hosts but still self
should be used.
* `self`: collects metrics only from the node from whose endpoint `metricbeat` | ||
is collecting metrics. This is the default, and the recommended mode when | ||
`metricbeat` is deployed in the same node as the RabbitMQ server. | ||
* `all`: collects metrics from all the nodes. This is recommended when |
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.
Should we call the config node.collection
and the options are node
or cluster
. I'm trying to find an other name for mode
that better describes what it does and the config option on what data it collects. Either it's only from the node or from all nodes / cluster. Writing this perhaps node
and all
would fit?
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.
Ok, changing to node.collect
with values node
and cluster
.
} | ||
|
||
// Fetch metrics from all rabbitmq nodes in the cluster | ||
func (m *AllMetricSet) Fetch() ([]common.MapStr, error) { |
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.
Instead of using 2 different MetricSet types we could move the Metricset to the reporter interface instead (see elasticsearch metricsets). Like this we would not have to make a difference if one or multiple events are reported.
36d43ae
to
d292b1f
Compare
@@ -27,33 +33,113 @@ func init() { | |||
) | |||
} | |||
|
|||
type MetricSet struct { | |||
// NodeMetricSet is the MetricSet type used when node.collect is "node" | |||
type NodeMetricSet struct { |
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.
type name will be used as node.NodeMetricSet by other packages, and that stutters; consider calling this MetricSet
Implemented using reporter V2 api now. |
func eventMapping(node map[string]interface{}) (common.MapStr, *s.Errors) { | ||
return schema.Apply(node) | ||
func eventMapping(r mb.ReporterV2, node map[string]interface{}) { | ||
event, _ := schema.Apply(node) |
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 not to ignore errors here, but Apply
is returning an error that seems like an empty list of missing fields (Literally: "Required fields are missing:
"). This happens also with the existing code, so this is not a regression. I leave investigating this for a future PR.
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.
Yes, we need a better general approach here. LGTM for now. Check out my recent changes in the elasticsearch module. There I use the errors for testing purpose only.
7fd0bde
to
ed5c789
Compare
jenkins, test this |
9ea5ee9
to
19fab91
Compare
A configuration option is added, `node.collect` that can be set to `cluster` to have the previous behaviour. The default is `node`.
19fab91
to
4ea4b0d
Compare
A configuration option is added, `node.collect` that can be set to `cluster` to have the previous behaviour. The default is `node`.
A configuration option is added, `node.collect` that can be set to `cluster` to have the previous behaviour. The default is `node`.
A configuration option is added,
node.collect
that can be set tocluster
to have the previous behaviour. The default isnode
.Fixes #6556