Reduce metrics mechanism to just support fastdp
This commit is contained in:
1 parent
0458d32089
commit
4d8a40c0b5
2 files changed
+5
-20
No files matched your search
@@ -91,10 +91,10 @@ var metrics []metric = []metric{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fastDPMetrics(s WeaveStatus) *weave.FastDPMetrics {
|
func fastDPMetrics(s WeaveStatus) *weave.FastDPMetrics {
|
||||||
if reporter, ok := s.Router.OverlayDiagnostics.(weave.MetricsReporter); ok {
|
if diagMap, ok := s.Router.OverlayDiagnostics.(map[string]interface{}); ok {
|
||||||
if metrics := reporter.Metrics(); metrics != nil {
|
if diag, ok := diagMap["fastdp"]; ok {
|
||||||
if fastdpMetrics, ok := metrics.(*weave.FastDPMetrics); ok {
|
if fastDPStats, ok := diag.(weave.FastDPStatus); ok {
|
||||||
return fastdpMetrics
|
return fastDPStats.Metrics().(*weave.FastDPMetrics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,29 +42,14 @@ func (osw *OverlaySwitch) AddFeaturesTo(features map[string]string) {
|
|||||||
features["Overlays"] = strings.Join(osw.overlayNames, " ")
|
features["Overlays"] = strings.Join(osw.overlayNames, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
type OverlaySwitchDiagnostics map[string]interface{}
|
|
||||||
|
|
||||||
func (osw *OverlaySwitch) Diagnostics() interface{} {
|
func (osw *OverlaySwitch) Diagnostics() interface{} {
|
||||||
diagnostics := make(OverlaySwitchDiagnostics)
|
diagnostics := make(map[string]interface{})
|
||||||
for name, overlay := range osw.overlays {
|
for name, overlay := range osw.overlays {
|
||||||
diagnostics[name] = overlay.Diagnostics()
|
diagnostics[name] = overlay.Diagnostics()
|
||||||
}
|
}
|
||||||
return diagnostics
|
return diagnostics
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetricsReporter interface {
|
|
||||||
Metrics() interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d OverlaySwitchDiagnostics) Metrics() interface{} {
|
|
||||||
for _, entry := range d {
|
|
||||||
if fastDPEntry, ok := entry.(MetricsReporter); ok {
|
|
||||||
return fastDPEntry.Metrics()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (osw *OverlaySwitch) InvalidateRoutes() {
|
func (osw *OverlaySwitch) InvalidateRoutes() {
|
||||||
for _, overlay := range osw.overlays {
|
for _, overlay := range osw.overlays {
|
||||||
overlay.InvalidateRoutes()
|
overlay.InvalidateRoutes()
|
||||||
|
|||||||
Reference in new issue
Block a user