Skip to content

Commit

Permalink
Added Initial Time support to Prometheus dashboard
Browse files Browse the repository at this point in the history
Incremented initial time for data usage growth chart
  • Loading branch information
Benjamin Perez committed Jun 7, 2022
1 parent fed58ec commit 9728d80
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion restapi/admin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type Target struct {
Interval string
LegendFormat string
Step int32
InitialTime int
}

type ReduceOptions struct {
Expand Down Expand Up @@ -294,6 +295,8 @@ var widgets = []Metric{
{
Expr: `sum(minio_bucket_usage_total_bytes{$__query}) by (instance)`,
LegendFormat: "Used Capacity",
InitialTime: -180,
Step: 900,
},
},
},
Expand Down Expand Up @@ -1046,7 +1049,15 @@ LabelsWaitLoop:
apiType := "query_range"
now := time.Now()

extraParamters := fmt.Sprintf("&start=%d&end=%d", now.Add(-15*time.Minute).Unix(), now.Unix())
initTime := -15

if target.InitialTime != 0 {
initTime = target.InitialTime
}

timeCalculated := time.Duration(initTime * int(time.Minute))

extraParamters := fmt.Sprintf("&start=%d&end=%d", now.Add(timeCalculated).Unix(), now.Unix())

var step int32 = 60
if target.Step > 0 {
Expand Down

0 comments on commit 9728d80

Please sign in to comment.