Handle zone names without uuids.#10568
Draft
jmcarp wants to merge 1 commit into
Draft
Conversation
The zone:cpu_nsec metric parses zone names into zone types and uuids, for zone names formatted as oxz_TYPE_UUID. However, zone names like "global" and "oxz_switch" don't follow that format, leaving the zone type as empty. This patch adds zone types for those zone names, parsing "global" to "global" and "oxz_switch" to "switch".
sunshowers
reviewed
Jun 8, 2026
Comment on lines
+50
to
+54
| } else if let Some(rest) = zone_name.strip_prefix(ZONE_PREFIX) { | ||
| ZoneMetadata { zone_type: rest.to_string(), zone_id: Uuid::nil() } | ||
| } else { | ||
| ZoneMetadata { zone_type: zone_name.into(), zone_id: Uuid::nil() } | ||
| } |
Contributor
There was a problem hiding this comment.
Two notes:
- We should use
OmicronZoneUuidfor a strongly-typed UUID, if possible. - I think we should use an
Optionhere, and if a zone ID isn't present we should mark it asNone.
Thoughts?
Collaborator
There was a problem hiding this comment.
Oximeter field types aren't optional today, so we have to pick a real value, unfortunately.
Contributor
There was a problem hiding this comment.
Ah I see. In that case I guess nil is okay (though we'll probably want to document this limitation here)
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.
The zone:cpu_nsec metric parses zone names into zone types and uuids, for zone names formatted as oxz_TYPE_UUID. However, zone names like "global" and "oxz_switch" don't follow that format, leaving the zone type as empty. This patch adds zone types for those zone names, parsing "global" to "global" and "oxz_switch" to "switch".