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

remove unnecessary metadata propagation #3007

Merged
merged 13 commits into from
Dec 29, 2017
Merged

Conversation

rade
Copy link
Member

@rade rade commented Dec 28, 2017

It turns out that nothing is actually looking at the metadata fields we were propagating in the Map/join functions. Instead, all the metadata being rendered comes from nodes we are joining with. Furthermore, summarisation does a reasonable job of rendering nodes knowing just their ID and topology.

This change makes the Map/join functions much more regular. With the exception of PropagateSingleMetric (which really shouldn't be a Map - see #3008), all these functions now produce nodes with just an id & topology, and no metadata. This allows us to simply joinResults.add*. It also brings some performance benefits - a few % saved allocations in the rendering benchmarks. And it's a step on the way to unifying Map and join.

@rade rade requested a review from bboreham December 28, 2017 11:31
rade added 10 commits December 28, 2017 12:50
We were setting the very same k/v that we just looked up.
instead of the equivalent long-hand code.
The 'create' function passed to addChild is only ever invoked when we
cannot find a matching process in the process topology. In these cases
the host and pid will be _all_ the info we are ever going to have,
both of which are incorporated in the id. Node summarisation renders
that as best it can; adding the PID as metadata does not make a
difference but for a line with that info in the detail panel, which
adds nothing since the PID is already included in the label.
The name is already the id of the node, and that's what summarisation
renders. Nothing looks at process.Name.
The HostNodeID is already the id of host nodes (as the name suggests),
and that's what summarisation renders. Nothing looks at the HostNodeID
metadata of host nodes.
The container hostname is already the id of the node, and that's what
summarisation renders. Nothing looks at the docker.ContainerHostname
metadata of nodes in the ContainerHostname group topology.
This was building a set of all the image ids represented by the same
unversioned image. Well, it was doing that until I broke it with a
silly mistake in #1739 - instead of extracting the imageID from the
original node ID, it's extracting it from the updated ID, which is the
unversioned image. Even if it was working though, it's pointless
since nothing is looking at that info.
The ImageID is already the id of the node we are creation, and that's
what summarisation renders in the event we fail to join this node with
a node from the ContainerImage topology that has more metadata.
Nothing is looking at the ImageID metadata field.
...when creating Uncontained pseudo nodes. Summarisation of
Uncontained/Umanaged only looks at the ID, which includes the
HostNodeID.

We adjust the promotion of Uncontained to Unmanaged, to operate on the
ID instead of (re)extracting the hostID from the HostNodeID
metadata. With that, nothing looks at the HostNodeID metadata of
Uncontained/Unmanaged nodes.
...when creating Uncontained pseudo nodes. IsConnectedMark only
affects summarisation of genuine process nodes.
@rade rade force-pushed the less-derived-node-metadata branch 3 times, most recently from aa5be8d to 5159ba1 Compare December 28, 2017 16:31
@bboreham
Copy link
Collaborator

I think the last commit message could be improved.

It turns out that our usage of joinResults.add* only ever ends
creating minimal nodes, from just an id and topology

I would phrase it more like "after dropping extra metadata in the rest of this PR, our usage of ..."

if found && id != "" { // not one we blanked out earlier
// We are guaranteed to find the id, so no need to pass a node constructor.
ret.addChild(m, id, nil)
if found && id != "" { // not one we blanked out earlier We

This comment was marked as abuse.

This comment was marked as abuse.

// an per-host "Uncontained" node. If for whatever reason this
// node doesn't have a host id in their node metadata, it'll all
// get grouped into a single uncontained node.
// an per-host "Uncontained" node.

This comment was marked as abuse.

This comment was marked as abuse.

rade added 3 commits December 29, 2017 14:40
Some process nodes may not have a HostNodeID metadata, e.g. when an
endpoint references a pid that we know nothing about. When mapping
processes to containers, we therefore shouldn't rely on
HostNodeID. Instead we can obtain the hostID from the process node ID.

This has been broken for a while, possibly forever.
After dropping extra metadata in the rest of this PR, our usage of
joinResults.add* only ever ends creating minimal nodes, from just an
id and topology. Hence joinResults.add* can be invoked with simply an
id and topology instead of a generic node creation function.
@rade
Copy link
Member Author

rade commented Dec 29, 2017

I would phrase it more like "after dropping extra metadata in the rest of this PR, our usage of ..."

Fixed.

@rade rade force-pushed the less-derived-node-metadata branch from 5159ba1 to c8ea7ba Compare December 29, 2017 14:41
@rade rade merged commit 915535e into master Dec 29, 2017
@rade rade deleted the less-derived-node-metadata branch February 13, 2018 18:00
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.

2 participants