-
Notifications
You must be signed in to change notification settings - Fork 55
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
C8y mapper handling c8y_LogfileRequest #2108
C8y mapper handling c8y_LogfileRequest #2108
Conversation
Codecov Report
Additional details and impacted files
|
da5c7b7
to
68c3036
Compare
Robot Results
|
cd2e7d5
to
68c3036
Compare
ed0f8a4
to
6f13c4e
Compare
@@ -241,7 +241,7 @@ pub struct SmartRestLogRequest { | |||
pub date_from: OffsetDateTime, | |||
#[serde(deserialize_with = "to_datetime")] | |||
pub date_to: OffsetDateTime, | |||
pub needle: Option<String>, | |||
pub search_text: Option<String>, |
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.
;-) The needle term is a legacy from unix naming
8add896
to
921e61e
Compare
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.
I'm considering to close this PR and to start from scratch.must be remo
Indeed:
- the feature flag must be replaced by a runtime flag.
- the definition of the log request must be aligned with Create generic tedge log plugin #2086
- the mapping to entity topics must be aligned with Digital twin #2122.
921e61e
to
422ec18
Compare
422ec18
to
a9c25f4
Compare
This commit 70d6c77 removes duplicated work on this PR and #2086. Roughly, all the structures introduced in tedge_log_manager::json.rs have been deprecated in favor of those introduced by this PR in tedge_api::messages.rs. @Ruadhri17 can you please review this commit 70d6c77 |
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.
To be done before merge:
- Load the c8y mapper capability configuration from disk or the command line.
See 69e0e72
To be done as follow up tasks:
- Dedicated actor for http uploads to avoid blocking the mapper actor
- Load the topic root prefix from the configuration (instead of taking
te
as a default). - Update
tedge_log_plugin
to build topics usingMqttSchema
.
@@ -17,6 +17,7 @@ camino = { workspace = true } | |||
clock = { workspace = true } | |||
json-writer = { workspace = true } | |||
logged_command = { workspace = true } | |||
nanoid = { workspace = true } |
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.
We can consider to move the generation of a unique id for a command in MqttSchema
as this will have to be done for all command types.
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.
Approved.
A new setting has been added to enable log_management
based on tedge-log-plugin
.
Till c8y-log-plugin
is deprecated, one has to explicitly turn on the log management capability before starting the mapper.
$ sudo tedge config set c8y.enable.log_management true
$ tegde-mapper c8y &
$ tedge-log-plugin &
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.
Tested and no bugs, so approve it.
Note for testing with child devices
I got confused because I was unsure which component would create a new child device on cloud. What I understood after testing now:
- Running
tedge-log-plugin
with--device device/<child-name>//
creates a child device directory<child-name>
under/etc/tedge/operations/c8y
. Also, it creates a supported operation filec8y_LogfileRequest
under the directory. - So, c8y-mapper creates a new child device and declare supported operation accordingly. It is nothing new, our conventional way for supporting child devices.
What I misunderstood is that I had to send an MQTT message described here to create a child device. Unfortunately, it is not yet supported as c8y-mapper does not subscribe to te/+/+
topics.
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
- Remove the feature flag `log_upload`. One should not have to recompile to opt-in or opt-out a capability - Introduce a struct with a flag per capability. The plan is to extend this struct with all the features a user might want to opt-in. - This record of capabilities enabled by the user will be load from disk on start-up. This has not been done yet. Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
tedge-log-plugin were processing all commands twice, on the init state as well as on the executing state. With this fix log-tedge-plugin publish an executing event on init and only starts executing when receiving the message sent by itself. Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
tedge-log-plugin were parsing the empty message sent on the command topics to clear the associated command, leading to incorrect error messages: ERROR tedge_log_manager::actor: Incorrect log request payload: Failed to parse response with: EOF while parsing a value at line 1 column 0 Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Till c8y-log-plugin is deprecated, one has to explicitly turn on the log management capability before starting the mapper. ``` $ sudo tedge config set c8y.enable.log_management true $ tegde-mapper c8y & $ tedge-log-plugin & ``` Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
52f6572
to
eb82107
Compare
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.
Approved. Though I discovered a few problems with the tedge-log-plugin (#2212), but that is not the scope of this PR.
This is covered in #2212 |
Integration tests using the new tedge-log-plugin are included in #2213 |
tedgeUrl is now using the device name instead of "main" for the main device. This change is made on the PR thin-edge#2108. Signed-off-by: Rina Fujino <18257209+rina23q@users.noreply.github.com>
tedgeUrl is now using the device name instead of "main" for the main device. This change is made on the PR #2108. Signed-off-by: Rina Fujino <18257209+rina23q@users.noreply.github.com> Co-authored-by: Didier Wenzek <didier.wenzek@free.fr>
Proposed changes
Todo (in this PR's scope)
c8y_LogfileRequest
to tedgelog_upload
commandlog_upload
metadata topicTodo out of this PR
maximumLines
tolines
in specs, both tedge-log-plugin and c8y-mapper. Update c8y-mapper and tedge-log-plugin specs #2127Much later (not in the drop 1 scope)
Types of changes
Paste Link to the issue
#2048
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments