Skip to content

Commit

Permalink
Merge pull request #21 from last9/l6etenant
Browse files Browse the repository at this point in the history
adding l6etenant label in addition to existing tenant label, this change is required for consistency
  • Loading branch information
mohandutt134 authored Jul 3, 2023
2 parents 0bf9ca1 + ace6ece commit de937df
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions go/httpmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ import (
)

const (
labelDomain = "domain"
labelMethod = "method"
labelStatus = "status"
labelPer = "per"
labelDomain = "domain"
labelMethod = "method"
labelStatus = "status"
labelPer = "per"
labelL6etenant = "l6etenant"
)

var (
// defaultLabels that are provided to the Request metric.
defaultLabels = []string{
labelPer, proc.LabelHostname, labelDomain, labelMethod,
proc.LabelProgram, labelStatus, proc.LabelTenant, proc.LabelCluster,
labelL6etenant,
}

// the ONLY metric that we emit is httpRequestsDuration
Expand Down Expand Up @@ -107,6 +109,7 @@ func CustomREDHandler(g LabelMaker, next http.Handler) http.Handler {
proc.LabelCluster: "", // default cluster is empty
labelDomain: r.Host,
labelMethod: r.Method,
labelL6etenant: "", // default l6etenant is empty
}

ctx := context.WithValue(r.Context(), enableMiddleware, "true")
Expand Down Expand Up @@ -142,6 +145,8 @@ func CustomREDHandler(g LabelMaker, next http.Handler) http.Handler {
}
}

labels[labelL6etenant] = labels[proc.LabelTenant]

httpRequestsDuration.With(labels).Observe(
float64(time.Since(start).Milliseconds()),
)
Expand Down

0 comments on commit de937df

Please sign in to comment.