Skip to content

Commit 8297086

Browse files
committed
Add Ord to example
1 parent beafca7 commit 8297086

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

benches/encoding/proto.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
11
// Benchmark inspired by
22
// https://github.com/tikv/rust-prometheus/blob/ab1ca7285d3463504381a5025ae1951e020d6796/benches/text_encoder.rs:write
33

4-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
5-
use prometheus_client::encoding::prometheus_protobuf;
6-
use prometheus_client::metrics::counter::Counter;
7-
use prometheus_client::metrics::family::Family;
8-
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
9-
use prometheus_client::registry::Registry;
4+
use criterion::{Criterion, black_box, criterion_group, criterion_main};
5+
use prometheus_client::{
6+
encoding::prometheus_protobuf,
7+
metrics::{
8+
counter::Counter,
9+
family::Family,
10+
histogram::{Histogram, exponential_buckets},
11+
},
12+
registry::Registry,
13+
};
1014
use prometheus_client_derive_encode::{EncodeLabelSet, EncodeLabelValue};
1115

1216
pub fn proto(c: &mut Criterion) {
1317
c.bench_function("encode", |b| {
14-
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
18+
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug, PartialOrd, Ord)]
1519
struct CounterLabels {
1620
path: String,
1721
method: Method,
1822
some_number: u64,
1923
}
2024

21-
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelValue, Debug)]
25+
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelValue, Debug, PartialOrd, Ord)]
2226
enum Method {
2327
Get,
2428
#[allow(dead_code)]
2529
Put,
2630
}
2731

28-
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
32+
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug, PartialOrd, Ord)]
2933
struct HistogramLabels {
3034
region: Region,
3135
}
3236

33-
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelValue, Debug)]
37+
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelValue, Debug, PartialOrd, Ord)]
3438
enum Region {
3539
Africa,
3640
#[allow(dead_code)]

0 commit comments

Comments
 (0)