cloudflare / cloudflare/pingora

`ProxyHttp` types don't implement `Debug` trait

Open
#686 1 comment 0 reactions 0 assignees View on GitHub
enhancement ergonomics
Dominant language
Rust
Stars
27.4k
Forks
1.7k
Avg merge
6h 22m
Merged PRs (30d)
3

Description

## Describe the bug

When trying to work with `tracing` and other libraries, most Pingora types do not implement `Debug`, making the library difficult to instrument.

## Pingora info

Please include the following information about your environment:

**Pingora version**: 0.6.0
**Rust version**: All
**Operating system version**: All

## Steps to reproduce

This will fail to compile

```rust
type MyProxy;

impl pingora_proxy::ProxyHttp for MyProxy {
#[tracing::instrument]
async fn upstream_peer(
&self,
session: &mut Session,
ctx: &mut Self::CTX,
) -> pingora_error::Result> {
todo!()
}
}
```

## Expected results

There would be a derived or default implementation of `Debug` for types surrounding the `ProxyHttp` interface.

## Observed results

```
error[E0277]: `pingora_proxy::Session` doesn't implement `Debug`
--> crates/libucm/src/core.rs:72:5
|
72 | #[instrument]
| ^^^^^^^^^^^^^ the trait `Debug` is not implemented for `pingora_proxy::Session`
|
= help: the trait `tracing::Value` is implemented for `DebugValue`
= note: required for `&mut pingora_proxy::Session` to implement `Debug`
= note: 1 redundant requirement hidden
= note: required for `&&mut pingora_proxy::Session` to implement `Debug`
= note: required for `DebugValue<&&mut pingora_proxy::Session>` to implement `tracing::Value`
= note: required for the cast from `&DebugValue<&&mut pingora_proxy::Session>` to `&dyn tracing::Value`
= note: this error originates in the macro `$crate::valueset` which comes from the expansion of the attribute macro `instrument` (in Nightly builds, run with -Z macro-backtrace for more info)
```

## Additional context

I'm open to doing the work myself and submitting a PR, I just want to make sure it's alright ahead of time. While limited to implementing `Debug`, it will be a fairly pervasive PR.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.