brayniac / histogram

rust histogram and percentile stats
Apache License 2.0
46 stars 4 forks source link

Help me out with this rust-metrics thing #15

Closed posix4e closed 8 years ago

posix4e commented 8 years ago

I'm trying to write a metrics library http://github.com/posix4e/rust-metrics which uses this histogram package . I want to make a reporter for prometheus but I don't know how to convert your histogram to

message Quantile {
  optional double quantile = 1;
  optional double value    = 2;
}

message Summary {
  optional uint64   sample_count = 1;
  optional double   sample_sum   = 2;
  repeated Quantile quantile     = 3;
}

message Untyped {
  optional double value = 1;
}

message Histogram {
  optional uint64 sample_count = 1;
  optional double sample_sum   = 2;
  repeated Bucket bucket       = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional.
}

message Bucket {
  optional uint64 cumulative_count = 1; // Cumulative in increasing order.
  optional double upper_bound = 2;      // Inclusive.
}
brayniac commented 8 years ago

Hi @posix4e - is there more comprehensive documentation? I can't tell from what you've provided what is really expected in terms of data. I suspect that you just need to provide it with a histogram message, which would include all the buckets. As Histogram implements Iterator which returns a HistogramBucket containing the count and value (which is the upper bound of items in that bucket) - I'm guessing this is as simple as iterating through the Histogram to serialize a message for Prometheus.

posix4e commented 8 years ago

Cool, this was more of a heads up, I'm going to do this. Thanks so much for your wonderful library!

brayniac commented 8 years ago

Awesome! Let me know if I can be of any help or if we need to make any changes to support this use-case. I'd love to see histogram feed into Prometheus. That's cool stuff!

posix4e commented 8 years ago

In general I need a lot more critical feedback on the library. So another set of eyes would be great. Thus far it's not a huge amount of code.

-Alex

On Mon, May 30, 2016 at 5:35 PM Brian Martin notifications@github.com wrote:

Awesome! Let me know if I can be of any help or if we need to make any changes to support this use-case. I'd love to see histogram feed into Prometheus. That's cool stuff!

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/brayniac/histogram/issues/15#issuecomment-222569711, or mute the thread https://github.com/notifications/unsubscribe/AAxN2-8F2V1FshU-xpNNO2vwCVJ1TbCnks5qG4JfgaJpZM4IpfU0 .

Sent from my mobile 4045076749 Alex Newman

brayniac commented 8 years ago

I think I can find some time to look this week.

posix4e commented 8 years ago

https://github.com/posix4e/rust-metrics/tree/prometheus/ <- is my wip. There's a lot of stuff I'm pretty sure is good to merge. in prior commits.