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

Cherry-pick #14875 to 7.x: Refactor metadata generator to support adding metadata across resources #15528

Merged
merged 1 commit into from
Jan 14, 2020

Conversation

exekias
Copy link
Contributor

@exekias exekias commented Jan 14, 2020

Cherry-pick of PR #14875 to 7.x branch. Original message:

This PR attempts to refactor metadata generator to support enrichment of resources metadata on top of other resources.

Ex: enriching a pod object with information from a node and namespace object.

This PR does the same only for the autodiscover provider of kubernetes. It adds a configuration add_resource_metadata to allow specifying what resources should be used for enrichment.

Sample configuration:

metricbeat.autodiscover:
  providers:
    - type: kubernetes
      kube_config: ${HOME}/.kube/config
      resource: service
      annotations.dedot: false
      add_resource_metadata:
        namespace.enabled: true
      builders:
        - type: hints

output.console.pretty: true

this would ensure that we additionally add namespace metadata along with the service metadata.

pods can be enriched with node and namespace metadata. the namespace and node parameters of add_resource_metadata can take include_*, exlude_* configs similar to the parent resource.

closes #13873

…es (elastic#14875)

* Refactor metagen to allow multiple resources to be enriched

(cherry picked from commit dba8f74)
}

return n.Generate(no, opts...)
} else {

Choose a reason for hiding this comment

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

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

}

return n.Generate(no, opts...)
} else {

Choose a reason for hiding this comment

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

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

}

return n.Generate(no, opts...)
} else {

Choose a reason for hiding this comment

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

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

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