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

Question: how to restore trace for row? #65

Open
AlohaJava opened this issue Oct 4, 2024 · 1 comment
Open

Question: how to restore trace for row? #65

AlohaJava opened this issue Oct 4, 2024 · 1 comment

Comments

@AlohaJava
Copy link

AlohaJava commented Oct 4, 2024

I've been working with pg_tracing in PostgreSQL and can successfully set the trace context using:

SET LOCAL pg_tracing.trace_context = 'traceparent=''00-00000000000000000000000000000005-0000000000000005-01''';.

However, I am struggling to understand how to retrieve the current active trace context for logging or restoration purposes. Is there a way to query or fetch the active trace_context once it's been set, or a recommended approach to restore the trace context in subsequent operations?

@bonnefoa
Copy link
Collaborator

I am struggling to understand how to retrieve the current active trace context for logging or restoration purposes

That would require to be able to log an arbitrary GUC value which is not something that's supported by PG.

Is there a way to query or fetch the active trace_context once it's been set

You can use SHOW pg_tracing.trace_context to display the value set in the current session.

a recommended approach to restore the trace context in subsequent operations?

I'm not 100% sure what you mean by that. I'm mostly relying on SQLCommenter to propagate tracecontext while setting it through the GUC value is here as a possible fallback. Does it mean you have some kind of nested span, which will query PG and you want to go back to the previous trace context to go back to the parent span?

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