Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
118 changes: 62 additions & 56 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ gateway-client = { path = "clients/gateway-client" }
# is "fine", because SP/MGS communication maintains forwards and backwards
# compatibility, but will mean that faux-mgs might be missing new
# functionality.)
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "9bbac475dcaac88286c07a20b6bd3e94fc81d7f0", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "9bbac475dcaac88286c07a20b6bd3e94fc81d7f0" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "f9566e68e0a0ccb7c3eeea081ae1cea279c11b2a", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "f9566e68e0a0ccb7c3eeea081ae1cea279c11b2a" }
gateway-test-utils = { path = "gateway-test-utils" }
gateway-types = { path = "gateway-types" }
gethostname = "0.5.0"
Expand Down
9 changes: 9 additions & 0 deletions dev-tools/omdb/src/bin/omdb/mgs/sensors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ pub(crate) struct Sensor {
impl Sensor {
fn units(&self) -> &str {
match self.kind {
MeasurementKind::CpuTctl => {
// Part of me kiiiind of wants to make this "%", as Tctl is
// always in the range of 0-100 --- it's essentially a sort of
// abstract "thermal shutdown Badness Percentage". But, nobody
// else seems to format it as a percentage AFAIK...
""
}
MeasurementKind::Temperature => "°C",
MeasurementKind::Current | MeasurementKind::InputCurrent => "A",
MeasurementKind::Voltage | MeasurementKind::InputVoltage => "V",
Expand Down Expand Up @@ -149,6 +156,7 @@ impl Sensor {

fn to_kind_string(&self) -> &str {
match self.kind {
MeasurementKind::CpuTctl => "cpu-tctl",
MeasurementKind::Temperature => "temp",
MeasurementKind::Power => "power",
MeasurementKind::Current => "current",
Expand All @@ -161,6 +169,7 @@ impl Sensor {

fn from_string(name: &str, kind: &str) -> Option<Self> {
let k = match kind {
"cpu-tctl" => Some(MeasurementKind::CpuTctl),
"temp" | "temperature" => Some(MeasurementKind::Temperature),
"power" => Some(MeasurementKind::Power),
"current" => Some(MeasurementKind::Current),
Expand Down
2 changes: 2 additions & 0 deletions gateway-types/src/component_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ pub enum MeasurementKind {
InputCurrent,
InputVoltage,
Speed,
CpuTctl,
}

impl From<gateway_messages::measurement::MeasurementKind> for MeasurementKind {
Expand All @@ -387,6 +388,7 @@ impl From<gateway_messages::measurement::MeasurementKind> for MeasurementKind {
MeasurementKind::InputCurrent => Self::InputCurrent,
MeasurementKind::InputVoltage => Self::InputVoltage,
MeasurementKind::Speed => Self::Speed,
MeasurementKind::CpuTctl => Self::CpuTctl,
}
}
}
Expand Down
18 changes: 17 additions & 1 deletion gateway/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,13 @@ impl SpPoller {
// We do this first so that we only have to clone the
// sensor's name if there's an error, rather than always
// cloning it in *case* there's an error.
const TCTL_NAME: &str = "amd_cpu_tctl";
if let Err(error) = m.value {
let kind = match m.kind {
MeasurementKind::Temperature if is_tctl => {
"amd_cpu_tctl"
TCTL_NAME
}
MeasurementKind::CpuTctl => TCTL_NAME,
MeasurementKind::Temperature => "temperature",
MeasurementKind::Current => "current",
MeasurementKind::Voltage => "voltage",
Expand Down Expand Up @@ -878,6 +880,17 @@ impl SpPoller {
&metric::Temperature { sensor, datum: 0.0 },
)
}

(Ok(datum), MeasurementKind::CpuTctl) => Sample::new(
target,
&metric::AmdCpuTctl { sensor, datum },
),
(Err(_), MeasurementKind::CpuTctl) => {
Sample::new_missing(
target,
&metric::AmdCpuTctl { sensor, datum: 0.0 },
)
}
(Ok(datum), MeasurementKind::Current) => Sample::new(
target,
&metric::Current { sensor, datum },
Expand Down Expand Up @@ -1204,5 +1217,8 @@ fn comms_error_str(error: CommunicationError) -> &'static str {
CommunicationError::BadTrailingDataSize { .. } => {
"bad_trailing_data_size"
}
CommunicationError::BadDecompressionSize { .. } => {
"bad_decompression_size"
}
}
}
1 change: 1 addition & 0 deletions nexus/tests/integration_tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ async fn test_mgs_metrics(
for sensor in &component.sensors {
use gateway_messages::measurement::MeasurementKind as Kind;
match sensor.def.kind {
Kind::CpuTctl => cpu_tctl += 1,
Kind::Temperature => {
// Currently, Tctl measurements are reported as a
// "temperature" measurement, but are tracked by a
Expand Down
14 changes: 14 additions & 0 deletions openapi/gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,20 @@
"required": [
"kind"
]
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"cpu_tctl"
]
}
},
"required": [
"kind"
]
}
]
},
Expand Down
26 changes: 26 additions & 0 deletions sp-sim/src/gimlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use futures::future;
use gateway_messages::CfpaPage;
use gateway_messages::ComponentAction;
use gateway_messages::ComponentActionResponse;
use gateway_messages::DumpSegment;
use gateway_messages::DumpTask;
use gateway_messages::Header;
use gateway_messages::MgsRequest;
use gateway_messages::MgsResponse;
Expand Down Expand Up @@ -1502,6 +1504,30 @@ impl SpHandler for Handler {
}
}
}

fn get_task_dump_count(&mut self) -> Result<u32, SpError> {
debug!(&self.log, "received get_task_dump_count");
Err(SpError::RequestUnsupportedForSp)
}

fn task_dump_read_start(
&mut self,
index: u32,
_key: [u8; 16],
) -> Result<DumpTask, SpError> {
debug!(&self.log, "received task_dump_read_start"; "index" => index);
Err(SpError::RequestUnsupportedForSp)
}

fn task_dump_read_continue(
&mut self,
_key: [u8; 16],
seq: u32,
_buf: &mut [u8],
) -> Result<Option<DumpSegment>, SpError> {
debug!(&self.log, "received task_dump_read_continue"; "seq" => seq);
Err(SpError::RequestUnsupportedForSp)
}
}

impl SimSpHandler for Handler {
Expand Down
26 changes: 26 additions & 0 deletions sp-sim/src/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ use gateway_messages::ComponentAction;
use gateway_messages::ComponentActionResponse;
use gateway_messages::ComponentDetails;
use gateway_messages::DiscoverResponse;
use gateway_messages::DumpSegment;
use gateway_messages::DumpTask;
use gateway_messages::IgnitionCommand;
use gateway_messages::IgnitionState;
use gateway_messages::MgsError;
Expand Down Expand Up @@ -1202,6 +1204,30 @@ impl SpHandler for Handler {
}
}
}

fn get_task_dump_count(&mut self) -> Result<u32, SpError> {
debug!(&self.log, "received get_task_dump_count");
Err(SpError::RequestUnsupportedForSp)
}

fn task_dump_read_start(
&mut self,
index: u32,
_key: [u8; 16],
) -> Result<DumpTask, SpError> {
debug!(&self.log, "received task_dump_read_start"; "index" => index);
Err(SpError::RequestUnsupportedForSp)
}

fn task_dump_read_continue(
&mut self,
_key: [u8; 16],
seq: u32,
_buf: &mut [u8],
) -> Result<Option<DumpSegment>, SpError> {
debug!(&self.log, "received task_dump_read_continue"; "seq" => seq);
Err(SpError::RequestUnsupportedForSp)
}
}

impl SimSpHandler for Handler {
Expand Down
Loading
Loading