File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
internal/component/database_observability/postgres/collector Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -426,13 +426,8 @@ func (c *QuerySamples) buildQuerySampleLabels(state *SampleState) string {
426426 }
427427 }
428428
429- queryText := state .LastRow .Query .String
430- if ! c .disableQueryRedaction {
431- queryText = redact (queryText )
432- }
433-
434429 labels := fmt .Sprintf (
435- `datname="%s" pid="%d" leader_pid="%s" user="%s" app="%s" client="%s" backend_type="%s" state="%s" xid="%d" xmin="%d" xact_time="%s" query_time="%s" queryid="%d" query="%s" engine="postgres"` ,
430+ `datname="%s" pid="%d" leader_pid="%s" user="%s" app="%s" client="%s" backend_type="%s" state="%s" xid="%d" xmin="%d" xact_time="%s" query_time="%s" queryid="%d" engine="postgres"` ,
436431 state .LastRow .DatabaseName .String ,
437432 state .LastRow .PID ,
438433 leaderPID ,
@@ -446,11 +441,14 @@ func (c *QuerySamples) buildQuerySampleLabels(state *SampleState) string {
446441 xactDuration ,
447442 queryDuration ,
448443 state .LastRow .QueryID .Int64 ,
449- queryText ,
450444 )
451445 if state .LastCpuTime != "" {
452446 labels = fmt .Sprintf (`%s cpu_time="%s"` , labels , state .LastCpuTime )
453447 }
448+ if c .disableQueryRedaction {
449+ queryText := state .LastRow .Query .String
450+ labels = fmt .Sprintf (`%s query_text="%s"` , labels , queryText ) // no need to redact
451+ }
454452 return labels
455453}
456454
You can’t perform that action at this time.
0 commit comments