-
Notifications
You must be signed in to change notification settings - Fork 272
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
improvement: Igni/test span bump #359
Conversation
ogod forgot to rebase 😭 |
…terminism in tests. This PR bumps test-span to version 0.2.0 which allows us to add log level filters according to our dependencies; eg: apollo_router=tracing::Level::DEBUG reqwest=tracing::Level::WARN etc. This allows us to remove some deps logs that are non deterministic at the moment.
082352b
to
6276c60
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 not sure if my comments are correct, but worth asking I guess.
#[target(reqwest=tracing::Level::INFO)] | ||
#[target(reqwest_tracing=tracing::Level::INFO)] | ||
#[target(hyper::client=tracing::Level::INFO)] |
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.
Don't we actually want:
#[level(tracing::Level::ERROR)]
#[target(apollo_router=tracing::Level::DEBUG)]
#[target(apollo_router_core=tracing::Level::DEBUG)]
to reduce the prospect of interference?
The above should mean we only get messages at level ERROR from things which aren't apollo_router or apollo_router_core. I believe that's the goal, but I could be on the wrong track...
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.
Hmm that's a very interesting comment!
the default level for all logs in test_span is debug, unless specified otherwise, which means this tests kind of unfolds to:
#[level(tracing::Level::DEBUG)]
#[target(reqwest=tracing::Level::INFO)]
#[target(reqwest_tracing=tracing::Level::INFO)]
#[target(hyper::client=tracing::Level::INFO)]
which effectively means we're tracking spans and logs at the DEBUG
level unless it's from reqwest
, reqwest_tracing
, and hyper
.
What teases my mind is that your comment may call for a workspace level
and a dependencies level
, which I'll happily open an issue for in test_span, if it sounds good to you?
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 generally accepted default for log/tracing levels is INFO. That means it's a bit "surprising" (as in principle of least surprise) that test_span's default level is DEBUG.
That aside, I think that if we were going to vary from INFO as a default, then we should probably vary to ERROR, to make logging an (almost) "opt-in" decision and thus attempt to minimize random variability when new dependencies are added.
I'd probably prefer: default is INFO (so no surprises) and also recommend that people configure a default of ERROR (as I did) and opt-in for the stuff they want to capture rather than specifying what they want to exclude (which is more fragile and likely to break as crates are added/removed).
My second preference would be to set the default to ERROR and again require an opt-in for stuff you are interested in.
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 feel like defaulting to INFO would make a lot of sense indeed, I'm not quite sure ERROR would be a sensible default for a span / logs snapshots crate.
However when it comes to apollo_rs setting the log level to ERROR (or INFO) wouldn't show interesting spans, thus defeating the purpose of "having regression tests that prevents us from breaking the tracing spans layout we have in place when it comes to processing a graphql request".
I'm opening an issue!
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.
But wouldn't you just add an entry for apollo_rs
? e.g.:
#[target(apollo_rs=tracing::Level::DEBUG)]
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.
that works as well!
#[target(apollo_router=tracing::Level::DEBUG)] |
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!
@@ -77,7 +77,7 @@ mockall = "0.11.0" | |||
reqwest = { version = "0.11.9", features = ["json", "stream"] } | |||
serde_json_bytes = { version = "0.2.0", features = ["preserve_order"] } | |||
test-log = { version = "0.2.8", default-features = false, features = ["trace"] } | |||
test-span = "0.1.1" | |||
test-span = "0.3" |
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 write versions in full so we have a track of what was the last working version
test-span = "0.3" | |
test-span = "0.3.0" |
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.
ok, will open a followup then!
Just creating a link to the upstream PR: apollographql/test-span#11 |
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: apollo-bot2 <apollo-bot2@users.noreply.github.com>
🔧 improvement: Test_span: add more powerful filtering capabilities, to remove non determinism in tests.
This PR bumps test-span to version 0.2.0 which allows us to add log level filters according to our dependencies; eg:
etc.
This allows us to remove some deps logs that are non deterministic at the moment.