mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-22 06:46:50 +00:00
plugins/traffic-control: create Traffic control table
The traffic control plugin will display the status in this table.
This commit is contained in:
@@ -16,6 +16,13 @@ type topology struct {
|
||||
Nodes map[string]node `json:"nodes"`
|
||||
Controls map[string]control `json:"controls"`
|
||||
MetadataTemplates map[string]metadataTemplate `json:"metadata_templates,omitempty"`
|
||||
TableTemplates map[string]tableTemplate `json:"table_templates,omitempty"`
|
||||
}
|
||||
|
||||
type tableTemplate struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Prefix string `json:"prefix"`
|
||||
}
|
||||
|
||||
type metadataTemplate struct {
|
||||
@@ -77,6 +84,7 @@ func (r *Reporter) RawReport() ([]byte, error) {
|
||||
Nodes: r.getContainerNodes(),
|
||||
Controls: getTrafficControls(),
|
||||
MetadataTemplates: getMetadataTemplate(),
|
||||
TableTemplates: getTableTemplate(),
|
||||
},
|
||||
Plugins: []pluginSpec{
|
||||
{
|
||||
@@ -145,6 +153,10 @@ func (r *Reporter) getContainerNodes() map[string]node {
|
||||
Timestamp: timestamp,
|
||||
Value: latency,
|
||||
},
|
||||
"traffic-control-table-latency": {
|
||||
Timestamp: timestamp,
|
||||
Value: latency,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -165,6 +177,16 @@ func getMetadataTemplate() map[string]metadataTemplate {
|
||||
}
|
||||
}
|
||||
|
||||
func getTableTemplate() map[string]tableTemplate {
|
||||
return map[string]tableTemplate{
|
||||
"traffic-control-table": tableTemplate{
|
||||
ID: "traffic-control-table",
|
||||
Label: "Traffic Control",
|
||||
Prefix: "traffic-control-table-",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func getTrafficNodeControls(timestamp time.Time, dead bool) map[string]controlEntry {
|
||||
controls := map[string]controlEntry{}
|
||||
entry := controlEntry{
|
||||
|
||||
Reference in New Issue
Block a user