Skip to content

Commit 077f2ff

Browse files
feat(msd): emit node_type label from NodeRewardType (#2084)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 6169918 commit 077f2ff

13 files changed

Lines changed: 43 additions & 2 deletions

File tree

Cargo.Bazel.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "3804c4135bfcca159dcec52800164457cf5abdc7fe23b1f095fd7d87ffc8fbd0",
2+
"checksum": "42caebc349211274d22d6696d3a2a68202e3bbea3d48e4a26953c87dce7a3231",
33
"crates": {
44
"actix-codec 0.5.2": {
55
"name": "actix-codec",
@@ -38335,6 +38335,10 @@
3833538335
"id": "erased-serde 0.4.10",
3833638336
"target": "erased_serde"
3833738337
},
38338+
{
38339+
"id": "ic-protobuf 0.9.0",
38340+
"target": "ic_protobuf"
38341+
},
3833838342
{
3833938343
"id": "ic-registry-subnet-type 0.9.0",
3834038344
"target": "ic_registry_subnet_type"

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rs/ic-observability/config-writer-common/src/filters.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ mod tests {
6666
targets,
6767
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
6868
subnet_type: None,
69+
node_reward_type: None,
6970
dc_id: "test".to_string(),
7071
operator_id: PrincipalId::new_anonymous(),
7172
node_provider_id: PrincipalId::new_anonymous(),
@@ -84,6 +85,7 @@ mod tests {
8485
targets: BTreeSet::new(),
8586
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
8687
subnet_type: None,
88+
node_reward_type: None,
8789
dc_id: "test".to_string(),
8890
operator_id: PrincipalId::new_anonymous(),
8991
node_provider_id: PrincipalId::new_anonymous(),
@@ -98,6 +100,7 @@ mod tests {
98100
targets: BTreeSet::new(),
99101
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
100102
subnet_type: None,
103+
node_reward_type: None,
101104
dc_id: "test".to_string(),
102105
operator_id: PrincipalId::new_anonymous(),
103106
node_provider_id: PrincipalId::new_anonymous(),
@@ -118,6 +121,7 @@ mod tests {
118121
targets: BTreeSet::new(),
119122
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
120123
subnet_type: None,
124+
node_reward_type: None,
121125
dc_id: "test".to_string(),
122126
operator_id: PrincipalId::new_anonymous(),
123127
node_provider_id: PrincipalId::new_anonymous(),
@@ -132,6 +136,7 @@ mod tests {
132136
targets: BTreeSet::new(),
133137
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
134138
subnet_type: None,
139+
node_reward_type: None,
135140
dc_id: "test".to_string(),
136141
operator_id: PrincipalId::new_anonymous(),
137142
node_provider_id: PrincipalId::new_anonymous(),

rs/ic-observability/multiservice-discovery-shared/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ service-discovery = { path = "../service-discovery" }
1111
serde = { workspace = true }
1212
serde_json = { workspace = true }
1313
ic-registry-subnet-type = { workspace = true }
14+
ic-protobuf = { workspace = true }
1415
ic-types = { workspace = true }
1516
erased-serde = { workspace = true }
1617
regex = { workspace = true }

rs/ic-observability/multiservice-discovery-shared/src/builders/log_vector_config_structure.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ mod tests {
224224
ic_name: "ic".to_string(),
225225
subnet_id: None,
226226
subnet_type: None,
227+
node_reward_type: None,
227228
node_provider_id: PrincipalId::new_anonymous(),
228229
dc_id: "dc1".to_string(),
229230
targets: targets.clone(),
@@ -239,6 +240,7 @@ mod tests {
239240
ic_name: "ic".to_string(),
240241
subnet_id: None,
241242
subnet_type: None,
243+
node_reward_type: None,
242244
node_provider_id: PrincipalId::new_anonymous(),
243245
dc_id: "dc1".to_string(),
244246
targets: targets.clone(),

rs/ic-observability/multiservice-discovery-shared/src/builders/prometheus_config_structure.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub const IC_NODE: &str = "ic_node";
1919
pub const IC_SUBNET: &str = "ic_subnet";
2020
pub const JOB: &str = "job";
2121
pub const IC_SUBNET_TYPE: &str = "ic_subnet_type";
22+
pub const NODE_TYPE: &str = "node_type";
2223
pub const API_BOUNDARY_NODE: &str = "api_boundary_node";
2324
// TODO: Re-add the labels below once we resolve the issues with the public dashboard queries
2425
// https://dfinity.atlassian.net/browse/OB-442
@@ -56,6 +57,10 @@ pub fn map_target_group(target_groups: Vec<TargetDto>) -> Vec<PrometheusStaticCo
5657
Some(subnet_type) => vec![(IC_SUBNET_TYPE.into(), subnet_type.as_ref().to_string())],
5758
None => vec![],
5859
})
60+
.chain(match tg.node_reward_type {
61+
Some(node_reward_type) => vec![(NODE_TYPE.into(), node_reward_type.to_string())],
62+
None => vec![],
63+
})
5964
.chain(match tg.is_api_bn {
6065
true => vec![(API_BOUNDARY_NODE.into(), "1".into())],
6166
false => vec![],

rs/ic-observability/multiservice-discovery-shared/src/contracts/target.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::{
44
net::SocketAddr,
55
};
66

7+
use ic_protobuf::registry::node::v1::NodeRewardType;
78
use ic_registry_subnet_type::SubnetType;
89
use ic_types::{NodeId, PrincipalId, SubnetId};
910
use serde::{Deserialize, Serialize};
@@ -21,6 +22,7 @@ pub struct TargetDto {
2122
/// `socket_addr`.
2223
pub subnet_id: Option<SubnetId>,
2324
pub subnet_type: Option<SubnetType>,
25+
pub node_reward_type: Option<NodeRewardType>,
2426

2527
pub dc_id: String,
2628
pub operator_id: PrincipalId,
@@ -60,6 +62,7 @@ pub fn map_to_target_dto(
6062
targets: value.targets.clone(),
6163
subnet_id: value.subnet_id,
6264
subnet_type: value.subnet_type,
65+
node_reward_type: value.node_reward_type,
6366
dc_id: value.dc_id.clone(),
6467
operator_id: value.operator_id,
6568
node_provider_id: value.node_provider_id,
@@ -80,6 +83,7 @@ impl From<&TargetDto> for TargetGroup {
8083
operator_id: value.operator_id,
8184
subnet_id: value.subnet_id,
8285
subnet_type: value.subnet_type,
86+
node_reward_type: value.node_reward_type,
8387
targets: value.targets.clone(),
8488
is_api_bn: value.is_api_bn,
8589
domain: value.domain.clone(),
@@ -98,6 +102,7 @@ impl From<&TargetGroup> for TargetDto {
98102
targets: value.targets.clone(),
99103
subnet_id: value.subnet_id,
100104
subnet_type: value.subnet_type,
105+
node_reward_type: value.node_reward_type,
101106
dc_id: value.dc_id.clone(),
102107
operator_id: value.operator_id,
103108
node_provider_id: value.node_provider_id,

rs/ic-observability/multiservice-discovery/src/server_handlers/export_targets_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub(super) async fn export_targets(
3434
operator_id: PrincipalId::new_anonymous(),
3535
subnet_id: None,
3636
subnet_type: None,
37+
node_reward_type: None,
3738
// These are old boundary nodes which are not the same as API boundary nodes
3839
// with time these should become api boundary nodes
3940
is_api_bn: false,

rs/ic-observability/prometheus-config-updater/src/custom_filters.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ mod tests {
3535
targets,
3636
subnet_id: Some(SubnetId::from(PrincipalId::new_anonymous())),
3737
subnet_type: None,
38+
node_reward_type: None,
3839
dc_id: "test".to_string(),
3940
operator_id: PrincipalId::new_anonymous(),
4041
node_provider_id: PrincipalId::new_anonymous(),

rs/ic-observability/prometheus-config-updater/src/prometheus_config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ mod prometheus_serialize {
138138
targets,
139139
subnet_id,
140140
subnet_type: None,
141+
node_reward_type: None,
141142
dc_id: "test".to_string(),
142143
operator_id: PrincipalId::new_anonymous(),
143144
node_provider_id: PrincipalId::new_anonymous(),

0 commit comments

Comments
 (0)