Commit 503e0dc4 authored by Miek Gieben's avatar Miek Gieben

more fixes

Signed-off-by: default avatarMiek Gieben <miek@miek.nl>
parent 3f1fd6d0
...@@ -135,7 +135,8 @@ we continue with step 4 above, ignoring any locality. ...@@ -135,7 +135,8 @@ we continue with step 4 above, ignoring any locality.
If monitoring is enabled (via the *prometheus* plugin) then the following metric are exported: If monitoring is enabled (via the *prometheus* plugin) then the following metric are exported:
* `coredns_traffic_clusters_tracked{}` the number of tracked clusters. * `coredns_traffic_cluster_tracked{}` the number of tracked clusters.
* `coredns_traffic_endpoint_tracked{}` the number of tracked clusters.
## Ready ## Ready
......
...@@ -189,14 +189,15 @@ func (c *Client) receive(stream adsStream) error { ...@@ -189,14 +189,15 @@ func (c *Client) receive(stream adsStream) error {
} }
a.SetClusterLoadAssignment(cluster.GetName(), nil) a.SetClusterLoadAssignment(cluster.GetName(), nil)
} }
log.Debugf("Cluster discovery processed with %d resources, version %q and nonce %q", len(resp.GetResources()), c.Version(cdsURL), c.Nonce(cdsURL))
ClusterGauge.Set(float64(len(resp.GetResources())))
// set our local administration and ack the reply. Empty version would signal NACK. // set our local administration and ack the reply. Empty version would signal NACK.
c.SetNonce(cdsURL, resp.GetNonce()) c.SetNonce(cdsURL, resp.GetNonce())
c.SetVersion(cdsURL, resp.GetVersionInfo()) c.SetVersion(cdsURL, resp.GetVersionInfo())
c.SetAssignments(a) c.SetAssignments(a)
c.clusterDiscovery(stream, resp.GetVersionInfo(), resp.GetNonce(), a.clusters()) c.clusterDiscovery(stream, resp.GetVersionInfo(), resp.GetNonce(), a.clusters())
log.Debugf("Cluster discovery processed with %d resources, version %q and nonce %q", len(resp.GetResources()), c.Version(cdsURL), c.Nonce(cdsURL))
ClusterGauge.Set(float64(len(resp.GetResources())))
// now kick off discovery for endpoints // now kick off discovery for endpoints
if err := c.endpointDiscovery(stream, c.Version(edsURL), c.Nonce(edsURL), a.clusters()); err != nil { if err := c.endpointDiscovery(stream, c.Version(edsURL), c.Nonce(edsURL), a.clusters()); err != nil {
log.Debug(err) log.Debug(err)
...@@ -214,11 +215,13 @@ func (c *Client) receive(stream adsStream) error { ...@@ -214,11 +215,13 @@ func (c *Client) receive(stream adsStream) error {
} }
c.assignments.SetClusterLoadAssignment(cla.GetClusterName(), cla) c.assignments.SetClusterLoadAssignment(cla.GetClusterName(), cla)
} }
log.Debugf("Endpoint discovery processed with %d resources, version %q and nonce %q", len(resp.GetResources()), c.Version(edsURL), c.Nonce(edsURL))
// set our local administration and ack the reply. Empty version would signal NACK. // set our local administration and ack the reply. Empty version would signal NACK.
c.SetNonce(edsURL, resp.GetNonce()) c.SetNonce(edsURL, resp.GetNonce())
c.SetVersion(edsURL, resp.GetVersionInfo()) c.SetVersion(edsURL, resp.GetVersionInfo())
log.Debugf("Endpoint discovery processed with %d resources, version %q and nonce %q", len(resp.GetResources()), c.Version(edsURL), c.Nonce(edsURL))
EndpointGauge.Set(float64(len(resp.GetResources())))
default: default:
return fmt.Errorf("unknown response URL for discovery: %q", resp.GetTypeUrl()) return fmt.Errorf("unknown response URL for discovery: %q", resp.GetTypeUrl())
} }
......
...@@ -14,4 +14,10 @@ var ( ...@@ -14,4 +14,10 @@ var (
Name: "clusters_tracked", Name: "clusters_tracked",
Help: "Gauge of tracked clusters.", Help: "Gauge of tracked clusters.",
}) })
EndpointGauge = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: "traffic",
Name: "endpoints_tracked",
Help: "Gauge of all tracked endpoints.",
})
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment