From 632a6f4c3be9a18e51aa3f35168d17a9d25c508e Mon Sep 17 00:00:00 2001 From: Ash-exp Date: Fri, 16 May 2025 15:09:19 +0530 Subject: [PATCH] fix: Remove funtionName from labels from pg_query_duration_seconds_* metrics --- go.mod | 4 ++-- go.sum | 8 ++++---- .../devtron-labs/common-lib/utils/SqlUtil.go | 12 ++++++------ vendor/modules.txt | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 9cf9b8da74..4120944e76 100644 --- a/go.mod +++ b/go.mod @@ -307,8 +307,8 @@ require ( replace ( github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13 - github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250508071415-beab8643ef22 - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 + github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516092913-a8cc2e4a33e5 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092913-a8cc2e4a33e5 github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127 github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5 k8s.io/api => k8s.io/api v0.29.7 diff --git a/go.sum b/go.sum index c7bc2a46c2..e4f982ed3f 100644 --- a/go.sum +++ b/go.sum @@ -829,10 +829,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU= github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250508071415-beab8643ef22 h1:Eli2aNwOnwvA5MgCxYtO4kqJ0f6DeK3NJ2GQiFJJ9BQ= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250508071415-beab8643ef22/go.mod h1:FfaLDXN1ZXxyRpnskBqVIYkpkWDCzBmDgIO9xqLnxdQ= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 h1:zGAASPlhYqEetPLnnhm58+QAJXdzoAcMojQVr+8dFTo= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516092913-a8cc2e4a33e5 h1:RzH1TwejuyKys9pLooVRy+nDkI1vaBV+GTJK9zIhIEg= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516092913-a8cc2e4a33e5/go.mod h1:FfaLDXN1ZXxyRpnskBqVIYkpkWDCzBmDgIO9xqLnxdQ= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092913-a8cc2e4a33e5 h1:8/TvnOcams0ewKNBZcywwA/Ccr8ZIhFWBrK3k6di5Lo= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092913-a8cc2e4a33e5/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0= github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU= github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y= github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs= diff --git a/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go b/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go index 3bdec67be5..bc5dbeba10 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go @@ -85,31 +85,31 @@ func ExecutePGQueryProcessor(cfg bean.PgQueryMonitoringConfig, event bean.PgQuer } else { status = SUCCESS } - PgQueryDuration.WithLabelValues(status, cfg.ServiceName, event.FuncName, getErrorType(pgError).String()).Observe(queryDuration.Seconds()) + PgQueryDuration.WithLabelValues(status, cfg.ServiceName, getErrorType(pgError).String()).Observe(queryDuration.Seconds()) } // Log pg query if enabled logThresholdQueries := cfg.LogSlowQuery && queryDuration.Milliseconds() > cfg.QueryDurationThreshold logNetworkFailure := queryError && cfg.LogAllFailureQueries && isNetworkError(pgError) if logNetworkFailure { - log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError) + log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError) } logFailureQuery := queryError && cfg.LogAllFailureQueries && !isNetworkError(pgError) if logFailureQuery { - log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError) + log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError) } if logThresholdQueries { - log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query) + log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query) } if cfg.LogAllQuery { - log.Println("query time", "duration", queryDuration.Seconds(), "query", event.Query) + log.Println("query time", "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query) } } var PgQueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "pg_query_duration_seconds", Help: "Duration of PG queries", -}, []string{"status", "serviceName", "functionName", "errorType"}) +}, []string{"status", "serviceName", "errorType"}) func getErrorType(err error) ErrorType { if err == nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index dd7edae493..904cd2444b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -472,7 +472,7 @@ github.com/davecgh/go-spew/spew # github.com/deckarep/golang-set v1.8.0 ## explicit; go 1.17 github.com/deckarep/golang-set -# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250508071415-beab8643ef22 +# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516092913-a8cc2e4a33e5 ## explicit; go 1.21 github.com/devtron-labs/authenticator/apiToken github.com/devtron-labs/authenticator/client @@ -480,7 +480,7 @@ github.com/devtron-labs/authenticator/jwt github.com/devtron-labs/authenticator/middleware github.com/devtron-labs/authenticator/oidc github.com/devtron-labs/authenticator/password -# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 +# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092913-a8cc2e4a33e5 ## explicit; go 1.21 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/blob-storage @@ -2352,8 +2352,8 @@ xorm.io/xorm/log xorm.io/xorm/names xorm.io/xorm/schemas xorm.io/xorm/tags -# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250508071415-beab8643ef22 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 +# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250516092913-a8cc2e4a33e5 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092913-a8cc2e4a33e5 # github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127 # github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5 # k8s.io/api => k8s.io/api v0.29.7