Add SwarmService topology containing data on Docker Swarm services

This commit is contained in:
Mike Lang
2017-04-12 12:07:39 -07:00
parent 460352d2d7
commit 6bf34ab95d
2 changed files with 18 additions and 0 deletions

View File

@@ -130,6 +130,12 @@ var (
// ParseECSTaskNodeID parses a replica set node ID
ParseECSTaskNodeID = parseSingleComponentID("ecs_task")
// MakeSwarmServiceNodeID produces a replica set node ID from its composite parts.
MakeSwarmServiceNodeID = makeSingleComponentID("swarm_service")
// ParseSwarmServiceNodeID parses a replica set node ID
ParseSwarmServiceNodeID = parseSingleComponentID("swarm_service")
)
// makeSingleComponentID makes a single-component node id encoder

View File

@@ -24,6 +24,7 @@ const (
Overlay = "overlay"
ECSService = "ecs_service"
ECSTask = "ecs_task"
SwarmService = "swarm_service"
// Shapes used for different nodes
Circle = "circle"
@@ -92,6 +93,11 @@ type Report struct {
// Metadata is limited for now, more to come later. Edges are not present.
ECSService Topology
// Swarm Service nodes are Docker Swarm services, which represent a specification for a
// group of tasks (either one per host, or a desired count).
// Edges are not present.
SwarmService Topology
// Overlay nodes are active peers in any software-defined network that's
// overlaid on the infrastructure. The information is scraped by polling
// their status endpoints. Edges could be present, but aren't currently.
@@ -170,6 +176,10 @@ func MakeReport() Report {
WithShape(Heptagon).
WithLabel("service", "services"),
SwarmService: MakeTopology().
WithShape(Heptagon).
WithLabel("service", "services"),
Sampling: Sampling{},
Window: 0,
Plugins: xfer.MakePluginSpecs(),
@@ -192,6 +202,7 @@ func (r *Report) TopologyMap() map[string]*Topology {
Overlay: &r.Overlay,
ECSTask: &r.ECSTask,
ECSService: &r.ECSService,
SwarmService: &r.SwarmService,
}
}
@@ -253,6 +264,7 @@ func (r *Report) WalkPairedTopologies(o *Report, f func(*Topology, *Topology)) {
f(&r.Overlay, &o.Overlay)
f(&r.ECSTask, &o.ECSTask)
f(&r.ECSService, &o.ECSService)
f(&r.SwarmService, &o.SwarmService)
}
// Topology gets a topology by name