prometheus-client-mmap 0.25.0-x86_64-linux → 0.26.1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -9
- data/lib/prometheus/client/configuration.rb +1 -1
- data/lib/prometheus/client/formats/text.rb +1 -1
- data/lib/prometheus/client/helper/loader.rb +5 -1
- data/lib/prometheus/client/helper/mmaped_file.rb +1 -1
- 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: a4ade5caf1a2ec3858fd08bb0ed14320a0161a993c09ba196e33bbb44c94e239
|
4
|
+
data.tar.gz: 68bd8a66570599e9081383080857eb1dbde4b9d8e05f8e7df8274de3cfeedbfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb4b2fedbc1486d4e8b576e2d9afe9efb13776bc73238045db5a20af34a2e45ee5790992a7b9f25c264c5685e91443103fa56edfb2831e215455d01f3c5ad3d
|
7
|
+
data.tar.gz: af443c257293a85694d9e6b59532b93e38a3cfb1267c6b0bae53365256cd2ed5f10aa67043d3e83bfce8359ac330893be5c3114a9c8dcc02bcc04f80c4328ed2
|
data/README.md
CHANGED
@@ -10,7 +10,24 @@ through a HTTP interface. Intended to be used together with a
|
|
10
10
|
|
11
11
|
[![Gem Version][4]](http://badge.fury.io/rb/prometheus-client-mmap)
|
12
12
|
[![Build Status][3]](https://gitlab.com/gitlab-org/prometheus-client-mmap/commits/master)
|
13
|
-
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
prometheus-client-mmap ships with [precompiled native gems](https://rubygems.org/gems/prometheus-client-mmap).
|
17
|
+
Install the gem via:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem install prometheus-client-mmap
|
21
|
+
```
|
22
|
+
|
23
|
+
### Requirements for building from source
|
24
|
+
|
25
|
+
Building from source requires a number of dependencies:
|
26
|
+
|
27
|
+
* Rust v1.65+
|
28
|
+
* clang 5.0 or higher for [bindgen](https://rust-lang.github.io/rust-bindgen/requirements.html)
|
29
|
+
* `make`
|
30
|
+
* A C compiler (for legacy extension, which will be removed soon)
|
14
31
|
|
15
32
|
## Usage
|
16
33
|
|
@@ -34,9 +51,9 @@ http_requests = prometheus.counter(:http_requests, 'A counter of HTTP requests m
|
|
34
51
|
http_requests.increment
|
35
52
|
```
|
36
53
|
|
37
|
-
## Rust extension
|
54
|
+
## Rust extension
|
38
55
|
|
39
|
-
In an effort to improve maintainability, there is now
|
56
|
+
In an effort to improve maintainability, there is now a Rust
|
40
57
|
implementation that reads the metric files and outputs the multiprocess
|
41
58
|
metrics to text. If `rustc` is available, then the Rust extension will
|
42
59
|
be built automatically. The `use_rust` keyword argument can be used:
|
@@ -45,8 +62,10 @@ be built automatically. The `use_rust` keyword argument can be used:
|
|
45
62
|
puts Prometheus::Client::Formats::Text.marshal_multiprocess(use_rust: true)
|
46
63
|
```
|
47
64
|
|
65
|
+
Starting with v0.26.0, `use_rust` defaults to `true`.
|
66
|
+
|
48
67
|
Note that this parameter will likely be deprecated and removed once the Rust
|
49
|
-
extension becomes the
|
68
|
+
extension becomes the only supported mode.
|
50
69
|
|
51
70
|
### Rack middleware
|
52
71
|
|
@@ -202,14 +221,21 @@ prometheus_multiproc_dir=/tmp
|
|
202
221
|
|
203
222
|
### Multiprocess metrics via Rust extension
|
204
223
|
|
205
|
-
|
206
|
-
|
207
|
-
|
224
|
+
By default, the Rust extension will be used to read and write multiprocess
|
225
|
+
metrics if the `fast_mmaped_file_rs` extension is available. This should
|
226
|
+
be significantly faster than the C extension.
|
227
|
+
|
228
|
+
If the environment variable `prometheus_rust_multiprocess_metrics=false`
|
229
|
+
is set or if the `rust_multiprocess_metrics` configuration setting is
|
230
|
+
`false` , the C extension will be used.
|
208
231
|
|
209
232
|
### Read and write metrics via Rust extension
|
210
233
|
|
211
|
-
|
212
|
-
|
234
|
+
By default, the Rust extension will be used to read and write metrics
|
235
|
+
from the mmaped file if the `fast_mmaped_file_rs` extension is available.
|
236
|
+
|
237
|
+
To use the C extension, set the environment variable
|
238
|
+
`prometheus_rust_mmaped_file=false`.
|
213
239
|
|
214
240
|
## Pitfalls
|
215
241
|
|
@@ -14,7 +14,7 @@ module Prometheus
|
|
14
14
|
@initial_mmap_file_size = ::Prometheus::Client::PageSize.page_size(fallback_page_size: 4096)
|
15
15
|
@logger = Logger.new($stdout)
|
16
16
|
@pid_provider = Process.method(:pid)
|
17
|
-
@rust_multiprocess_metrics = ENV.fetch('prometheus_rust_multiprocess_metrics',
|
17
|
+
@rust_multiprocess_metrics = ENV.fetch('prometheus_rust_multiprocess_metrics', 'true') == 'true'
|
18
18
|
@multiprocess_files_dir = ENV.fetch('prometheus_multiproc_dir') do
|
19
19
|
Dir.mktmpdir("prometheus-mmap")
|
20
20
|
end
|
@@ -27,7 +27,7 @@ module Prometheus
|
|
27
27
|
Helper::MetricsRepresentation.to_text(metrics)
|
28
28
|
end
|
29
29
|
|
30
|
-
def marshal_multiprocess(path = Prometheus::Client.configuration.multiprocess_files_dir, use_rust:
|
30
|
+
def marshal_multiprocess(path = Prometheus::Client.configuration.multiprocess_files_dir, use_rust: true)
|
31
31
|
file_list = Dir.glob(File.join(path, '*.db')).sort
|
32
32
|
.map {|f| Helper::PlainFile.new(f) }
|
33
33
|
.map {|f| [f.filepath, f.multiprocess_mode.to_sym, f.type.to_sym, f.pid] }
|
@@ -29,7 +29,11 @@ module Prometheus
|
|
29
29
|
load_rust_extension
|
30
30
|
true
|
31
31
|
rescue LoadError
|
32
|
-
|
32
|
+
warn <<~WARN
|
33
|
+
WARNING: The Rust extension for prometheus-client-mmap is unavailable, falling back to the legacy C extension.
|
34
|
+
The Rust extension will be required in the next version. If you are compiling this gem from source,
|
35
|
+
ensure your build system has a Rust compiler and clang: https://gitlab.com/gitlab-org/ruby/gems/prometheus-client-mmap
|
36
|
+
WARN
|
33
37
|
false
|
34
38
|
end
|
35
39
|
end
|
@@ -14,7 +14,7 @@ module Prometheus
|
|
14
14
|
module Client
|
15
15
|
module Helper
|
16
16
|
# We can't check `Prometheus::Client.configuration` as this creates a circular dependency
|
17
|
-
if (ENV.fetch('prometheus_rust_mmaped_file',
|
17
|
+
if (ENV.fetch('prometheus_rust_mmaped_file', 'true') == "true" &&
|
18
18
|
Prometheus::Client::Helper::Loader.rust_impl_available?)
|
19
19
|
class MmapedFile < FastMmapedFileRs
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client-mmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.1
|
5
5
|
platform: x86_64-linux
|
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: 2023-
|
14
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rb_sys
|