-
Notifications
You must be signed in to change notification settings - Fork 817
Description
Bug Report
Version
tracing = "0.1.25"
tracing-futures = "0.2.5"
tracing-log = "0.1.2"
tracing-opentelemetry = "0.12.0"
tracing-subscriber = "0.2.18"
Platform
MacOS 11.2
Crates
Description
I'm encountering what I think is some weird behavior from EnvFilter
.
My goal is to disable all spans for the /healthcheck
endpoint. By default, spans are captured for it:
env RUST_LOG="info" cargo run -- -v start
May 05 12:38:24.105 INFO Server::run{addr=0.0.0.0:3030}: warp::server: listening on http://0.0.0.0:3030
May 05 12:38:26.560 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51673}: warp::filters::trace: processing request
May 05 12:38:26.561 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51673}: sqlx::query: /* SQLx ping */; rows: 0, elapsed: 541.089µs
May 05 12:38:26.563 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51673}: sqlx::query: SELECT 1; rows: 1, elapsed: 1.293ms
May 05 12:38:26.563 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51673}: warp::filters::trace: finished processing with success status=200
May 05 12:38:26.591 INFO request{method=GET path=/favicon.ico version=HTTP/1.1 remote.addr=127.0.0.1:51673 referer=http://localhost:3030/healthcheck}: warp::filters::trace: processing request
May 05 12:38:26.592 ERROR request{method=GET path=/favicon.ico version=HTTP/1.1 remote.addr=127.0.0.1:51673 referer=http://localhost:3030/healthcheck}: warp::filters::trace: unable to process request (internal error) status=500 error=Rejection([AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated")])
When I do the following filter using just the default level, plus a particular target, the results are as expected:
env RUST_LOG="info,warp::filters::trace=off" cargo run -- -v start
May 05 12:36:22.506 INFO Server::run{addr=0.0.0.0:3030}: warp::server: listening on http://0.0.0.0:3030
May 05 12:36:24.110 INFO sqlx::query: /* SQLx ping */; rows: 0, elapsed: 404.931µs
May 05 12:36:24.112 INFO sqlx::query: SELECT 1; rows: 1, elapsed: 1.128ms
Now, reading the docs, I find that I should be able to specify particular fields in my span to match against. So I try, and get no apparent result:
env RUST_LOG="info,warp::filters::trace[request{path=/healthcheck}]=warn" cargo run -- -v start
May 05 12:40:30.222 INFO Server::run{addr=0.0.0.0:3030}: warp::server: listening on http://0.0.0.0:3030
May 05 12:40:31.339 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51694}: warp::filters::trace: processing request
May 05 12:40:31.340 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51694}: sqlx::query: /* SQLx ping */; rows: 0, elapsed: 535.085µs
May 05 12:40:31.341 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51694}: sqlx::query: SELECT 1; rows: 1, elapsed: 1.231ms
May 05 12:40:31.341 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51694}: warp::filters::trace: finished processing with success status=200
May 05 12:40:31.383 INFO request{method=GET path=/favicon.ico version=HTTP/1.1 remote.addr=127.0.0.1:51694 referer=http://localhost:3030/healthcheck}: warp::filters::trace: processing request
May 05 12:40:31.384 ERROR request{method=GET path=/favicon.ico version=HTTP/1.1 remote.addr=127.0.0.1:51694 referer=http://localhost:3030/healthcheck}: warp::filters::trace: unable to process request (internal error) status=500 error=Rejection([AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated"), AuthenticationError("Must be authenticated")])
I try various combinations, such as info,[request{path=/healthcheck}]=warn
, info,[request{path=/healthcheck}]=off
, info,[{path=/healthcheck}]=off
, info,[{path=/healthcheck}]=warn
, info,[{path=\"/healthcheck\"}]=off
, and even info,[{path}]=off
, with the same results.
In order to check whether the filtering is working at all, I tried the inverse: off,[{path=/healthcheck}]=info
, and indeed only got logs about the /healthcheck
endpoint:
env RUST_LOG="off,[{path=/healthcheck}]=info" cargo run -- -v start
May 05 12:46:26.670 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51727}: warp::filters::trace: processing request
May 05 12:46:26.672 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51727}: sqlx::query: /* SQLx ping */; rows: 0, elapsed: 472.144µs
May 05 12:46:26.673 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51727}: sqlx::query: SELECT 1; rows: 1, elapsed: 1.341ms
May 05 12:46:26.674 INFO request{method=GET path=/healthcheck version=HTTP/1.1 remote.addr=127.0.0.1:51727}: warp::filters::trace: finished processing with success status=200
I suspect that somehow the info
is taking priority over the second filter, and I can't figure out how to signify my intent of "ALL messages >= info
, EXCEPT those matching this filter". Any ideas?