-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from weaveworks/probe-reorg
Probe re-org
- Loading branch information
Showing
17 changed files
with
194 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package host | ||
|
||
import ( | ||
"github.com/weaveworks/scope/report" | ||
) | ||
|
||
// Tagger tags each node in each topology of a report with the origin host | ||
// node ID of this (probe) host. Effectively, a foreign key linking every node | ||
// in every topology to an origin host node in the host topology. | ||
type Tagger struct{ hostNodeID string } | ||
|
||
// NewTagger tags each node with a foreign key linking it to its origin host | ||
// in the host topology. | ||
func NewTagger(hostID string) Tagger { | ||
return Tagger{hostNodeID: report.MakeHostNodeID(hostID)} | ||
} | ||
|
||
// Tag implements Tagger. | ||
func (t Tagger) Tag(r report.Report) (report.Report, error) { | ||
md := report.NodeMetadata{report.HostNodeID: t.hostNodeID} | ||
for _, topology := range r.Topologies() { | ||
for nodeID := range topology.NodeMetadatas { | ||
topology.NodeMetadatas[nodeID].Merge(md) | ||
} | ||
} | ||
return r, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.