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

[oximeter] Add some units from physical reality #6296

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions oximeter/impl/src/schema/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,12 @@ impl quote::ToTokens for Units {
Units::Nanoseconds => {
quote! { ::oximeter::schema::Units::Nanoseconds }
}
Units::Amps => quote! { ::oximeter::schema::Units::Amps },
Units::Volts => quote! { ::oximeter::schema::Units::Volts },
Units::DegreesCelcius => {
quote! { ::oximeter::schema::Units::DegreesCelcius }
}
Units::Rpm => quote! { ::oximeter::schema::Units::Rpm },
};
toks.to_tokens(tokens);
}
Expand Down
6 changes: 5 additions & 1 deletion oximeter/impl/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ pub struct TimeseriesDescription {
/// Measurement units for timeseries samples.
#[derive(Clone, Copy, Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
// TODO-completeness: Include more units, such as power / temperature.
// TODO-completeness: Decide whether and how to handle dimensional analysis
// during queries, if needed.
pub enum Units {
Expand All @@ -189,6 +188,11 @@ pub enum Units {
Bytes,
Seconds,
Nanoseconds,
Volts,
Amps,
DegreesCelcius,
/// Rotations per minute.
Rpm,
}

/// The schema for a timeseries.
Expand Down
Loading