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

Reorder processors in publisher pipeline #5149

Merged
merged 5 commits into from
Sep 12, 2017

Conversation

urso
Copy link

@urso urso commented Sep 11, 2017

  • reorder processors, such that the beat namespace can not be removed from client processors
  • remove support for EventsMetadataKey
  • combine client internal field updates and configured field updates into one dictionary
  • combine proessors for adding client and global fields+tags if no client processors are configured
  • Do not Clone (deep copy) fields being added in the pipeline if no processors are configured.

urso added 3 commits September 11, 2017 16:45
- reorder processors, such that all client processors run before the
  global processors
- remove support for EventsMetadataKey
- combine client internal field updates and configured field updates
  into one dictionary
- combine proessors for adding client and global fields+tags if no
  client processors are configured
Do not Clone (deep copy) fields being added in the pipeline if no
processors are configured.

As processors might add/remove fields and potentially modify shared
field objects, these must be copied if there is a chance global shared
structured being overwritten by processors. Especially if processors are
guarded by conditions.
@urso urso added libbeat needs_backport PR is waiting to be backported to other branches. review labels Sep 11, 2017
Problem is local fields+tags must be applied after the globaly
configured fields and tests, while client processors must be run before
the global ones.
Copy link
Contributor

@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.

What is the affect of this order change of processors?

p.processors = tmp
}

fields := common.MapStr{}
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to move this to line 391 as it is only used there.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah. Will simplify fields initialization.

@@ -11,9 +11,8 @@ import (
// Event metadata constants. These keys are used within libbeat to identify
// metadata stored in an event.
const (
EventMetadataKey = "_event_metadata"
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this already has become obsolete in previous refactoring?

Copy link
Author

Choose a reason for hiding this comment

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

The symbol still has been used in the processors pipeline. This PR removes support for _event_metadata in the pipeline -> can finally remove EventMetadataKey

func makePipelineProcessors(
annotations Annotations,
processors *processors.Processors,
disabled bool,
Copy link
Contributor

@kvch kvch Sep 12, 2017

Choose a reason for hiding this comment

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

Parameter disabled is not used in this function. Please remove it or use it.

Copy link
Author

Choose a reason for hiding this comment

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

Uh, thanks. It should be passed to pipelineProcessors.

Copy link
Author

Choose a reason for hiding this comment

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

done

- use 'disabled' flag
- simplify pipeline fields init
@urso
Copy link
Author

urso commented Sep 12, 2017

What is the affect of this order change of processors?

In the end it moves the processor adding the beat namespace to an event to a very late step. This way only global processors can remove fields from the beat namespace (e.g. beat.name, beat.hostname) and so on.

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM

@kvch kvch merged commit 6082603 into elastic:master Sep 12, 2017
urso pushed a commit to urso/beats that referenced this pull request Sep 12, 2017
* Reorder processors pipeline order

- reorder processors, such that all client processors run before the
  global processors
- remove support for EventsMetadataKey

* Combine fields and tags if possible

- combine client internal field updates and configured field updates
  into one dictionary
- combine proessors for adding client and global fields+tags if no
  client processors are configured

* Do not copy if no processors are defined

Do not Clone (deep copy) fields being added in the pipeline if no
processors are configured.

As processors might add/remove fields and potentially modify shared
field objects, these must be copied if there is a chance global shared
structured being overwritten by processors. Especially if processors are
guarded by conditions.

* Fix processors order once again

Problem is local fields+tags must be applied after the globaly
configured fields and tests, while client processors must be run before
the global ones.

* review

- use 'disabled' flag
- simplify pipeline fields init

(cherry picked from commit 6082603)
@urso urso removed the needs_backport PR is waiting to be backported to other branches. label Sep 12, 2017
andrewkroh pushed a commit that referenced this pull request Sep 12, 2017
* Reorder processors pipeline order

- reorder processors, such that all client processors run before the
  global processors
- remove support for EventsMetadataKey

* Combine fields and tags if possible

- combine client internal field updates and configured field updates
  into one dictionary
- combine proessors for adding client and global fields+tags if no
  client processors are configured

* Do not copy if no processors are defined

Do not Clone (deep copy) fields being added in the pipeline if no
processors are configured.

As processors might add/remove fields and potentially modify shared
field objects, these must be copied if there is a chance global shared
structured being overwritten by processors. Especially if processors are
guarded by conditions.

* Fix processors order once again

Problem is local fields+tags must be applied after the globaly
configured fields and tests, while client processors must be run before
the global ones.

* review

- use 'disabled' flag
- simplify pipeline fields init

(cherry picked from commit 6082603)
@urso urso deleted the pipeline/processors-order branch February 19, 2019 18:57
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
* Reorder processors pipeline order

- reorder processors, such that all client processors run before the
  global processors
- remove support for EventsMetadataKey

* Combine fields and tags if possible

- combine client internal field updates and configured field updates
  into one dictionary
- combine proessors for adding client and global fields+tags if no
  client processors are configured

* Do not copy if no processors are defined

Do not Clone (deep copy) fields being added in the pipeline if no
processors are configured.

As processors might add/remove fields and potentially modify shared
field objects, these must be copied if there is a chance global shared
structured being overwritten by processors. Especially if processors are
guarded by conditions.

* Fix processors order once again

Problem is local fields+tags must be applied after the globaly
configured fields and tests, while client processors must be run before
the global ones.

* review

- use 'disabled' flag
- simplify pipeline fields init

(cherry picked from commit b66abfe)
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.

4 participants