client_rust icon indicating copy to clipboard operation
client_rust copied to clipboard

implementations of encode_family on text & protobuf are not symmetric

Open codefever opened this issue 9 months ago • 2 comments

For text (https://github.com/prometheus/client_rust/blob/master/src/encoding/text.rs#L387), family inheritance is prohibited by debug_assert. But for protobuf (https://github.com/prometheus/client_rust/blob/master/src/encoding/protobuf.rs#L236), the iniheritantce is allowed.

Is there any special consideration? I found these when i was implementing a custom metric which would extend its own families under another prometheus_client::metrics::family::Family context.

codefever avatar Jul 08 '25 13:07 codefever

If I recall correctly, I disallowed a family in a family back then, to prevent edge cases.

What is your use-case for a family in a family?

mxinden avatar Jul 11 '25 11:07 mxinden

If I recall correctly, I disallowed a family in a family back then, to prevent edge cases.

What is your use-case for a family in a family?

I wanted to implement a custom metric type which generate multiple metrics out with different prefix and labels (Like histogram).

After a deeper look at Summary type, I thought it quitely matches my use case. However, there's no Summary supported in this crate. I've seen several PRs here. What're the blocking issues about them...

codefever avatar Jul 14 '25 10:07 codefever