vinted-prometheus-client-mmap 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/fast_mmaped_file_rs/src/file_entry.rs +12 -2
- data/ext/fast_mmaped_file_rs/src/map.rs +1 -2
- data/ext/fast_mmaped_file_rs/src/mmap/inner.rs +6 -1
- data/ext/fast_mmaped_file_rs/src/mmap.rs +1 -1
- data/ext/fast_mmaped_file_rs/src/util.rs +0 -1
- data/lib/prometheus/client/formats/protobuf.rb +2 -1
- data/lib/prometheus/client/histogram.rb +2 -2
- data/lib/prometheus/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a6083d5e7a88ac1e5e96a6660ebbd70fa31cecb1b1e6e324e26c4e91279713
|
4
|
+
data.tar.gz: a14011ec2a97f717bf0a18913fdde846b29ad742acb69b846b9f77c93ee7004f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e735c20e4bca0539a7e1219a1c9a0f7d3c61f838af04928e3d75d293bbf090be50ca9708aa0819234dc60025baa578795c65c8100da0550022cf4c0867186a65
|
7
|
+
data.tar.gz: bad6fe000c9a94c57797f3337fa961759a25660a337794d644b1edad8402b3a95314e51add28d6c9d3f4749ee09af3112658f13db8e95b2bb18fade77c580d6e
|
@@ -1,5 +1,5 @@
|
|
1
1
|
use core::panic;
|
2
|
-
use magnus::
|
2
|
+
use magnus::Symbol;
|
3
3
|
use serde::Deserialize;
|
4
4
|
use serde_json::value::RawValue;
|
5
5
|
use smallvec::SmallVec;
|
@@ -362,6 +362,11 @@ impl FileEntry {
|
|
362
362
|
curf += gr.0.meta.value.unwrap();
|
363
363
|
|
364
364
|
bucket.cumulative_count_float = Some(curf);
|
365
|
+
|
366
|
+
if gr.0.meta.ex.is_some() {
|
367
|
+
bucket.exemplar =
|
368
|
+
Some(exemplar_to_proto(gr.0.meta.ex.as_ref().unwrap()));
|
369
|
+
}
|
365
370
|
}
|
366
371
|
}
|
367
372
|
None => {
|
@@ -380,7 +385,7 @@ impl FileEntry {
|
|
380
385
|
final_metric_name = stripped;
|
381
386
|
}
|
382
387
|
|
383
|
-
let buckets = vec![io::prometheus::client::Bucket {
|
388
|
+
let mut buckets = vec![io::prometheus::client::Bucket {
|
384
389
|
cumulative_count: None,
|
385
390
|
cumulative_count_float: gr.0.meta.value,
|
386
391
|
upper_bound: Some(
|
@@ -391,6 +396,11 @@ impl FileEntry {
|
|
391
396
|
),
|
392
397
|
exemplar: None,
|
393
398
|
}];
|
399
|
+
|
400
|
+
if gr.0.meta.ex.is_some() {
|
401
|
+
buckets[0].exemplar =
|
402
|
+
Some(exemplar_to_proto(gr.0.meta.ex.as_ref().unwrap()));
|
403
|
+
}
|
394
404
|
m.label = m
|
395
405
|
.label
|
396
406
|
.into_iter()
|
@@ -1,7 +1,6 @@
|
|
1
1
|
use hashbrown::hash_map::RawEntryMut;
|
2
2
|
use hashbrown::HashMap;
|
3
|
-
use magnus::
|
4
|
-
use magnus::{eval, exception::*, Error, RArray, Value};
|
3
|
+
use magnus::{exception::*, Error, RArray};
|
5
4
|
use std::hash::{BuildHasher, Hash, Hasher};
|
6
5
|
use std::mem::size_of;
|
7
6
|
|
@@ -15,6 +15,7 @@ use crate::util::{read_exemplar, CheckedOps};
|
|
15
15
|
use crate::util::{self, errno, read_f64, read_u32};
|
16
16
|
use crate::Result;
|
17
17
|
use crate::HEADER_SIZE;
|
18
|
+
use std::iter;
|
18
19
|
|
19
20
|
/// A mmapped file and its metadata. Ruby never directly interfaces
|
20
21
|
/// with this struct.
|
@@ -186,7 +187,11 @@ impl InnerMmap {
|
|
186
187
|
let val = serde_json::to_string(&exemplar).unwrap();
|
187
188
|
|
188
189
|
let value_bytes = val.as_bytes();
|
189
|
-
|
190
|
+
|
191
|
+
let mut value_bytes = value_bytes.to_vec();
|
192
|
+
value_bytes.extend(iter::repeat(0).take(EXEMPLAR_ENTRY_MAX_SIZE_BYTES - value_bytes.len()));
|
193
|
+
|
194
|
+
let value_range = self.item_range(offset, EXEMPLAR_ENTRY_MAX_SIZE_BYTES)?;
|
190
195
|
|
191
196
|
let bytes = self.map.as_mut();
|
192
197
|
bytes[value_range].copy_from_slice(&value_bytes);
|
@@ -338,7 +338,7 @@ impl MmapedFile {
|
|
338
338
|
let since_the_epoch = start
|
339
339
|
.duration_since(UNIX_EPOCH)
|
340
340
|
.expect("Time went backwards");
|
341
|
-
|
341
|
+
|
342
342
|
let ex: Exemplar = Exemplar {
|
343
343
|
label_name: unsafe { exemplar_name.as_str().unwrap().into() },
|
344
344
|
label_value: unsafe { exemplar_value.as_str().unwrap().into() },
|
@@ -29,7 +29,8 @@ module Prometheus
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def marshal_multiprocess(path = Prometheus::Client.configuration.multiprocess_files_dir, use_rust: true)
|
32
|
-
|
32
|
+
# NOTE(GiedriusS): need to ensure exemplar files go at the end because they add extra data.
|
33
|
+
file_list = Dir.glob(File.join(path, '*.db')).sort_by { |f| [f.include?('exemplar') ? 1 : 0, f] }
|
33
34
|
.map {|f| Helper::PlainFile.new(f) }
|
34
35
|
.map {|f| [f.filepath, f.multiprocess_mode.to_sym, f.type.to_sym, f.pid] }
|
35
36
|
|
@@ -60,9 +60,9 @@ module Prometheus
|
|
60
60
|
:histogram
|
61
61
|
end
|
62
62
|
|
63
|
-
def observe(labels, value)
|
63
|
+
def observe(labels, value, exemplar_name = '', exemplar_value = '')
|
64
64
|
label_set = label_set_for(labels)
|
65
|
-
synchronize { @values[label_set].observe(value) }
|
65
|
+
synchronize { @values[label_set].observe(value, exemplar_name, exemplar_value) }
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vinted-prometheus-client-mmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-03-
|
14
|
+
date: 2024-03-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rb_sys
|