Skip to content

Commit

Permalink
Added Initial Time support to Prometheus dashboard (#2099)
Browse files Browse the repository at this point in the history
Incremented initial time for data usage growth chart
  • Loading branch information
bexsoft committed Jun 9, 2022
1 parent e3d96b5 commit 5a8e029
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion restapi/admin_info.go
Expand Up @@ -127,6 +127,7 @@ type Target struct {
Interval string
LegendFormat string
Step int32
InitialTime int64
}

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: 10,
},
},
},
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())
var initTime int64 = -15

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

timeCalculated := time.Duration(initTime * int64(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 5a8e029

Please sign in to comment.