8000 Datastore segment unable to end when query parameters enabled (nrpgx5) · Issue #1017 · newrelic/go-agent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Datastore segment unable to end when query parameters enabled (nrpgx5) #1017
@daffinito

Description

@daffinito

Description

When query parameters are enabled, I am seeing the following error on a valid db query when trying to instrument with nrpgx5 integration:

{"level":"error","msg":"unable to end datastore segment","context":{"collection":"mytable","operation":"select","product":"Postgres","reason":"attribute '$0' value of type []string is invalid"}}

Steps to Reproduce

The postgres connection is implemented like this:

		cfg.BeforeConnect = func(_ context.Context, config *pgx.ConnConfig) error {
			config.Tracer = nrpgx5.NewTracer()
			return nil
		}

		conn, err := pgxpool.NewWithConfig(context.Background(), cfg)

and the query is being made like this:

	ctx := newrelic.NewContext(context.Background(), txn)
	rows, err := db.Query(
		ctx,
		"SELECT id FROM mytable WHERE id = ANY ($1)", ids,
	)

ids looks like this for example: []string{"1", "2", "3", "4" }

Expected Behavior

The query is able to be instrumented with query parameters enabled

NR Diag results

N/A

Your Environment

Go version 1.23

Using the latest pgxv5, agent and integration versions:

	github.com/jackc/pgx/v5 v5.7.4

	github.com/newrelic/go-agent/v3 v3.38.0
	github.com/newrelic/go-agent/v3/integrations/nrpgx5 v1.3.0

Reproduction case

Additional context

Workaround: Disable query parameters.

I found that if I disable query parameters, the error goes away:

			config.Tracer = nrpgx5.NewTracer(nrpgx5.WithQueryParameters(false))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0