Conversation
When developing things (like prometheus#962), it's useful to be able to debug the http roundtrips. This adds `debugRoundTripper` that other prom tools can use (behind a `--http.debug` flag) which automatically logs the HTTP requests while redacting credentials. Signed-off-by: Phil Dibowitz <phil@ipom.com>
This depends on prometheus/common#985 for the infrastructure, but adds an --http.debug flag that uses the prometheus/common debug roundtripper to provide debug logs with credentials censored. Signed-off-by: Phil Dibowitz <phil@ipom.com>
|
Why would this live in a Prometheus package? Seems quite general. What similar existing tools are out there? |
|
There's not a decent equivalent I can find. There's replacements for the entire HTTP client that have similar things, but it seems extreme to rip out the entire http client. The closest thing I've found is net/http/httputil's httputil.DumpRequestOut and DumpResponse. However, it has no redaction or body-size limit. Further, DumpResponse(..., true) buffers the entire body, so we would still need a wrapper for safe previews. Adding a simple round-tripper to do this didn't seem like a huge problem, and I implemented not for fun, but because I needed something like it to implement #962 |
|
(that said, if this isn't desired, I have no hard need for it now that #962 is written... the cfaccess support was the goal, and that's the PR I'm most interested in getting merged. I just thought it'd be a good-citizen thing to do to make this generic and upstream it as well) |
|
(which is my subtle attempt to get attention on #962 ;) ) |
When developing things (like #962), it's useful to be able
to debug the http roundtrips. This adds
debugRoundTripperthat other promtools can use (behind a
--http.debugflag) which automaticallylogs the HTTP requests while redacting credentials.
Implemented downstream usage for promtool and amtool: prometheus/prometheus#19577 and prometheus/alertmanager#5541
Signed-off-by: Phil Dibowitz phil@ipom.com