Skip to content

Commit

Permalink
fix(#2370): use bridge topic id in service_monitor
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Guzik <[email protected]>
  • Loading branch information
Bravo555 committed Apr 23, 2024
1 parent ac6323a commit d32f40b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions crates/core/tedge_api/src/mqtt_topics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,6 @@ impl EntityTopicId {
pub fn as_str(&self) -> &str {
self.0.as_str()
}

// FIXME: can also match "device/bridge//" or "/device/main/service/my_custom_bridge"
// should match ONLY the single mapper bridge
pub fn is_bridge_health_topic(&self) -> bool {
self.as_str().contains("bridge")
}
}

/// Contains a topic id of the service itself and the associated device.
Expand Down
5 changes: 4 additions & 1 deletion crates/extensions/c8y_mapper_ext/src/service_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use tedge_config::TopicPrefix;
use tedge_mqtt_ext::MqttMessage;
use tracing::error;

const C8Y_BRIDGE_TOPIC_ID: &str = "device/main/service/mosquitto-c8y-bridge";

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct HealthStatus {
#[serde(default = "default_status")]
Expand All @@ -28,7 +30,8 @@ pub fn convert_health_status_message(
return vec![];
}

if entity.topic_id.is_bridge_health_topic() {
// the bridge itself is not registered as a service, only the mapper
if entity.topic_id == C8Y_BRIDGE_TOPIC_ID {
return vec![];
}

Expand Down

0 comments on commit d32f40b

Please sign in to comment.