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

tedge-mapper-aws prints errors for known non-json mosquitto bridge health status messages #2247

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

PradeepKiruvale
Copy link
Contributor

@PradeepKiruvale PradeepKiruvale commented Sep 12, 2023

Proposed changes

Ignore health status message coming from the bridge as only json based health messages are supported.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#2236

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #2247 (350bed3) into main (6e386d1) will increase coverage by 0.0%.
The diff coverage is 70.4%.

Additional details and impacted files
Files Changed Coverage Δ
crates/extensions/aws_mapper_ext/src/converter.rs 89.8% <55.0%> (+0.7%) ⬆️
crates/core/tedge_api/src/health.rs 74.1% <88.8%> (+2.7%) ⬆️
crates/extensions/az_mapper_ext/src/converter.rs 96.9% <90.9%> (+0.2%) ⬆️

... and 1 file with indirect coverage changes

@reubenmiller
Copy link
Contributor

reubenmiller commented Sep 12, 2023

@PradeepKiruvale Wait, we still want to support tedge health messages, we just have to handle the mosquitto bridge related messages properly (I believe we are just ignoring the bridge messages in the tedge-mapper-c8y) without throwing an error.

@PradeepKiruvale
Copy link
Contributor Author

PradeepKiruvale commented Sep 13, 2023

@PradeepKiruvale Wait, we still want to support tedge health messages, we just have to handle the mosquitto bridge related messages properly (I believe we are just ignoring the bridge messages in the tedge-mapper-c8y) without throwing an error.

Agree, I have reverted those changes. Now only avoid traslating the bridge status messages

@@ -37,44 +37,51 @@ impl AwsConverter {
}

fn try_convert(&mut self, input: &MqttMessage) -> Result<Vec<MqttMessage>, ConversionError> {
let default_timestamp = self.add_timestamp.then(|| self.clock.now());
Copy link
Contributor

Choose a reason for hiding this comment

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

[Minor] It could be nice to minimize the diff.

Here, one way to do that is to return early when this is a bridge topic.

// Ignore health status message coming from the bridges
if input.topic.name.starts_with("tedge/health") && input.topic.name.ends_with("bridge") {
    return vec![];
}

// ... former code unchanged

Comment on lines 40 to 42
if input.topic.name.eq("tedge/health/mosquitto-az-bridge")
|| input.topic.name.eq("tedge/health/mosquitto-aws-bridge")
|| input.topic.name.eq("tedge/health/mosquitto-c8y-bridge")
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to avoid exact matches on a the current list of bridge, as adding a new one would break again this mapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, added a function to check the bridge dynamically.

@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request September 19, 2023 06:45 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
273 0 5 273 100 49m24.758999999s

Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

Signed-off-by: Pradeep Kumar K J <pkj@softwareag.com>
@PradeepKiruvale PradeepKiruvale temporarily deployed to Test Pull Request September 19, 2023 12:36 — with GitHub Actions Inactive
@PradeepKiruvale PradeepKiruvale merged commit c0ded23 into thin-edge:main Sep 19, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants