Skip to content

Commit

Permalink
Added node class to tagged metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
burdandrei committed Apr 11, 2018
1 parent 2505f09 commit d9bb450
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2153,9 +2153,19 @@ DISCOLOOP:

// emitStats collects host resource usage stats periodically
func (c *Client) emitStats() {
// Determining NodeClass to be emitted
var emittedNodeClass string
if emittedNodeClass = c.Node().NodeClass; emittedNodeClass == "" {
emittedNodeClass = "none"
}

// Assign labels directly before emitting stats so the information expected
// is ready
c.baseLabels = []metrics.Label{{Name: "node_id", Value: c.NodeID()}, {Name: "datacenter", Value: c.Datacenter()}}
c.baseLabels = []metrics.Label{
{Name: "node_id", Value: c.NodeID()},
{Name: "datacenter", Value: c.Datacenter()},
{Name: "node_class", Value: emittedNodeClass},
}

// Start collecting host stats right away and then keep collecting every
// collection interval
Expand Down

0 comments on commit d9bb450

Please sign in to comment.