osdtrace: add Ceph Version column to --list output#126
Merged
Conversation
Show each discovered ceph-osd's package version in `osdtrace --list`.
The version is resolved per OSD:
- Traceable ("yes"): taken from the matched embedded DWARF entry via
is_embedded_traceable()'s matched_version_out. Authoritative and
container-safe (build-id is read through /proc/<pid>/root).
- Not traceable, native, binary not replaced on disk: best-effort host
package query (get_package_version), gated by check_executable_deleted()
so an upgraded-on-disk binary never reports a version we aren't running.
- Containerized non-traceable, upgraded-on-disk, or unreadable build-id:
"unknown" (the host package DB does not describe these binaries).
Also drop the Executable Path column from the --list view (it is always
/usr/bin/ceph-osd and adds no signal); the tracing-flow listing keeps it.
A footnote documents the Ceph Version semantics.
37cb1e2 to
f417875
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates osdtrace --list output to surface a per-OSD “Ceph Version” column (preferring the matched embedded DWARF version when traceable, otherwise falling back to a safe host package query) and removes the “Executable Path” column from that traceability-focused view.
Changes:
- Add
OsdProcessInfo::versionand populate it duringannotate_traceability()using embedded-match version or a guarded host package lookup. - Update
--listtable formatting to display “Ceph Version” instead of “Executable Path” whenshow_traceable=true. - Add explanatory footnote text describing the version-resolution semantics.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1014
to
+1015
| std::string pkg = get_package_version(proc.exe_path); | ||
| if (!pkg.empty() && pkg != "unknown") proc.version = pkg; |
Comment on lines
1294
to
1311
| if (any_no || any_unknown) { | ||
| std::cout << std::endl | ||
| << "Traceable: 'yes' means this osdtrace already has matching DWARF data built in." << std::endl; | ||
| if (any_no) { | ||
| std::cout << " 'no': no embedded DWARF matches this binary's build-id. Export a DWARF JSON" << std::endl; | ||
| std::cout << " on a host that has the matching ceph-osd (osdtrace -j <file>), then trace" << std::endl; | ||
| std::cout << " with: osdtrace -p <pid> -i <file> --skip-version-check" << std::endl; | ||
| } | ||
| if (any_unknown) { | ||
| std::cout << " 'unknown': could not read the OSD binary's build-id; re-run as root" << std::endl; | ||
| std::cout << " (required for containerized OSDs)." << std::endl; | ||
| } | ||
| std::cout << std::endl | ||
| << "Ceph Version: authoritative when Traceable='yes' (the matched embedded entry)." << std::endl; | ||
| std::cout << " For Traceable='no' it is a best-effort host package lookup, shown only" << std::endl; | ||
| std::cout << " for native OSDs whose on-disk binary still matches the running process;" << std::endl; | ||
| std::cout << " 'unknown' for containerized OSDs or binaries upgraded since launch." << std::endl; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Ceph Version column to
osdtrace --listso each discoveredceph-osdshows its package version, and removes the now-redundant Executable Path column from that view.How the version is resolved (per OSD)
yesis_embedded_traceable→matched_version_out) — authoritative, container-safenoget_package_version()nounknowncheck_executable_deleted()catches the on-disk≠running casenounknownunknownunknownThe version is authoritative and free for traceable OSDs (including containerized ones, since the build-id is read through
/proc/<pid>/root). For non-traceable OSDs it falls back to a host package query, but only when it can be trusted — native binary, not replaced on disk since launch.The Executable Path column is dropped from
--list(it is always/usr/bin/ceph-osdand carries no signal). The separate tracing-flow listing (print_discovered_osdswithout traceability) keeps it.A footnote under the table documents these semantics.
Example
Scope
src/osdtrace.cc. Reuses existing helpers (is_embedded_traceable,get_package_version,check_executable_deleted) — no new dependencies, no change to the tracing path orradostrace.Testing
make osdtrace— clean build;make clang-tidy— clean onosdtrace.cc.sudo ./osdtrace --liston a host with 11 containerized OSDs across multiple Ceph releases — versions resolved correctly and columns align.functional-test-embedded-dwarf.sh) only asserts on--list-embedded, which is untouched.🤖 Generated with Claude Code