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
sql: add trace_id to show sessions #118002
Conversation
65a3167
to
303b2e6
Compare
cfbf52f
to
8bbd85e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 7 of 10 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @xinhaoz)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit and a question, not blocking.
Reviewed 7 of 10 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @maryliag and @xinhaoz)
pkg/server/serverpb/status.proto
line 1057 at r1 (raw file):
uint32 pg_backend_pid = 19 [ (gogoproto.customname) = "PGBackendPID" ]; // The ID the session's trace.
nit: ID of the session's trace
pkg/sql/conn_executor.go
line 4163 at r2 (raw file):
TotalActiveTime: sessionActiveTime, PGBackendPID: ex.planner.extendedEvalCtx.QueryCancelKey.GetPGBackendPID(), TraceID: uint64(ex.planner.extendedEvalCtx.Tracing.connSpan.TraceID()),
weird that we have to plumb so far to get the trace. there's no context that we could extract the trace from? that's how most of the other code works.
or does the caller already have a handle on a span that could be passed in?
Add the column trace_id to the result of `SHOW SESSIONS`. Also adding the column to the views: `crdb_internal.node_sessions` and `crdb_internal.cluster_sessions`. Part Of cockroachdb#117625 Release note (sql change): Add column `trace_id` to the response of the `SHOW SESSIONS` command.
8bbd85e
to
43072c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @dhartunian, @fqazi, and @xinhaoz)
pkg/server/serverpb/status.proto
line 1057 at r1 (raw file):
Previously, dhartunian (David Hartunian) wrote…
nit: ID of the session's trace
Done
pkg/sql/conn_executor.go
line 4163 at r2 (raw file):
Previously, dhartunian (David Hartunian) wrote…
weird that we have to plumb so far to get the trace. there's no context that we could extract the trace from? that's how most of the other code works.
or does the caller already have a handle on a span that could be passed in?
In this case we need to go this far. You can notice something similar happens on the line right above for the pg backend PID. The function I'm calling already handles the case when the tracing is on/off, is the span was closed, etc. It might be complicated to use something else and having to handle all of that again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @maryliag and @xinhaoz)
pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant
line 266 at r3 (raw file):
id node_id session_id start txn_string application_name num_stmts num_retries num_auto_retries last_auto_retry_reason isolation_level priority quality_of_service query ITTTTTTTTTTTTTTTI colnames
Why does this new column have an I
here? The pg_backend_pid
is also an int, right? but here it's a T
which I think implies Text.
bors r+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @dhartunian and @xinhaoz)
pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant
line 266 at r3 (raw file):
Previously, dhartunian (David Hartunian) wrote…
Why does this new column have an
I
here? Thepg_backend_pid
is also an int, right? but here it's aT
which I think implies Text.
I added an I since is an INT, the same way there is an I for the node_id, maybe the T on others were an oversight or the format itself didn't matter.
I have a following PR where I'm adding one more column, so I can use that and align all columns with the correct types.
Build succeeded: |
Add the column trace_id to the result of
SHOW SESSIONS
.Also adding the column to the views:
crdb_internal.node_sessions
andcrdb_internal.cluster_sessions
.Part Of #117625
Release note (sql change): Add column
trace_id
to the response of theSHOW SESSIONS
command.