prometheus-client-mmap 0.25.0 → 1.1.1
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/.tool-versions +1 -1
- data/README.md +32 -28
- data/ext/fast_mmaped_file_rs/Cargo.lock +195 -234
- data/ext/fast_mmaped_file_rs/Cargo.toml +7 -7
- data/ext/fast_mmaped_file_rs/extconf.rb +1 -3
- data/ext/fast_mmaped_file_rs/src/file_info.rs +51 -1
- data/ext/fast_mmaped_file_rs/src/mmap/inner.rs +0 -10
- data/ext/fast_mmaped_file_rs/src/mmap.rs +2 -5
- data/lib/prometheus/client/configuration.rb +1 -2
- data/lib/prometheus/client/formats/text.rb +1 -12
- data/lib/prometheus/client/helper/mmaped_file.rb +3 -14
- data/lib/prometheus/client/label_set_validator.rb +1 -2
- data/lib/prometheus/client/rack/exporter.rb +1 -3
- data/lib/prometheus/client/support/puma.rb +44 -0
- data/lib/prometheus/client/version.rb +1 -1
- metadata +9 -47
- data/ext/fast_mmaped_file/extconf.rb +0 -30
- data/ext/fast_mmaped_file/fast_mmaped_file.c +0 -122
- data/ext/fast_mmaped_file/file_format.c +0 -5
- data/ext/fast_mmaped_file/file_format.h +0 -11
- data/ext/fast_mmaped_file/file_parsing.c +0 -195
- data/ext/fast_mmaped_file/file_parsing.h +0 -27
- data/ext/fast_mmaped_file/file_reading.c +0 -102
- data/ext/fast_mmaped_file/file_reading.h +0 -30
- data/ext/fast_mmaped_file/globals.h +0 -14
- data/ext/fast_mmaped_file/mmap.c +0 -438
- data/ext/fast_mmaped_file/mmap.h +0 -61
- data/ext/fast_mmaped_file/rendering.c +0 -199
- data/ext/fast_mmaped_file/rendering.h +0 -8
- data/ext/fast_mmaped_file/utils.c +0 -56
- data/ext/fast_mmaped_file/utils.h +0 -22
- data/ext/fast_mmaped_file/value_access.c +0 -242
- data/ext/fast_mmaped_file/value_access.h +0 -15
- data/lib/prometheus/client/helper/loader.rb +0 -40
- data/vendor/c/hashmap/.gitignore +0 -52
- data/vendor/c/hashmap/LICENSE +0 -21
- data/vendor/c/hashmap/README.md +0 -90
- data/vendor/c/hashmap/_config.yml +0 -1
- data/vendor/c/hashmap/src/hashmap.c +0 -692
- data/vendor/c/hashmap/src/hashmap.h +0 -267
- data/vendor/c/hashmap/test/Makefile +0 -22
- data/vendor/c/hashmap/test/hashmap_test.c +0 -608
- data/vendor/c/jsmn/.travis.yml +0 -4
- data/vendor/c/jsmn/LICENSE +0 -20
- data/vendor/c/jsmn/Makefile +0 -41
- data/vendor/c/jsmn/README.md +0 -168
- data/vendor/c/jsmn/example/jsondump.c +0 -126
- data/vendor/c/jsmn/example/simple.c +0 -76
- data/vendor/c/jsmn/jsmn.c +0 -314
- data/vendor/c/jsmn/jsmn.h +0 -76
- data/vendor/c/jsmn/library.json +0 -16
- data/vendor/c/jsmn/test/test.h +0 -27
- data/vendor/c/jsmn/test/tests.c +0 -407
- data/vendor/c/jsmn/test/testutil.h +0 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 971eb514c45dcdbf4b312b1b0ea74b3060e8879085e9947da5af0b658e711f83
|
4
|
+
data.tar.gz: 69f018cddf0684a280d70ed06cf8c2a04c6f5c0fd3fad749b9624185eb877584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae066f96a7585fdd96ef7604d5749c56996176826eeb834765c1375f734c60838e94fa867b8a333bbc48a0ae50917f6096efc7e52ed2054564bf620f1cd71384
|
7
|
+
data.tar.gz: 7738eeef01025906e0897b08ee41e5f26a65f781b71374fbd9aed2cfba6eea5b62735c789ed0cb879ca10a1936d72a967709f2ca9f63c7fe0a996df3c7291cf7
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rust 1.
|
1
|
+
rust 1.73.0
|
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,19 +51,11 @@ 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
|
-
|
56
|
+
This gem now uses a rewritten Rust extension instead of C.
|
40
57
|
implementation that reads the metric files and outputs the multiprocess
|
41
|
-
metrics to text.
|
42
|
-
be built automatically. The `use_rust` keyword argument can be used:
|
43
|
-
|
44
|
-
```ruby
|
45
|
-
puts Prometheus::Client::Formats::Text.marshal_multiprocess(use_rust: true)
|
46
|
-
```
|
47
|
-
|
48
|
-
Note that this parameter will likely be deprecated and removed once the Rust
|
49
|
-
extension becomes the default mode.
|
58
|
+
metrics to text. This implementation is significantly faster than the C extension.
|
50
59
|
|
51
60
|
### Rack middleware
|
52
61
|
|
@@ -200,23 +209,12 @@ Set `prometheus_multiproc_dir` environment variable to the path where you want m
|
|
200
209
|
prometheus_multiproc_dir=/tmp
|
201
210
|
```
|
202
211
|
|
203
|
-
### Multiprocess metrics via Rust extension
|
204
|
-
|
205
|
-
If the environment variable `prometheus_rust_multiprocess_metrics=true` is set or if the `rust_multiprocess_metrics`
|
206
|
-
configuration setting is `true` and the `fast_mmaped_file_rs` extension is available, it will be used to generate
|
207
|
-
multiprocess metrics. This should be significantly faster than the C extension.
|
208
|
-
|
209
|
-
### Read and write metrics via Rust extension
|
210
|
-
|
211
|
-
If the environment variable `prometheus_rust_mmaped_file=true` is set then if the `fast_mmaped_file_rs`
|
212
|
-
extension is available it will be used to read and write metrics from the mmapped file.
|
213
|
-
|
214
212
|
## Pitfalls
|
215
213
|
|
216
214
|
### PID cardinality
|
217
215
|
|
218
|
-
In multiprocess setup e.g. running under Unicorn, having worker process restart often
|
219
|
-
lead to performance problems when proccesing metric files. By default each process using
|
216
|
+
In multiprocess setup e.g. running under Unicorn or Puma, having worker process restart often
|
217
|
+
can lead to performance problems when proccesing metric files. By default each process using
|
220
218
|
Prometheus metrics will create a set of files based on that process PID. With high worker
|
221
219
|
churn this will lead to creation of thousands of files and in turn will cause very noticable
|
222
220
|
slowdown when displaying metrics
|
@@ -224,17 +222,23 @@ slowdown when displaying metrics
|
|
224
222
|
To reduce this problem, a surrogate process id can be used. Set of all such IDs needs
|
225
223
|
have low cardinality, and each process id must be unique among all running process.
|
226
224
|
|
227
|
-
For Unicorn a worker id/number can be used to greatly speedup the metrics rendering.
|
225
|
+
For Unicorn and Puma a worker id/number can be used to greatly speedup the metrics rendering.
|
228
226
|
|
229
|
-
|
227
|
+
If you are using Unicorn, add this line to your `configure` block:
|
230
228
|
|
231
229
|
```ruby
|
232
230
|
config.pid_provider = Prometheus::Client::Support::Unicorn.method(:worker_pid_provider)
|
233
231
|
```
|
234
232
|
|
233
|
+
If you are using Puma, add this line to your `configure` block:
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
config.pid_provider = Prometheus::Client::Support::Puma.method(:worker_pid_provider)
|
237
|
+
```
|
238
|
+
|
235
239
|
## Tools
|
236
240
|
|
237
|
-
|
241
|
+
### `bin/parse`
|
238
242
|
|
239
243
|
This command can be used to parse metric files located on the filesystem just like a metric exporter would.
|
240
244
|
It outputs either `json` formatted raw data or digested data in prometheus `text` format.
|