-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add json container logger #1744
Conversation
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.
Thank you!
Two major points for now:
- Please rename
JsonInterface
toJson
, theInterface
onContainerRuntimeInterface
is intentional. - You can fix the build by boxing the futures of distinct types. In general, you can use the FutureExt::boxed function to convert the different future types into a single common type using trait objects. This means you can apply the following patch to fix the build:
diff --git a/conmon-rs/server/src/container_log.rs b/conmon-rs/server/src/container_log.rs
index 00363ec8..77bd43af 100644
--- a/conmon-rs/server/src/container_log.rs
+++ b/conmon-rs/server/src/container_log.rs
@@ -2,7 +2,7 @@ use crate::{container_io::Pipe, cri_logger::CriLogger, json_logger::JsonLogger};
use anyhow::Result;
use capnp::struct_list::Reader;
use conmon_common::conmon_capnp::conmon::log_driver::{Owned, Type};
-use futures::future::join_all;
+use futures::{FutureExt, future::join_all};
use std::sync::Arc;
use tokio::{io::AsyncBufRead, sync::RwLock};
@@ -61,8 +61,8 @@ impl ContainerLog {
self.drivers
.iter_mut()
.map(|x| match x {
- LogDriver::ContainerRuntimeInterface(ref mut cri_logger) => cri_logger.init(),
- LogDriver::JsonInterface(ref mut json_logger) => json_logger.init(),
+ LogDriver::ContainerRuntimeInterface(ref mut cri_logger) => cri_logger.init().boxed(),
+ LogDriver::JsonInterface(ref mut json_logger) => json_logger.init().boxed(),
})
.collect::<Vec<_>>(),
)
@@ -77,8 +77,8 @@ impl ContainerLog {
self.drivers
.iter_mut()
.map(|x| match x {
- LogDriver::ContainerRuntimeInterface(ref mut cri_logger) => cri_logger.reopen(),
- LogDriver::JsonInterface(ref mut json_logger) => json_logger.reopen(),
+ LogDriver::ContainerRuntimeInterface(ref mut cri_logger) => cri_logger.reopen().boxed(),
+ LogDriver::JsonInterface(ref mut json_logger) => json_logger.reopen().boxed(),
})
.collect::<Vec<_>>(),
)
May I ask you to rebase on top of the latest |
Hey can you check now, as only one check is failing which is |
@wasup-yash can you apply |
done |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1744 +/- ##
==========================================
+ Coverage 36.33% 37.17% +0.83%
==========================================
Files 13 14 +1
Lines 1153 1267 +114
Branches 373 417 +44
==========================================
+ Hits 419 471 +52
- Misses 495 531 +36
- Partials 239 265 +26 |
How do i resolve these failing tests now? |
Can you try |
Now we're at:
|
yup updated that only maybe it'll fix |
seems like need to change it |
b7dd279
to
d6c7acf
Compare
b10ef62
to
5381a83
Compare
c13948f
to
f870ade
Compare
Signed-off-by: wasup-yash <trooper0018080@gmail.com> Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
@haircommander @rphillips PTAL |
/approve thanks @wasup-yash and thanks @saschagrunert for helping out here |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haircommander, wasup-yash The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR is to implement additional log driver support for the JSON based log driver which enables the JSON log format.
Which issue(s) this PR fixes:
fixes #1126
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?