-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fix send_event() in c8y_http_proxy to create events under child devices #2421
Merged
rina23q
merged 3 commits into
thin-edge:main
from
rina23q:bugfix/2394/fix-send-event-api
Nov 8, 2023
Merged
Fix send_event() in c8y_http_proxy to create events under child devices #2421
rina23q
merged 3 commits into
thin-edge:main
from
rina23q:bugfix/2394/fix-send-event-api
Nov 8, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Robot Results
|
809ff44
to
7168155
Compare
albinsuresh
reviewed
Nov 7, 2023
tests/RobotFramework/tests/cumulocity/telemetry/child_device_telemetry.robot
Show resolved
Hide resolved
c8y-mapper should create an event for a child device via HTTP when the event size exceeds the MQTT threshold. However, it was created for main device instead. This commit fixes the issue. Signed-off-by: Rina Fujino <[email protected]>
Use combination of yes, head and tr to generate a large string as the commands are executed on the device under `sh` and not `bash` by default (as bash is not already installed) Signed-off-by: Reuben Miller <[email protected]>
Signed-off-by: Reuben Miller <[email protected]>
86e3d83
to
300c14b
Compare
Codecov Report
Additional details and impacted files
|
This was referenced Nov 7, 2023
albinsuresh
approved these changes
Nov 8, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
c8y-mapper should create an event for a child device via HTTP when the event size exceeds the MQTT threshold. However, it was created for the main device instead. This PR fixes the issue.
The root cause how to get the
device_id
(= c8y's internal device ID) in this part of the code.thin-edge.io/crates/extensions/c8y_http_proxy/src/actor.rs
Lines 310 to 314 in 9dea122
c8y_event.source
needs to hold an internal ID, however, it's too early to expect to have an internal ID assource
. If we have to use the current implementation, one has to get the device's internal ID in the mapper's converter level (= thec8y_event
object in the the below code has to have its internal ID assource
). Querying an internal ID should be definitely hidden inside c8y_http_proxy API.thin-edge.io/crates/extensions/c8y_mapper_ext/src/converter.rs
Line 468 in 9dea122
For this reason, I introduced a new struct
CreateEvent
to parse device's external ID to c8y_http_proxy API.Types of changes
Paste Link to the issue
#2394
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments