materialize icon indicating copy to clipboard operation
materialize copied to clipboard

make stderr log filter dynamically configurable

Open pH14 opened this issue 3 years ago • 3 comments

It'd be very helpful to be able to toggle our log levels dynamically when debugging actively-running applications, so we can selectively dig deeper into app behavior without needing a deploy / to bounce a running pod with some filter override / introduce general log spam.

This PR follows @guswynn's work to make opentelemetry tracing dynamically toggleable, and allows a user to pass in a log filter at runtime through the internal HTTP server. The cost of this flexibility is the RwLock inside the reload layer. I'm not sure how big of a performance impact this will make, nor am I quite sure how to measure it.

I've verified this changes works as expected through local calls such as:

> curl -X PUT -d '{"targets": "mz_persist_client=debug"}' -H 'Content-Type: application/json' localhost:6878/api/stderr/config
> curl -X PUT -d '{"targets": "info"}' -H 'Content-Type: application/json' localhost:6878/api/stderr/config

It'd also be helpful to make our tracing filter similarly configurable, but I think that deserves a separate PR if we pursue it.

Motivation

  • This PR adds a feature that has not yet been specified.

Tips for reviewer

Checklist

pH14 avatar Sep 16 '22 17:09 pH14

Huge +1 on this, @pH14! We've been saying we should do this for years. Thanks for actually doing it!

benesch avatar Sep 17 '22 03:09 benesch

@pH14 other than my suggestion to make the otel endpoint work the same (which can be done in a later pr if you want!), this still looks good to merge!

guswynn avatar Sep 19 '22 21:09 guswynn

other than my suggestion to make the otel endpoint work the same (which can be done in a later pr if you want!), this still looks good to merge!

Sounds good! I'd love to have this change in the next release, so I think I'm going to merge this as-is (assuming it all builds), and then start on a separate PR to work through your suggestions of updating the otel endpoint to have the same behavior / use the same types

pH14 avatar Sep 21 '22 19:09 pH14

@pH14 sounds good! I retried the failing test but dont know if you like squash or merge or rebase so ill let you do that!

guswynn avatar Sep 21 '22 20:09 guswynn