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

Kubernetes state_* metricsets are ignoring namespace #6281 #6294

Merged
merged 13 commits into from
Feb 6, 2018

Conversation

fassisrosa
Copy link
Contributor

@fassisrosa fassisrosa commented Feb 6, 2018

As discussed here: #6236
Requested by @exekias

Fixes #6281

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for taking this! 😄 good job with tests refactoring

@exekias
Copy link
Contributor

exekias commented Feb 6, 2018

Can you please add a changelog entry?

jenkins, test it please

@exekias
Copy link
Contributor

exekias commented Feb 6, 2018

jenkins, retest it please

@fassisrosa
Copy link
Contributor Author

Added changelog entry... someday I'll remember to add it upfront!!! ;) ;) ;)
Thanks!

@exekias exekias merged commit f3de72e into elastic:master Feb 6, 2018
@@ -21,11 +21,14 @@ func eventMapping(families []*dto.MetricFamily) ([]common.MapStr, error) {
if deployment == "" {
continue
}
event, ok := eventsMap[deployment]
namespace := util.GetLabel(metric, "namespace")
deploymentKey := namespace + "::" + deployment
Copy link
Contributor

Choose a reason for hiding this comment

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

@exekias Does this mean we have :: in the field key?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, this is a key in the eventMap, we use it to correlate all different metrics into a single event, then we ship events, forgetting about the keys in the map

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, thanks.

if err == nil {
namespace, err := event.GetValue("_module.namespace")
if err == nil {
eventKey := namespace.(string) + "@" + name.(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

And I assume this one means an @ in the field key? Not that ES would disallow this, but I wonder if it could cause issues on the query side or KB?

Copy link
Contributor

Choose a reason for hiding this comment

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

This @ works in the same way, it's used to fetch the correct test case from here: https://github.com/elastic/beats/pull/6294/files/b514a509da8360ab225e85eb73df79468057cbd7#diff-2b3ff3319749ebeecd269e64715d1969R80

The @ is not in the final event

exekias pushed a commit to exekias/beats that referenced this pull request Mar 15, 2018
Most of this was fixed by elastic#6294,
but for the specific case of containers, their uniqueness is defined by
namespace + pod name. As several pods may have containers with the same
name.

Rest of metrics are not affected in the same way, and namespace should
be enough for them.
ruflin pushed a commit that referenced this pull request Mar 16, 2018
…ame (#6566)

Most of this was fixed by #6294,
but for the specific case of containers, their uniqueness is defined by
namespace + pod name. As several pods may have containers with the same
name.

Rest of metrics are not affected in the same way, and namespace should
be enough for them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants