prometheus-client-mmap 0.25.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.tool-versions +1 -1
  3. data/README.md +32 -28
  4. data/ext/fast_mmaped_file_rs/Cargo.lock +195 -234
  5. data/ext/fast_mmaped_file_rs/Cargo.toml +7 -7
  6. data/ext/fast_mmaped_file_rs/extconf.rb +1 -3
  7. data/ext/fast_mmaped_file_rs/src/file_info.rs +51 -1
  8. data/ext/fast_mmaped_file_rs/src/mmap/inner.rs +0 -10
  9. data/ext/fast_mmaped_file_rs/src/mmap.rs +2 -5
  10. data/lib/prometheus/client/configuration.rb +1 -2
  11. data/lib/prometheus/client/formats/text.rb +1 -12
  12. data/lib/prometheus/client/helper/mmaped_file.rb +3 -14
  13. data/lib/prometheus/client/label_set_validator.rb +1 -2
  14. data/lib/prometheus/client/rack/exporter.rb +1 -3
  15. data/lib/prometheus/client/support/puma.rb +44 -0
  16. data/lib/prometheus/client/version.rb +1 -1
  17. metadata +9 -47
  18. data/ext/fast_mmaped_file/extconf.rb +0 -30
  19. data/ext/fast_mmaped_file/fast_mmaped_file.c +0 -122
  20. data/ext/fast_mmaped_file/file_format.c +0 -5
  21. data/ext/fast_mmaped_file/file_format.h +0 -11
  22. data/ext/fast_mmaped_file/file_parsing.c +0 -195
  23. data/ext/fast_mmaped_file/file_parsing.h +0 -27
  24. data/ext/fast_mmaped_file/file_reading.c +0 -102
  25. data/ext/fast_mmaped_file/file_reading.h +0 -30
  26. data/ext/fast_mmaped_file/globals.h +0 -14
  27. data/ext/fast_mmaped_file/mmap.c +0 -438
  28. data/ext/fast_mmaped_file/mmap.h +0 -61
  29. data/ext/fast_mmaped_file/rendering.c +0 -199
  30. data/ext/fast_mmaped_file/rendering.h +0 -8
  31. data/ext/fast_mmaped_file/utils.c +0 -56
  32. data/ext/fast_mmaped_file/utils.h +0 -22
  33. data/ext/fast_mmaped_file/value_access.c +0 -242
  34. data/ext/fast_mmaped_file/value_access.h +0 -15
  35. data/lib/prometheus/client/helper/loader.rb +0 -40
  36. data/vendor/c/hashmap/.gitignore +0 -52
  37. data/vendor/c/hashmap/LICENSE +0 -21
  38. data/vendor/c/hashmap/README.md +0 -90
  39. data/vendor/c/hashmap/_config.yml +0 -1
  40. data/vendor/c/hashmap/src/hashmap.c +0 -692
  41. data/vendor/c/hashmap/src/hashmap.h +0 -267
  42. data/vendor/c/hashmap/test/Makefile +0 -22
  43. data/vendor/c/hashmap/test/hashmap_test.c +0 -608
  44. data/vendor/c/jsmn/.travis.yml +0 -4
  45. data/vendor/c/jsmn/LICENSE +0 -20
  46. data/vendor/c/jsmn/Makefile +0 -41
  47. data/vendor/c/jsmn/README.md +0 -168
  48. data/vendor/c/jsmn/example/jsondump.c +0 -126
  49. data/vendor/c/jsmn/example/simple.c +0 -76
  50. data/vendor/c/jsmn/jsmn.c +0 -314
  51. data/vendor/c/jsmn/jsmn.h +0 -76
  52. data/vendor/c/jsmn/library.json +0 -16
  53. data/vendor/c/jsmn/test/test.h +0 -27
  54. data/vendor/c/jsmn/test/tests.c +0 -407
  55. data/vendor/c/jsmn/test/testutil.h +0 -94
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15dde2bfa3d25ee344e811944e599f0a64ed199caf949310cbfc99a7af4ccfd3
4
- data.tar.gz: 6bd6f3a9d0d7c055b1138acfe06f6d206edeb73481eff5be82079ed36c73c64e
3
+ metadata.gz: 971eb514c45dcdbf4b312b1b0ea74b3060e8879085e9947da5af0b658e711f83
4
+ data.tar.gz: 69f018cddf0684a280d70ed06cf8c2a04c6f5c0fd3fad749b9624185eb877584
5
5
  SHA512:
6
- metadata.gz: 23e114d89e09c771308e877ee0218aa94daf01df55ff0c29875a41281b762ecc09e831b0e5bafcaf7aa5b9b6a67d8e95328bbeaf2ddad867b6901a301650a068
7
- data.tar.gz: 0e1c4b6bce251e33c8551eba06b5b1167cdd3e56eaaac9caee7f9256546c83430a66e8d7481bad550e52bb6690810e31f688379a65792e1d81d251b36a8958dd
6
+ metadata.gz: ae066f96a7585fdd96ef7604d5749c56996176826eeb834765c1375f734c60838e94fa867b8a333bbc48a0ae50917f6096efc7e52ed2054564bf620f1cd71384
7
+ data.tar.gz: 7738eeef01025906e0897b08ee41e5f26a65f781b71374fbd9aed2cfba6eea5b62735c789ed0cb879ca10a1936d72a967709f2ca9f63c7fe0a996df3c7291cf7
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- rust 1.65.0
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
- [![Dependency Status][5]](https://gemnasium.com/prometheus/prometheus-client-mmap)
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 (experimental)
54
+ ## Rust extension
38
55
 
39
- In an effort to improve maintainability, there is now an optional Rust
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. If `rustc` is available, then the Rust extension will
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 can
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
- To use it add this line to your `configure` block:
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
- ###`bin/parse`
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.