Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Initial Time support to Prometheus dashboard #2099

Merged
merged 2 commits into from
Jun 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 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