-
Notifications
You must be signed in to change notification settings - Fork 39
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
[omdb] Add disks, historical VMMs to omdb db instance show
#6935
Conversation
Currently, `omdb` formats `chrono::DateTime`s using the default `fmt::Display` format. This uses a bunch of characters of line width, which becomes important for `omdb` commands which output tabular data with a large number of columns --- avoiding line wrapping wherever possible makes it substantially easier to read such output. @iximeow pointed out to me that we could save several characters of line width by using a more concise timestamp format. This commit changes tabular output in `omdb db` commands to format timestamps using `chrono`'s RFC 3339 formatter with millisecond precision, rather than nanosecond precision. This saves us a few characters. RFC 3339 permits the use of `Z` rather than `+00:00` (the UTC offset) for UTC timestamps, and since all our timestamps are UTC, that saves us another four characters (also relative to the default format, which uses ` UTC ` for UTC timestamps). Together, this makes timestamp columns substantially shorter in `omdb db` output. For example, consider `omdb db region-replacement list`: ```console root@oxz_switch1:~# omdb db region-replacement list note: database URL not specified. Will search DNS. note: (override with --db-url or OMDB_DB_URL) note: using DNS server for subnet fd00:1122:3344::/48 note: (if this is not right, use --dns-server to specify an alternate DNS server) note: using database URL postgresql://root@[fd00:1122:3344:109::3]:32221,[fd00:1122:3344:105::3]:32221,[fd00:1122:3344:10b::3]:32221,[fd00:1122:3344:107::3]:32221,[fd00:1122:3344:108::3]:32221/omicron?sslmode=disable WARN: found schema version 110.0.0, expected 111.0.0 It's possible the database is running a version that's different from what this tool understands. This may result in errors or incorrect output. Region replacement requests ID REQUEST_TIME REPLACEMENT_STATE 07a289e6-af50-42f1-8888-062229547888 2024-08-14 19:43:13.318246 UTC Complete 08c449a6-25c1-46f8-b070-9223cb924cb0 2024-08-14 19:43:13.245003 UTC Complete 1ed5e8e1-1d98-4420-bef0-135cba510238 2024-08-14 19:43:13.227734 UTC Complete 20811f9d-f6ed-40fe-8403-305edc4b3e8c 2024-08-14 19:43:13.291419 UTC Complete 52bd1034-2a77-4a17-8871-77e535b509d5 2024-08-14 19:43:13.259033 UTC Complete 5c43d936-d5c4-4d4e-b1ca-890aabeeae87 2024-08-14 19:43:13.357786 UTC Complete 915f8726-a882-4960-9e5c-dfe359f54911 2024-08-14 19:43:13.279 UTC Complete a4e697b6-5f02-4f75-ad41-f5bc3e906f0b 2024-08-14 19:43:13.344742 UTC Complete c2b5ef9d-a89a-46c8-b57e-1eebb5487804 2024-08-14 19:43:13.331527 UTC Complete f0e009b5-1575-42f0-bca5-7df6db846ef0 2024-08-14 19:43:13.304655 UTC Complete root@oxz_switch1:~# /var/tmp/omdb-eliza-test-concise db region-replacement list note: database URL not specified. Will search DNS. note: (override with --db-url or OMDB_DB_URL) note: using DNS server for subnet fd00:1122:3344::/48 note: (if this is not right, use --dns-server to specify an alternate DNS server) note: using database URL postgresql://root@[fd00:1122:3344:109::3]:32221,[fd00:1122:3344:105::3]:32221,[fd00:1122:3344:10b::3]:32221,[fd00:1122:3344:107::3]:32221,[fd00:1122:3344:108::3]:32221/omicron?sslmode=disable WARN: found schema version 110.0.0, expected 111.0.0 It's possible the database is running a version that's different from what this tool understands. This may result in errors or incorrect output. Region replacement requests ID REQUEST_TIME REPLACEMENT_STATE 07a289e6-af50-42f1-8888-062229547888 2024-08-14T19:43:13.318Z Complete 08c449a6-25c1-46f8-b070-9223cb924cb0 2024-08-14T19:43:13.245Z Complete 1ed5e8e1-1d98-4420-bef0-135cba510238 2024-08-14T19:43:13.227Z Complete 20811f9d-f6ed-40fe-8403-305edc4b3e8c 2024-08-14T19:43:13.291Z Complete 52bd1034-2a77-4a17-8871-77e535b509d5 2024-08-14T19:43:13.259Z Complete 5c43d936-d5c4-4d4e-b1ca-890aabeeae87 2024-08-14T19:43:13.357Z Complete 915f8726-a882-4960-9e5c-dfe359f54911 2024-08-14T19:43:13.279Z Complete a4e697b6-5f02-4f75-ad41-f5bc3e906f0b 2024-08-14T19:43:13.344Z Complete c2b5ef9d-a89a-46c8-b57e-1eebb5487804 2024-08-14T19:43:13.331Z Complete f0e009b5-1575-42f0-bca5-7df6db846ef0 2024-08-14T19:43:13.304Z Complete root@oxz_switch1:~# ``` Although the output from the `region-replacement list` command is not *that* wide, I'm presently working on an instance VMM history command that displays three timestamps, and the width saving becomes quite significant there.
7441133
to
54f85cb
Compare
This is super helpful, I am very commonly querying the vmm table in crdb when trying to understand an instance's behavior |
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.
This looks great--thanks for putting it together!
Yeah, the changes look fine here. For the instance output:
Woudl we ever expect the |
@leftwo I also wondered about this, and considered removing it. I thought maybe it was useful for debugging — if you see a disk that has an instance ID set but isn't I don't really know what the disk's state machine in the control plane looks like, but can look? |
Inspired in part by what would have been nice to have while @augustuswm
and I were debugging failed instances on the colo rack a few days ago,
this branch adds additional data to the
omdb db instance show
command.Now, we fetch and display a list of all disks attached to the instance:
Output with attached disks:
Additionally, the command now accepts an optional
--history
flag, which willprint a list of all VMMs that have ever been associated with the instance. This
is useful for debugging instances which have migrated and/or been restarted ---
it's often useful to figure out what has happened to VMMs that previously
incarnated an instance, and determine their IDs and sled to find zone bundles
etc. The list of past migrations is now enabled or disabled by the
--history
flag, as well.
Output with VMM history:
Depends on #6933
Closes #6929
Also addresses some of #6931, but not the networking part.