mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
console: use avg/max for LimitType (instead of Avg/Max)
This commit is contained in:
@@ -70,7 +70,7 @@ type VisualizeOptionsConfiguration struct {
|
||||
// Limit is the default limit to use
|
||||
Limit int `json:"limit" validate:"min=5"`
|
||||
// LimitType is the default limitType to use
|
||||
LimitType string `json:"limitType" validate:"oneof=Avg Max"`
|
||||
LimitType string `json:"limitType" validate:"oneof=avg max"`
|
||||
// Bidirectional tells if a graph should be bidirectional (all except sankey)
|
||||
Bidirectional bool `json:"bidirectional"`
|
||||
// PreviousPeriod tells if a graph should display the previous period (for stacked)
|
||||
@@ -87,7 +87,7 @@ func DefaultConfiguration() Configuration {
|
||||
Filter: "InIfBoundary = external",
|
||||
Dimensions: []query.Column{query.NewColumn("SrcAS")},
|
||||
Limit: 10,
|
||||
LimitType: "Avg",
|
||||
LimitType: "avg",
|
||||
},
|
||||
HomepageTopWidgets: []HomepageTopWidget{
|
||||
HomepageTopWidgetSrcAS,
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestConfigHandler(t *testing.T) {
|
||||
"filter": "InIfBoundary = external",
|
||||
"dimensions": []string{"SrcAS"},
|
||||
"limit": 10,
|
||||
"limitType": "Avg",
|
||||
"limitType": "avg",
|
||||
"bidirectional": false,
|
||||
"previousPeriod": false,
|
||||
},
|
||||
|
||||
@@ -151,9 +151,12 @@ aspect of the graph.
|
||||
"limit" parameter tells how many. The remaining values are
|
||||
categorized as "Other".
|
||||
|
||||
- Associated with the `limit` parameter, the `limitType` parameter help find traffic surges according to 2 modes:
|
||||
- Avg: default mode, the query focuses on getting the highest cumulative traffics over the time selection.
|
||||
- Max: the query focuses on getting the traffic bursts over the time selection.
|
||||
- Associated with the `limit` parameter, the `limitType` parameter help find
|
||||
traffic surges according to 2 modes:
|
||||
- `avg`: default mode, the query focuses on getting the highest cumulative
|
||||
traffics over the time selection.
|
||||
- `max`: the query focuses on getting the traffic bursts over the time
|
||||
selection.
|
||||
|
||||
- The filter box contains an SQL-like expression to limit the data to be
|
||||
graphed. It features an auto-completion system that can be triggered manually
|
||||
|
||||
@@ -201,7 +201,7 @@ watch(
|
||||
if (value) {
|
||||
limit.value = value.limit.toString();
|
||||
limitType.value =
|
||||
computationModeList.find((mode) => mode.name === value.limitType) ||
|
||||
computationModeList.find((mode) => mode.type === value.limitType) ||
|
||||
computationModeList[0];
|
||||
truncate4.value = value.truncate4.toString();
|
||||
truncate6.value = value.truncate6.toString();
|
||||
@@ -226,7 +226,7 @@ watch(
|
||||
const updated = {
|
||||
selected: selected.map((d) => d.name),
|
||||
limit: parseInt(limit),
|
||||
limitType: limitType.name,
|
||||
limitType: limitType.type,
|
||||
truncate4: parseInt(truncate4),
|
||||
truncate6: parseInt(truncate6),
|
||||
errors: hasErrors,
|
||||
|
||||
@@ -20,7 +20,7 @@ type graphCommonHandlerInput struct {
|
||||
End time.Time `json:"end" binding:"required,gtfield=Start"`
|
||||
Dimensions []query.Column `json:"dimensions"` // group by ...
|
||||
Limit int `json:"limit" binding:"min=1"` // limit product of dimensions
|
||||
LimitType string `json:"limitType" validate:"oneof=Avg Max"`
|
||||
LimitType string `json:"limitType" validate:"oneof=avg max"`
|
||||
Filter query.Filter `json:"filter"` // where ...
|
||||
TruncateAddrV4 int `json:"truncate-v4" binding:"min=0,max=32"` // 0 or 32 = no truncation
|
||||
TruncateAddrV6 int `json:"truncate-v6" binding:"min=0,max=128"` // 0 or 128 = no truncation
|
||||
|
||||
@@ -340,7 +340,7 @@ func (c *Component) graphLineHandlerFunc(gc *gin.Context) {
|
||||
if rows[axis][jKey][0] == "Other" {
|
||||
return true
|
||||
}
|
||||
if input.LimitType == "Max" {
|
||||
if input.LimitType == "max" {
|
||||
return maxes[axis][iKey] > maxes[axis][jKey]
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ ORDER BY time WITH FILL
|
||||
Start: time.Date(2022, 4, 10, 15, 45, 10, 0, time.UTC),
|
||||
End: time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
Limit: 20,
|
||||
LimitType: "Max",
|
||||
LimitType: "max",
|
||||
Dimensions: []query.Column{
|
||||
query.NewColumn("ExporterName"),
|
||||
query.NewColumn("InIfProvider"),
|
||||
@@ -768,7 +768,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Avg",
|
||||
"limitType": "avg",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
@@ -844,7 +844,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Avg",
|
||||
"limitType": "avg",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
@@ -964,7 +964,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Avg",
|
||||
"limitType": "avg",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
@@ -1158,7 +1158,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Max",
|
||||
"limitType": "max",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
@@ -1234,7 +1234,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Max",
|
||||
"limitType": "max",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
@@ -1354,7 +1354,7 @@ func TestGraphLineHandler(t *testing.T) {
|
||||
"end": time.Date(2022, 4, 11, 15, 45, 10, 0, time.UTC),
|
||||
"points": 100,
|
||||
"limit": 20,
|
||||
"limitType": "Max",
|
||||
"limitType": "max",
|
||||
"dimensions": []string{"ExporterName", "InIfProvider"},
|
||||
"filter": "DstCountry = 'FR' AND SrcCountry = 'US'",
|
||||
"units": "l3bps",
|
||||
|
||||
@@ -46,7 +46,7 @@ func selectRowsByLimitType(input graphCommonHandlerInput, dimensions []string, w
|
||||
var rowsType string
|
||||
var source string
|
||||
var orderBy string
|
||||
if input.LimitType == "Max" {
|
||||
if input.LimitType == "max" {
|
||||
source = fmt.Sprintf("( SELECT %s AS sum_at_time FROM source WHERE %s GROUP BY %s )",
|
||||
strings.Join(append(dimensions, "{{ .Units }}"), ", "),
|
||||
where,
|
||||
|
||||
@@ -66,7 +66,7 @@ ORDER BY xps DESC
|
||||
query.NewColumn("ExporterName"),
|
||||
},
|
||||
Limit: 5,
|
||||
LimitType: "Max",
|
||||
LimitType: "max",
|
||||
Filter: query.Filter{},
|
||||
Units: "l3bps",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user