Skip to content
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

Merged
merged 3 commits into from
Jun 19, 2018

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jun 4, 2018

Collect accumulated docker network metrics and mark previous metrics as deprecated.

Fixes #7240

Copy link
Member

@ruflin ruflin left a 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
Copy link
Member

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 ?

Copy link
Member Author

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?

Copy link
Member

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.

@jsoriano
Copy link
Member Author

@ruflin I have done the changes for more proper ECS, this would probably require its own PR, but lets discuss all together before.

@jsoriano jsoriano added in progress Pull request is currently in progress. discuss Issue needs further discussion. and removed review labels Jun 11, 2018
- key: ecs-ext
title: ECS extensions
description: >
Contains extensions to ECS (https://github.com/elastic/ecs)
Copy link
Member Author

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.

@@ -0,0 +1,55 @@
- key: ecs
Copy link
Member Author

@jsoriano jsoriano Jun 11, 2018

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

Copy link
Member

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) {
Copy link
Member Author

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"
Copy link
Member Author

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.

Copy link
Member

@ruflin ruflin left a 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.

@@ -0,0 +1,55 @@
- key: ecs
Copy link
Member

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
Copy link
Member

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{
Copy link
Member

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?

Copy link
Member Author

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,
Copy link
Member

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.

Copy link
Member Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay, v2 reporter.

Copy link
Member Author

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 😄

@ruflin
Copy link
Member

ruflin commented Jun 12, 2018

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 ;-)

@jsoriano jsoriano added review and removed discuss Issue needs further discussion. in progress Pull request is currently in progress. labels Jun 12, 2018
Collect accumulated docker network metrics and mark
previous metrics as deprecated.
@jsoriano jsoriano added the needs_backport PR is waiting to be backported to other branches. label Jun 13, 2018
@jsoriano
Copy link
Member Author

jsoriano commented Jun 13, 2018

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be long?

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long?

@ruflin ruflin merged commit f0c57ea into elastic:master Jun 19, 2018
@ruflin
Copy link
Member

ruflin commented Jun 19, 2018

@jsoriano Do you want to backport it to 6.3?

@jsoriano jsoriano removed the needs_backport PR is waiting to be backported to other branches. label Jun 19, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Jun 19, 2018
Collect accumulated docker network metrics and mark previous metrics as deprecated.

Fixes elastic#7240

(cherry picked from commit f0c57ea)
@jsoriano
Copy link
Member Author

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.

ruflin pushed a commit that referenced this pull request Jun 20, 2018
…ork metrics (#7363)

Cherry-pick of PR #7253 to 6.3 branch. Original message: 

Collect accumulated docker network metrics and mark previous metrics as deprecated.

Fixes #7240
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants