Skip to content

Commit

Permalink
don't add method or status label if already present, case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmeredith committed Jan 8, 2023
1 parent ec2ca4a commit e282a4b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ object PrometheusBackend {
*/
def addLabelPairs(config: BaseCollectorConfig, req: Request[_, _], maybeResp: Option[Response[_]]): config.T = {
val methodLabel: Option[(String, String)] = {
if (config.labels.map(_._1).contains("method")) {
if (config.labels.map(_._1.toLowerCase).contains("method")) {
None
} else {
Some {
Expand All @@ -89,7 +89,7 @@ object PrometheusBackend {
}

val statusLabel: Option[(String, String)] = {
if (config.labels.map(_._1).contains("status")) {
if (config.labels.map(_._1.toLowerCase).contains("status")) {
None
} else {
maybeResp.map { r => ("status", mapStatusToLabelValue(r.code)) }
Expand Down

0 comments on commit e282a4b

Please sign in to comment.