Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why does BatchTracer not have TraceBatchQueryStart/TraceBatchQueryEnd? #1857

Closed
mrkagelui opened this issue Dec 29, 2023 · 1 comment
Closed

Comments

@mrkagelui
Copy link

I'm trying to implement datadog tracing support for pgx (DataDog/dd-trace-go#1537 FYI), and the BatchTracer interface is

// BatchTracer traces SendBatch.
type BatchTracer interface {
	// TraceBatchStart is called at the beginning of SendBatch calls. The returned context is used for the
	// rest of the call and will be passed to TraceBatchQuery and TraceBatchEnd.
	TraceBatchStart(ctx context.Context, conn *Conn, data TraceBatchStartData) context.Context

	TraceBatchQuery(ctx context.Context, conn *Conn, data TraceBatchQueryData)
	TraceBatchEnd(ctx context.Context, conn *Conn, data TraceBatchEndData)
}

I'm just wondering why don't we have the start/end of the individual query, and should we? I'm sorry if this is how batch query works in the protocol, kindly let me know. Without the end, I'm afraid it might be hard to know when the individual query ends.

@jackc
Copy link
Owner

jackc commented Jan 13, 2024

That's how the batch system works with the PostgreSQL protocol. All queries are sent at once. We know when we send them all, and we know when we finish receiving any individual query. TraceBatchQuery lets you trace when a query is finished, but there is no way to know when a query started.

@jackc jackc closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants