-
Notifications
You must be signed in to change notification settings - Fork 251
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
Follow logs #431
Follow logs #431
Conversation
I wonder if it would make sense to push all this logging through |
crates/engine/src/io.rs
Outdated
|
||
impl FollowComponents { | ||
/// Whether a given component should have its logs followed on stdout/stderr. | ||
#[allow(clippy::ptr_arg)] // Clippy recommendation makes it not compile |
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 docs suggest using any
:
ids.any(|id| id == component_id)
@lann re using the tracing crate - yes, I had been wondering whether to use tracing or to dump straight to the output streams. My initial feeling was that the goal here was specifically "follow" so you wouldn't necessarily want an alternate subscriber, you want to see it in your UI; but it's definitely an open question and I should have flagged it. Thanks for bringing it up! |
I think seeing things in your UI is a perfect example of a subscriber! |
efe3ab8
to
68b93b6
Compare
Potential follow-up. How would we feel about prepending the component name in the followed logs? For example, following the logs of the Spin docs from this repo, it is unclear in which component a log line originated.
For example, Docker Compose's output (source):
(definitely not blocking this PR) |
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.
This looks great, thank you!
LGTM
This, like Lann's tracing question, is interesting. At the moment we avoid having to do anything with the output byte stream. Using It's certainly attractive to be able to distinguish logs in this way. But I can also see a case for not messing with the output of code that doesn't belong to us and we have no idea what it does! This would be good to resolve before we merge this, because it might mean changes at the structural level. We'd probably also want to run it past the commenters on #438 to make sure it wouldn't affect the way they want to do things (I think they plan to inject their own streams so it shouldn't be an issue but). |
Ah, good point, I will reference the comment in #438. |
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 fine punting on tracing
integration for now. This PR addresses the problem well.
ref #449
@@ -391,6 +400,9 @@ pub(crate) fn compute_default_headers<'a>( | |||
/// All HTTP executors must implement this trait. | |||
#[async_trait] | |||
pub(crate) trait HttpExecutor: Clone + Send + Sync + 'static { | |||
// TODO: allowing this lint because I want to gather feedback before | |||
// investing time in reorganising this | |||
#[allow(clippy::too_many_arguments)] |
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 ran into this before and punted by...removing an unnecessary argument. 😐
I'm fine leaving this for now since these HttpExecutor
s are ripe for a broader refactoring. Should probably reword the comment though.
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Fixes #380.
For discussion and feedback.
The current UI is:
spin up ... --follow comp1 --follow comp2
to follow specifically those componentsspin up ... --follow-all
to follow all componentsThe current behaviour is the followed component stdout gets redirected to Spin stdout and component stderr to Spin stderr, unless the executor chooses to do things differently. (WAGI, for example, follows only stderr.)
I feel like there should be scope for simplification, and I'm not quite sure whether I'm passing the follow selection around in an appropriate way. Also there is a clippy lint that I'm not sure how to address. Input eagerly requested.
Note: This needs a rebase but I was thinking I'd hold off on that until I've had feedback on whether this is along the right lines - no point ploughing through a rebase if we decide to redesign it!