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

Update SMF properties for Dendrite to include sled identifiers #6793

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 0 additions & 30 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,36 +389,6 @@ impl From<omicron_common::api::internal::shared::NetworkInterfaceKind>
}
}

impl From<omicron_common::api::internal::shared::SledIdentifiers>
for types::SledIdentifiers
{
fn from(
value: omicron_common::api::internal::shared::SledIdentifiers,
) -> Self {
Self {
model: value.model,
rack_id: value.rack_id,
revision: value.revision,
serial: value.serial,
sled_id: value.sled_id,
}
}
}

impl From<types::SledIdentifiers>
for omicron_common::api::internal::shared::SledIdentifiers
{
fn from(value: types::SledIdentifiers) -> Self {
Self {
model: value.model,
rack_id: value.rack_id,
revision: value.revision,
serial: value.serial,
sled_id: value.sled_id,
}
}
}

/// Exposes additional [`Client`] interfaces for use by the test suite. These
/// are bonus endpoints, not generated in the real client.
#[async_trait]
Expand Down
25 changes: 25 additions & 0 deletions oximeter/db/schema/replicated/13/timeseries-to-delete.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
switch_data_link:bytes_sent
switch_data_link:bytes_received
switch_data_link:errors_sent
switch_data_link:errors_received
switch_data_link:receive_crc_error_drops
switch_data_link:receive_buffer_full_drops
switch_data_link:packets_sent
switch_data_link:packets_received
switch_data_link:link_up
switch_data_link:link_enabled
switch_data_link:link_fsm
switch_data_link:pcs_bad_sync_headers
switch_data_link:pcs_errored_blocks
switch_data_link:pcs_block_lock_loss
switch_data_link:pcs_high_ber
switch_data_link:pcs_valid_errors
switch_data_link:pcs_invalid_errors
switch_data_link:pcs_unknown_errors
switch_data_link::pcs_sync_loss
switch_data_link:fec_high_symbol_errors
switch_data_link:fec_sync_aligned
switch_data_link:fec_corrected_blocks
switch_data_link:fec_uncorrected_blocks
switch_data_link:fec_symbol_errors
dendrite:sample_collection_duration
25 changes: 25 additions & 0 deletions oximeter/db/schema/single-node/13/timeseries-to-delete.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
switch_data_link:bytes_sent
switch_data_link:bytes_received
switch_data_link:errors_sent
switch_data_link:errors_received
switch_data_link:receive_crc_error_drops
switch_data_link:receive_buffer_full_drops
switch_data_link:packets_sent
switch_data_link:packets_received
switch_data_link:link_up
switch_data_link:link_enabled
switch_data_link:link_fsm
switch_data_link:pcs_bad_sync_headers
switch_data_link:pcs_errored_blocks
switch_data_link:pcs_block_lock_loss
switch_data_link:pcs_high_ber
switch_data_link:pcs_valid_errors
switch_data_link:pcs_invalid_errors
switch_data_link:pcs_unknown_errors
switch_data_link::pcs_sync_loss
switch_data_link:fec_high_symbol_errors
switch_data_link:fec_sync_aligned
switch_data_link:fec_corrected_blocks
switch_data_link:fec_uncorrected_blocks
switch_data_link:fec_symbol_errors
dendrite:sample_collection_duration
2 changes: 1 addition & 1 deletion oximeter/db/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use uuid::Uuid;
/// - [`crate::Client::initialize_db_with_version`]
/// - [`crate::Client::ensure_schema`]
/// - The `clickhouse-schema-updater` binary in this crate
pub const OXIMETER_VERSION: u64 = 12;
pub const OXIMETER_VERSION: u64 = 13;

// Wrapper type to represent a boolean in the database.
//
Expand Down
26 changes: 25 additions & 1 deletion oximeter/oximeter/schema/dendrite.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ versions = [
# switch for its statistics, which is why these fields are included.
# Dendrite may eventually report statistics about itself, or other aspects
# not related to the switch, so they belong here, not the target.
{ added_in = 1, fields = [ "switch_model", "switch_revision", "switch_id", "switch_serial" ] }
{ added_in = 1, fields = [ "switch_id", "switch_fab", "switch_lot", "switch_wafer", "switch_wafer_loc_x", "switch_wafer_loc_y", "switch_model", "switch_revision", "switch_serial", "switch_slot" ] }
zeeshanlakhani marked this conversation as resolved.
Show resolved Hide resolved
]

[fields.rack_id]
Expand Down Expand Up @@ -53,6 +53,30 @@ description = "Revision number of the switch being managed"
type = "uuid"
description = "ID of the switch being managed"

[fields.switch_fab]
type = "string"
description = "Fabrication plant identifier of the switch the link is on"

[fields.switch_lot]
type = "string"
description = "Lot number of the switch the link is on"

[fields.switch_wafer]
type = "u8"
description = "Wafer number of the switch the link is on"

[fields.switch_wafer_loc_x]
type = "i8"
description = "X-coordinate wafer location of the switch the link is on"

[fields.switch_wafer_loc_y]
type = "i8"
description = "Y-coordinate wafer location of the switch the link is on"

[fields.switch_serial]
type = "string"
description = "Serial number of the switch being managed"

[fields.switch_slot]
type = "u16"
description = "Slot number of the switch the link is on"
27 changes: 26 additions & 1 deletion oximeter/oximeter/schema/switch-data-link.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ format_version = 1
name = "switch_data_link"
description = "A network data link on an Oxide switch"
authz_scope = "fleet"

versions = [
{ version = 1, fields = [ "rack_id", "sled_id", "sled_model", "sled_revision", "sled_serial", "switch_id", "switch_model", "switch_revision", "switch_serial" ] },
{ version = 1, fields = [ "rack_id", "sled_id", "sled_model", "sled_revision", "sled_serial", "switch_id", "switch_fab", "switch_lot", "switch_wafer", "switch_wafer_loc_x", "switch_wafer_loc_y", "switch_model", "switch_revision", "switch_serial", "switch_slot" ] },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated out x,y fields here for wafer location (vs storing a tuple).

]

[[metrics]]
Expand Down Expand Up @@ -251,6 +252,26 @@ description = "Serial number of the sled managing the link's switch"
type = "uuid"
description = "ID of the switch the link is on"

[fields.switch_fab]
type = "string"
description = "Fabrication plant identifier of the switch the link is on"

[fields.switch_lot]
type = "string"
description = "Lot number of the switch the link is on"

[fields.switch_wafer]
type = "u8"
description = "Wafer number of the switch the link is on"

[fields.switch_wafer_loc_x]
type = "i8"
description = "X-coordinate wafer location of the switch the link is on"

[fields.switch_wafer_loc_y]
type = "i8"
description = "Y-coordinate wafer location of the switch the link is on"

[fields.switch_model]
type = "string"
description = "The model number switch the link is on"
Expand All @@ -263,6 +284,10 @@ description = "Revision number of the switch the link is on"
type = "string"
description = "Serial number of the switch the link is on"

[fields.switch_slot]
type = "u16"
description = "Slot number of the switch the link is on"

[fields.port_id]
type = "string"
description = "Physical switch port the link is on"
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "c1506f6f818327523e6ff3102432a2038d319338b883235664b34f9132ff676a"
source.commit = "b425a6c783b3081613ffa00407f271cae06568c4"
source.sha256 = "5acb29662fa052fc7805716cf761c39bf0cef168c1e33d9fdb259104503203e5"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -744,8 +744,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "061d40085e733e60d7c53ebfd2a4cf64f54a856e7eb5fd4b82ac65ec6a5b847b"
source.commit = "b425a6c783b3081613ffa00407f271cae06568c4"
source.sha256 = "2c1f901ac96028264fd904fb197d1aaef522432ad16097d3606321101813dfde"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -764,8 +764,8 @@ only_for_targets.image = "standard"
# the other `source.*` keys.
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "f3810e7bc1f0d746b5e95b3aaff32e52b02dfdfa"
source.sha256 = "c6cb4c077f0ddfc78ab06e07316d1312657f95526ced60c2b8e7baf1c73ae24a"
source.commit = "b425a6c783b3081613ffa00407f271cae06568c4"
source.sha256 = "94d1231d5b4ba5ea3cd7ce90ea0c46d43c87bfdd3e694cc99a78f8578ba1b9f7"
output.type = "zone"
output.intermediate_only = true

Expand Down
87 changes: 74 additions & 13 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ use omicron_common::address::{AZ_PREFIX, OXIMETER_PORT};
use omicron_common::address::{BOOTSTRAP_ARTIFACT_PORT, COCKROACH_ADMIN_PORT};
use omicron_common::api::external::Generation;
use omicron_common::api::internal::shared::{
HostPortConfig, RackNetworkConfig,
HostPortConfig, RackNetworkConfig, SledIdentifiers,
};
use omicron_common::backoff::{
retry_notify, retry_policy_internal_service_aggressive, BackoffError,
Expand Down Expand Up @@ -379,15 +379,18 @@ fn display_zone_init_errors(errors: &[(String, Box<Error>)]) -> String {
/// Configuration parameters which modify the [`ServiceManager`]'s behavior.
pub struct Config {
/// Identifies the sled being configured
pub sled_id: Uuid,
pub sled_identifiers: SledIdentifiers,

/// Identifies the revision of the sidecar to be used.
pub sidecar_revision: SidecarRevision,
}

impl Config {
pub fn new(sled_id: Uuid, sidecar_revision: SidecarRevision) -> Self {
Self { sled_id, sidecar_revision }
pub fn new(
sled_identifiers: SledIdentifiers,
sidecar_revision: SidecarRevision,
) -> Self {
Self { sled_identifiers, sidecar_revision }
}
}

Expand Down Expand Up @@ -973,6 +976,7 @@ impl ServiceManager {
.get()
.expect("sled agent not started")
.config
.sled_identifiers
.sled_id
}

Expand Down Expand Up @@ -2685,15 +2689,42 @@ impl ServiceManager {

if let Some(i) = info {
dendrite_config = dendrite_config
.add_property(
"rack_id",
"astring",
&i.rack_id.to_string(),
)
.add_property(
"sled_id",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_id",
"sled_model",
"astring",
&i.rack_id.to_string(),
&i.config
.sled_identifiers
.model
.to_string(),
)
.add_property(
"sled_serial",
"astring",
&i.config
.sled_identifiers
.serial
.to_string(),
)
.add_property(
"sled_revision",
"astring",
&i.config
.sled_identifiers
.revision
.to_string(),
);
}

Expand Down Expand Up @@ -2985,7 +3016,10 @@ impl ServiceManager {
.add_property(
"sled_uuid",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_uuid",
Expand Down Expand Up @@ -3031,7 +3065,10 @@ impl ServiceManager {
.add_property(
"sled_uuid",
"astring",
&i.config.sled_id.to_string(),
&i.config
.sled_identifiers
.sled_id
.to_string(),
)
.add_property(
"rack_uuid",
Expand Down Expand Up @@ -4366,7 +4403,25 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_id",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
smfh.setprop_default_instance(
"config/sled_model",
info.config
.sled_identifiers
.model
.to_string(),
)?;
smfh.setprop_default_instance(
"config/sled_revision",
info.config.sled_identifiers.revision,
)?;
smfh.setprop_default_instance(
"config/sled_serial",
info.config
.sled_identifiers
.serial
.to_string(),
)?;
} else {
info!(
Expand Down Expand Up @@ -4475,7 +4530,7 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_uuid",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
}
for address in &request.addresses {
Expand Down Expand Up @@ -4518,7 +4573,7 @@ impl ServiceManager {
)?;
smfh.setprop_default_instance(
"config/sled_uuid",
info.config.sled_id,
info.config.sled_identifiers.sled_id,
)?;
}
smfh.delpropvalue_default_instance(
Expand Down Expand Up @@ -4961,7 +5016,13 @@ mod illumos_tests {

fn make_config(&self) -> Config {
Config {
sled_id: Uuid::new_v4(),
sled_identifiers: SledIdentifiers {
rack_id: Uuid::new_v4(),
sled_id: Uuid::new_v4(),
model: "fake-gimlet".to_string(),
revision: 1,
serial: "fake-serial".to_string(),
},
sidecar_revision: SidecarRevision::Physical(
"rev_whatever_its_a_test".to_string(),
),
Expand Down
Loading
Loading