add duration parameter

Signed-off-by: Roland.Ma <rolandma@kubesphere.io>
This commit is contained in:
Roland.Ma
2021-09-15 06:54:05 +00:00
parent 1ee5e49ac0
commit 4b4c6e0f79
4 changed files with 14 additions and 13 deletions

View File

@@ -472,8 +472,8 @@ func makeIngressMetricExpr(tmpl string, o monitoring.QueryOptions) string {
duration := "5m"
// parse Range Vector Selectors metric{key=value}[duration]
if o.MeterOptions != nil {
duration = o.MeterOptions.Step.String()
if o.Duration != nil {
duration = o.Duration.String()
}
// For monitoring ingress in the specific namespace

View File

@@ -84,6 +84,7 @@ type QueryOptions struct {
ServiceName string
Ingress string
Job string
Duration *time.Duration
MeterOptions *Meteroptions
}
@@ -296,7 +297,7 @@ type IngressOption struct {
Ingress string
Job string
Pod string
Step *time.Duration
Duration *time.Duration
}
func (no IngressOption) Apply(o *QueryOptions) {
@@ -306,11 +307,7 @@ func (no IngressOption) Apply(o *QueryOptions) {
o.Ingress = no.Ingress
o.Job = no.Job
o.PodName = no.Pod
if no.Step != nil {
o.MeterOptions = &Meteroptions{
Step: *no.Step,
}
}
o.Duration = no.Duration
}
type ComponentOption struct{}