Skip to content

Commit 57bedf3

Browse files
authored
Merge pull request #268 from devtron-labs/fix-pg-metrix-labels
fix: Remove funtionName from labels from pg_query_duration_seconds_* metrics
2 parents 813ff96 + a8cc2e4 commit 57bedf3

29 files changed

Lines changed: 83 additions & 83 deletions

File tree

chart-sync/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.4
55
toolchain go1.22.6
66

77
replace (
8-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
8+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2
99
helm.sh/helm/v3 v3.14.3 => github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42
1010
)
1111

chart-sync/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr
5454
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5555
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5656
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 h1:zGAASPlhYqEetPLnnhm58+QAJXdzoAcMojQVr+8dFTo=
58-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0=
57+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2 h1:9CFeiv7oWP6f5OJN6Jq1FJpPndxyx0GKAEoKORWxvkw=
58+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0=
5959
github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42 h1:pJmK44QaSztOiZe0iQHNf0sdy5KwkAeceydyhOG4RaY=
6060
github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42/go.mod h1:v6myVbyseSBJTzhmeE39UcPLNv6cQK6qss3dvgAySaE=
6161
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=

chart-sync/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chart-sync/vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ github.com/containerd/platforms
9393
# github.com/davecgh/go-spew v1.1.1
9494
## explicit
9595
github.com/davecgh/go-spew/spew
96-
# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
96+
# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2
9797
## explicit; go 1.21
9898
github.com/devtron-labs/common-lib/constants
9999
github.com/devtron-labs/common-lib/fetchAllEnv
@@ -791,4 +791,4 @@ sigs.k8s.io/structured-merge-diff/v4/value
791791
# sigs.k8s.io/yaml v1.3.0
792792
## explicit; go 1.12
793793
sigs.k8s.io/yaml
794-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
794+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2

ci-runner/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
toolchain go1.21.8
66

7-
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
7+
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2
88

99
require (
1010
github.com/Knetic/govaluate v3.0.0+incompatible

ci-runner/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
9595
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9696
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
9797
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
98-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22 h1:zGAASPlhYqEetPLnnhm58+QAJXdzoAcMojQVr+8dFTo=
99-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0=
98+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2 h1:9CFeiv7oWP6f5OJN6Jq1FJpPndxyx0GKAEoKORWxvkw=
99+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2/go.mod h1:zkNShlkcHxsmnL0gKNbs0uyRL8lZonGKr5Km63uTLI0=
100100
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
101101
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
102102
github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY=

ci-runner/vendor/github.com/devtron-labs/common-lib/utils/SqlUtil.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci-runner/vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ github.com/cespare/xxhash/v2
248248
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
249249
## explicit
250250
github.com/davecgh/go-spew/spew
251-
# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
251+
# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2
252252
## explicit; go 1.21
253253
github.com/devtron-labs/common-lib/blob-storage
254254
github.com/devtron-labs/common-lib/constants
@@ -991,4 +991,4 @@ sigs.k8s.io/structured-merge-diff/v4/value
991991
# sigs.k8s.io/yaml v1.3.0
992992
## explicit; go 1.12
993993
sigs.k8s.io/yaml
994-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
994+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2

common-lib/utils/SqlUtil.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,31 @@ func ExecutePGQueryProcessor(cfg bean.PgQueryMonitoringConfig, event bean.PgQuer
8585
} else {
8686
status = SUCCESS
8787
}
88-
PgQueryDuration.WithLabelValues(status, cfg.ServiceName, event.FuncName, getErrorType(pgError).String()).Observe(queryDuration.Seconds())
88+
PgQueryDuration.WithLabelValues(status, cfg.ServiceName, getErrorType(pgError).String()).Observe(queryDuration.Seconds())
8989
}
9090

9191
// Log pg query if enabled
9292
logThresholdQueries := cfg.LogSlowQuery && queryDuration.Milliseconds() > cfg.QueryDurationThreshold
9393
logNetworkFailure := queryError && cfg.LogAllFailureQueries && isNetworkError(pgError)
9494
if logNetworkFailure {
95-
log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError)
95+
log.Println(fmt.Sprintf("%s - query time", PgNetworkErrorLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError)
9696
}
9797
logFailureQuery := queryError && cfg.LogAllFailureQueries && !isNetworkError(pgError)
9898
if logFailureQuery {
99-
log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query, "pgError", pgError)
99+
log.Println(fmt.Sprintf("%s - query time", PgQueryFailLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query, "pgError", pgError)
100100
}
101101
if logThresholdQueries {
102-
log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "query", event.Query)
102+
log.Println(fmt.Sprintf("%s - query time", PgQuerySlowLogPrefix), "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query)
103103
}
104104
if cfg.LogAllQuery {
105-
log.Println("query time", "duration", queryDuration.Seconds(), "query", event.Query)
105+
log.Println("query time", "duration", queryDuration.Seconds(), "functionName", event.FuncName, "query", event.Query)
106106
}
107107
}
108108

109109
var PgQueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
110110
Name: "pg_query_duration_seconds",
111111
Help: "Duration of PG queries",
112-
}, []string{"status", "serviceName", "functionName", "errorType"})
112+
}, []string{"status", "serviceName", "errorType"})
113113

114114
func getErrorType(err error) ErrorType {
115115
if err == nil {

git-sensor/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
toolchain go1.22.4
66

7-
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250508071415-beab8643ef22
7+
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250516092629-1f57945dd6f2
88

99
require (
1010
github.com/caarlos0/env v3.5.0+incompatible

0 commit comments

Comments
 (0)