-
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
Metricbeat: Collect accumulated docker network metrics #7253
Conversation
c58686b
to
99dc422
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.
Needs rebase
type: long | ||
description: > | ||
Total number of outgoing packets. | ||
- name: inbound |
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.
To follow ECS, should it be on the root level? Meaning having it under network.inbound.bytes
?
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.
Umm, you are right, I was misinterpreting ECS for this case, would it be ok to have this without the docker
preffix?
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.
If the content of the field matches ECS I would say yes.
@ruflin I have done the changes for more proper ECS, this would probably require its own PR, but lets discuss all together before. |
libbeat/_meta/fields.ecs-ext.yml
Outdated
- key: ecs-ext | ||
title: ECS extensions | ||
description: > | ||
Contains extensions to ECS (https://github.com/elastic/ecs) |
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 have added this for common fields that are not (yet) in ECS, but they could be in the future. Changes here should be followed by discussions/PRs in ECS repo.
We could also use the commons file for that, but I think that it's fine to leave the common file for things needed by beats but that don't make sense in ECS.
libbeat/_meta/fields.ecs.yml
Outdated
@@ -0,0 +1,55 @@ | |||
- key: ecs |
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 file should probably be automatically generated from https://github.com/elastic/ecs/tree/master/schemas
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.
Agree. Let's keep it manual for now to not add fields we don't use at the moment.
event := common.MapStr{ | ||
mb.ModuleDataKey: common.MapStr{ | ||
"container": stats.Container.ToMapStr(), | ||
func eventMapping(r mb.ReporterV2, stats *NetStats) { |
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.
Three events would be created now:
- Incoming traffic
- Outgoing traffic
- Legacy event
"errors": 0, | ||
"packets": 142 | ||
}, | ||
"interface": "eth0" |
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 event contains only inbound data, there would be another one with outbound data.
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.
In general I like the addition of ECS on the top level. The part I worry about is that for example winlogbeat template contains now more unused fields then before but I think it's a worthy tradeoff. Perhaps we could let each beat configure which ECS prefixes he wants to use.
Left a few comments / questions.
libbeat/_meta/fields.ecs.yml
Outdated
@@ -0,0 +1,55 @@ | |||
- key: ecs |
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.
Agree. Let's keep it manual for now to not add fields we don't use at the moment.
@@ -33,8 +34,9 @@ | |||
Total number of incoming packets. | |||
- name: out | |||
type: group | |||
deprecated: true |
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 should start making use of this flag in the docs.
container.Put("runtime", "docker") | ||
|
||
// Inbound traffic event | ||
r.Event(mb.Event{ |
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 would still expect that 1 event is sent out with all the stats inside. It seems now we send out 3 events? Why not combine inbound and outbound?
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 did that initially, but then I saw that we have a network.direction
field in ECS, then I though that according to ECS we'd have different events for inbound and outbound traffic. Not sure what would be the use case for this field if not used for something like this.
// Inbound traffic event | ||
r.Event(mb.Event{ | ||
RootFields: common.MapStr{ | ||
"container": container, |
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.
Not sure I would mix the container
to the root level into this 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.
The idea is to move the container
fields to ECS structure too.
@@ -45,12 +44,13 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { | |||
} | |||
|
|||
// Fetch methods creates a list of network events for each container. | |||
func (m *MetricSet) Fetch() ([]common.MapStr, error) { | |||
func (m *MetricSet) Fetch(r mb.ReporterV2) { |
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.
yay, v2 reporter.
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.
Essential for migration to ECS 😄
As discussed yesterday, lets move the ECS part to an other PR and continue at the moment with just adding the new fields. I still would like to see the change to v2 reporter ;-) |
Collect accumulated docker network metrics and mark previous metrics as deprecated.
I have reverted the changes for ECS, but kept the change to v2 reporter, I opened #7301 to continue discussion on ECS. I think we should backport this for 6.3.1. |
description: > | ||
Total number of outgoing bytes. | ||
- name: dropped | ||
type: scaled_float |
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 this be long?
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, all these fields should be long, I'll change it.
description: > | ||
Total number of incoming bytes. | ||
- name: dropped | ||
type: scaled_float |
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.
Long?
@jsoriano Do you want to backport it to 6.3? |
Collect accumulated docker network metrics and mark previous metrics as deprecated. Fixes elastic#7240 (cherry picked from commit f0c57ea)
I have opened backport (#7363), but this is not a fix. In any case all related changes are already in 6.3, so I think it can make sense to merge this too. |
…er network metrics (elastic#7363) Cherry-pick of PR elastic#7253 to 6.3 branch. Original message: Collect accumulated docker network metrics and mark previous metrics as deprecated. Fixes elastic#7240
Collect accumulated docker network metrics and mark previous metrics as deprecated.
Fixes #7240