yabeda-prometheus2influxdb 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/yabeda/prometheus2influxdb/version.rb +1 -1
- data/lib/yabeda/prometheus2influxdb.rb +7 -25
- data/yabeda-prometheus2influxdb.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1a7af6485a7f682b94f632ebcb1443f339d268d1a930d699b1bc6e0bde54503
|
4
|
+
data.tar.gz: d2c67473c04d0ff6a5195d6058fa540748eff0d7d5ea508bca0e41cf30365942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffcec5c4ef30f280586a00b18379994c23ff07500e15601dfdf78593c009796bc5222b9005fa36a9cafbff4e2fbb5e3168c370cbafaa628fc30826d6db07c259
|
7
|
+
data.tar.gz: 0020410b81275c0441b07d149998f0eb345cdc4a37fc59c31f7eec72dd7e4e7692d8624179a8e6b6bf2a262bc45146cc2064e81be7a8916fe893d557adfbeb04
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require "singleton"
|
4
4
|
|
5
5
|
require "influxdb"
|
6
|
-
require "yabeda/prometheus"
|
6
|
+
require "yabeda/prometheus/mmap"
|
7
7
|
|
8
8
|
require_relative "prometheus2influxdb/config"
|
9
9
|
require_relative "prometheus2influxdb/version"
|
@@ -22,12 +22,11 @@ module Yabeda
|
|
22
22
|
instance.config.configured?
|
23
23
|
end
|
24
24
|
|
25
|
-
attr_reader :influxdb_client, :
|
25
|
+
attr_reader :influxdb_client, :instance_label, :config
|
26
26
|
|
27
27
|
def initialize
|
28
28
|
@config = Config.new
|
29
29
|
@influxdb_client = ::InfluxDB::Client.new(**config.to_h)
|
30
|
-
@registry = Yabeda::Prometheus.registry
|
31
30
|
@instance_label = "#{Socket.gethostname}##{Process.pid}"
|
32
31
|
end
|
33
32
|
|
@@ -46,30 +45,13 @@ module Yabeda
|
|
46
45
|
private
|
47
46
|
|
48
47
|
def prepare_points
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
tags = tags.merge(instance
|
53
|
-
|
54
|
-
when ::Prometheus::Client::Counter, ::Prometheus::Client::Gauge
|
55
|
-
{ series: series, tags: tags, values: { value: value } }
|
56
|
-
when ::Prometheus::Client::Histogram
|
57
|
-
histogram_points(series, tags, value)
|
58
|
-
else
|
59
|
-
raise NotImplementedError, "#{metric.class} isn't supported for exporting to InfluxDB yet"
|
60
|
-
end
|
48
|
+
metrics = ::Prometheus::Client::Formats::Text.send(:load_metrics, ::Prometheus::Client.configuration.multiprocess_files_dir)
|
49
|
+
metrics.map do |_, samples:, **|
|
50
|
+
samples.map do |series, tags, value|
|
51
|
+
tags = Hash[tags].merge("instance" => instance_label)
|
52
|
+
{ series: series, tags: tags, values: { value: value } }
|
61
53
|
end
|
62
54
|
end.flatten
|
63
55
|
end
|
64
|
-
|
65
|
-
def histogram_points(name, tags, bucketed_values)
|
66
|
-
bucketed_values.map do |bucket, value|
|
67
|
-
if bucket == "sum"
|
68
|
-
{ series: "#{name}_sum", tags: tags, values: { value: value } }
|
69
|
-
else
|
70
|
-
{ series: "#{name}_bucket", tags: tags.merge("le" => bucket), values: { value: value } }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
56
|
end
|
75
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-prometheus2influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: yabeda-prometheus
|
42
|
+
name: yabeda-prometheus-mmap
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|