prometheus-client 0.11.0.pre.alpha.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -27
- data/lib/prometheus/client/data_stores/direct_file_store.rb +8 -4
- data/lib/prometheus/client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edc489cbe60b73d291c523b070bd74d361cf28e7c57193865bc8d8d88f8780ef
|
4
|
+
data.tar.gz: ec17c3fb9999a4ed475bfbfe3da3f931f0e66f319c9733ee787ddc40229e9059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1df07ee9b21d8596bfd191f0d4203cc5dddbcab8ea13ba0d7cf04e7a8708ed622488eb3fb70713abeea0555eecebe3380d1b14b2199b2b056f8cdea1d93ddac
|
7
|
+
data.tar.gz: 4d219fd0b8a5bec670597b3650c4a1be45bb635f83d8a03f6b659ef5ab44e85dcd19a9a977ac6839fbd922dba813a8653a542db9dbaf13c110ec4beedb33a129
|
data/README.md
CHANGED
@@ -271,7 +271,7 @@ is stored in a global Data Store object, rather than in the metric objects thems
|
|
271
271
|
(This "storage" is ephemeral, generally in-memory, it's not "long-term storage")
|
272
272
|
|
273
273
|
The main reason to do this is that different applications may have different requirements
|
274
|
-
for their metrics storage.
|
274
|
+
for their metrics storage. Applications running in pre-fork servers (like Unicorn, for
|
275
275
|
example), require a shared store between all the processes, to be able to report coherent
|
276
276
|
numbers. At the same time, other applications may not have this requirement but be very
|
277
277
|
sensitive to performance, and would prefer instead a simpler, faster store.
|
@@ -311,7 +311,7 @@ whether you want to report the `SUM`, `MAX` or `MIN` value observed across all p
|
|
311
311
|
For almost all other cases, you'd leave the default (`SUM`). More on this on the
|
312
312
|
*Aggregation* section below.
|
313
313
|
|
314
|
-
|
314
|
+
Custom stores may also accept extra parameters besides `:aggregation`. See the
|
315
315
|
documentation of each store for more details.
|
316
316
|
|
317
317
|
### Built-in stores
|
@@ -326,26 +326,46 @@ There are 3 built-in stores, with different trade-offs:
|
|
326
326
|
it's absolutely not thread safe.
|
327
327
|
- **DirectFileStore**: Stores data in binary files, one file per process and per metric.
|
328
328
|
This is generally the recommended store to use with pre-fork servers and other
|
329
|
-
"multi-process" scenarios.
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
329
|
+
"multi-process" scenarios. There are some important caveats to using this store, so
|
330
|
+
please read on the section below.
|
331
|
+
|
332
|
+
### `DirectFileStore` caveats and things to keep in mind
|
333
|
+
|
334
|
+
Each metric gets a file for each process, and manages its contents by storing keys and
|
335
|
+
binary floats next to them, and updating the offsets of those Floats directly. When
|
336
|
+
exporting metrics, it will find all the files that apply to each metric, read them,
|
337
|
+
and aggregate them.
|
338
|
+
|
339
|
+
**Aggregation of metrics**: Since there will be several files per metrics (one per process),
|
340
|
+
these need to be aggregated to present a coherent view to Prometheus. Depending on your
|
341
|
+
use case, you may need to control how this works. When using this store,
|
342
|
+
each Metric allows you to specify an `:aggregation` setting, defining how
|
343
|
+
to aggregate the multiple possible values we can get for each labelset. By default,
|
344
|
+
Counters, Histograms and Summaries are `SUM`med, and Gauges report all their values (one
|
345
|
+
for each process), tagged with a `pid` label. You can also select `SUM`, `MAX` or `MIN`
|
346
|
+
for your gauges, depending on your use case.
|
347
|
+
|
348
|
+
**Memory Usage**: When scraped by Prometheus, this store will read all these files, get all
|
349
|
+
the values and aggregate them. We have notice this can have a noticeable effect on memory
|
350
|
+
usage for your app. We recommend you test this in a realistic usage scenario to make sure
|
351
|
+
you won't hit any memory limits your app may have.
|
352
|
+
|
353
|
+
**Resetting your metrics on each run**: You should also make sure that the directory where
|
354
|
+
you store your metric files (specified when initializing the `DirectFileStore`) is emptied
|
355
|
+
when your app starts. Otherwise, each app run will continue exporting the metrics from the
|
356
|
+
previous run.
|
357
|
+
|
358
|
+
**Large numbers of files**: Because there is an individual file per metric and per process
|
359
|
+
(which is done to optimize for observation performance), you may end up with a large number
|
360
|
+
of files. We don't currently have a solution for this problem, but we're working on it.
|
361
|
+
|
362
|
+
**Performance**: Even though this store saves data on disk, it's still much faster than
|
363
|
+
would probably be expected, because the files are never actually `fsync`ed, so the store
|
364
|
+
never blocks while waiting for disk. The kernel's page cache is incredibly efficient in
|
365
|
+
this regard. If in doubt, check the benchmark scripts described in the documentation for
|
366
|
+
creating your own stores and run them in your particular runtime environment to make sure
|
367
|
+
this provides adequate performance.
|
368
|
+
|
349
369
|
|
350
370
|
### Building your own store, and stores other than the built-in ones.
|
351
371
|
|
@@ -364,16 +384,16 @@ If you are in a multi-process environment (such as pre-fork servers like Unicorn
|
|
364
384
|
process will probably keep their own counters, which need to be aggregated when receiving
|
365
385
|
a Prometheus scrape, to report coherent total numbers.
|
366
386
|
|
367
|
-
For Counters
|
387
|
+
For Counters, Histograms and quantile-less Summaries this is simply a matter of
|
368
388
|
summing the values of each process.
|
369
389
|
|
370
390
|
For Gauges, however, this may not be the right thing to do, depending on what they're
|
371
391
|
measuring. You might want to take the maximum or minimum value observed in any process,
|
372
|
-
rather than the sum of all of them.
|
373
|
-
value.
|
392
|
+
rather than the sum of all of them. By default, we export each process's individual
|
393
|
+
value, with a `pid` label identifying each one.
|
374
394
|
|
375
|
-
|
376
|
-
metric, to specify an `:aggregation` setting.
|
395
|
+
If these defaults don't work for your use case, you should use the `store_settings`
|
396
|
+
parameter when registering the metric, to specify an `:aggregation` setting.
|
377
397
|
|
378
398
|
```ruby
|
379
399
|
free_disk_space = registry.gauge(:free_disk_space_bytes,
|
@@ -18,10 +18,14 @@ module Prometheus
|
|
18
18
|
#
|
19
19
|
# In order to do this, each Metric needs an `:aggregation` setting, specifying how
|
20
20
|
# to aggregate the multiple possible values we can get for each labelset. By default,
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
# the highest value of all the processes / threads.
|
21
|
+
# Counters, Histograms and Summaries get `SUM`med, and Gauges will report `ALL`
|
22
|
+
# values, tagging each one with a `pid` label.
|
23
|
+
# For Gauges, it's also possible to set `SUM`, MAX` or `MIN` as aggregation, to get
|
24
|
+
# the highest / lowest value / or the sum of all the processes / threads.
|
25
|
+
#
|
26
|
+
# Before using this Store, please read the "`DirectFileStore` caveats and things to
|
27
|
+
# keep in mind" section of the main README in this repository. It includes a number
|
28
|
+
# of important things to keep in mind.
|
25
29
|
|
26
30
|
class DirectFileStore
|
27
31
|
class InvalidStoreSettingsError < StandardError; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Kochie
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: benchmark-ips
|
@@ -84,9 +84,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
92
|
rubygems_version: 2.7.6
|