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

workload/schemachange: export OTLP traces #113959

Closed
wants to merge 5 commits into from

Conversation

chrisseto
Copy link
Contributor

@chrisseto chrisseto commented Nov 7, 2023

This PR is stacked on top of others!

Please consider reviewing those PRs first. This message will be removed once prerequisite PRs are merged and this one is rebased.


c9f6ae1 workload/schemachange: export OTLP traces

Previous commits instrumented the schemachange workload with OTeL but
did not provide a way to access the output spans.

This commit implements a OTLP exporter to a bespoke tar.gz format. See
OTLPFileClient for more details about the format and why it was
chosen.

Epic: none
Release note (cli change): workload schemachange now writes a tar.gz
archive containing OTLP trace bundles for debugging purposes.

@chrisseto chrisseto requested review from a team as code owners November 7, 2023 18:54
@chrisseto chrisseto requested review from srosenberg and DarrylWong and removed request for a team November 7, 2023 18:54
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@chrisseto chrisseto changed the title workload/schemachange: export OTLP traces workload/schemachange: export OTLP traces Nov 7, 2023
Prior to this change, `QueryLoad.Close` would not be called if a
workload worker returned an error. This callback is often used to
perform cleanup or flush log files; actions which are even more
important to perform in the case of an error.

This commit hoists the execution of `Close` into a `defer` to ensure
they're appropriately called in all reasonable exit scenarios. It also
relocates the `schemachange` workload's usage of `PostRun` to
`QueryLoad.Close`.

Epic: CRDB-19168
Release note (cli change): workload commands now appropriately invoke
`.Close` in the case of an error.
The majority of fields on a `pgx.ConnConfig` can be set or influenced
via the connection URL. An unfortunate exception to this case is the
`QueryTracer` field which allows external users to trace or log outgoing
queries.

This commit adds a `QueryTracer` field to `MultiConnPoolCfg` which will
allow workloads to instrument pgx connections with tracing and logging
to aid in debugging failures or understanding other behaviors of a
workload.

Epic: CRDB-19168
Release note: None
`workload/schemachange` solely relies on a bespoke logging solution for
collecting and reporting debug information. While useful, logging alone
is limited in the usefulness of the information it can provide without
becoming overly noisy.

This commit begins the process of bolstering the existing logging
solution by adding OTeL instrument to the workload's entrypoint.

Future commits will add further instrumentation, logging integration,
and a file based exporter.

Epic: CRDB-19168
Release note: None
This commit instruments the `MultiConnPool` used in the schemachange
workload with OTeL by implementing  `pgx.QueryTracer`.

Doing so ensures that all queries executed by the workload are logged to
spans. Future commits will instrument the workers and query helpers. The
combination of all these instrumentations will allow debuggers to easily
inspect all SQL queries emitted by the workload and isolate them to
individual workers and transactions.

Epic: CRDB-19168
Release note: None
Previous commits instrumented the schemachange workload with OTeL but
did not provide a way to access the output spans.

This commit implements a OTLP exporter to a bespoke tar.gz format. See
`OTLPFileClient` for more details about the format and why it was
chosen.

Epic: none
Release note (cli change): workload schemachange now writes a tar.gz
archive containing OTLP trace bundles for debugging purposes.
@chrisseto
Copy link
Contributor Author

Hmm, my mistake I did some branch shuffling and accidentally made two version of this.

This PR is superseded by #114770

@chrisseto chrisseto closed this Nov 21, 2023
@chrisseto chrisseto deleted the rsw-otpl-file branch November 21, 2023 21:11
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

Successfully merging this pull request may close these issues.

None yet

2 participants