meter 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/meter/backends/datadog.rb +2 -2
- data/lib/meter/backends/json_log.rb +7 -3
- data/lib/meter/metric/log.rb +17 -0
- data/lib/meter/version.rb +1 -2
- data/lib/meter.rb +7 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49b88e1042ae098d5a6f155f43a8b56cf07f3309
|
4
|
+
data.tar.gz: be9549ae95fe98d1a193bc20883e5a079c07d911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a90c89c3f78075dc68e96f32a82b4c62d777ffb3297ef721f2e61f7ac614f1c9010472aca2a253a0d08fc10c57ef1705690db665c9d11b6c93a843e4bc19bca
|
7
|
+
data.tar.gz: dc334243bb9fa5d724730599ac9247f5851a111eadb6aec7b272477e21e57fc2a2023e5cd8cb6162395514ab8dad773bcd639658f0a4c2d5c598bf9eae8a4d10
|
@@ -5,7 +5,7 @@ module Meter
|
|
5
5
|
class Datadog < ::Meter::Backends::Statsd
|
6
6
|
|
7
7
|
def self.supported_metrics
|
8
|
-
[:counter, :gauge, :timing, :histogram]
|
8
|
+
[:log, :counter, :gauge, :timing, :histogram]
|
9
9
|
end
|
10
10
|
|
11
11
|
def convert_to_backend_format(metric)
|
@@ -19,7 +19,7 @@ module Meter
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def statsd_type(metric)
|
22
|
-
types = {counter: 'c', gauge: 'g', timing: 'ms', histogram: 'h'}
|
22
|
+
types = {log: 'c', counter: 'c', gauge: 'g', timing: 'ms', histogram: 'h'}
|
23
23
|
types[metric.type]
|
24
24
|
end
|
25
25
|
|
@@ -5,15 +5,19 @@ module Meter
|
|
5
5
|
class JsonLog < ::Meter::Backends::Base
|
6
6
|
|
7
7
|
def self.supported_metrics
|
8
|
-
[:
|
8
|
+
[:log]
|
9
9
|
end
|
10
10
|
|
11
11
|
def convert_to_backend_format(metric)
|
12
|
-
{
|
12
|
+
{
|
13
|
+
statname: metric.name,
|
14
|
+
metric_type: metric.type,
|
15
|
+
metric_value: metric.value
|
16
|
+
}.merge(metric.data).merge(metric.tags)
|
13
17
|
end
|
14
18
|
|
15
19
|
def output_data(data)
|
16
|
-
log_file.open('a') { |f| f.puts(JSON.dump
|
20
|
+
log_file.open('a') { |f| f.puts(JSON.dump(data)) }
|
17
21
|
end
|
18
22
|
|
19
23
|
private
|
data/lib/meter/version.rb
CHANGED
data/lib/meter.rb
CHANGED
@@ -9,6 +9,7 @@ require 'meter/metric/base'
|
|
9
9
|
require 'meter/metric/counter'
|
10
10
|
require 'meter/metric/gauge'
|
11
11
|
require 'meter/metric/histogram'
|
12
|
+
require 'meter/metric/log'
|
12
13
|
require 'meter/metric/timing'
|
13
14
|
require 'meter/rails/middleware'
|
14
15
|
require "meter/rails/railtie" if defined?(Rails::Railtie)
|
@@ -22,11 +23,14 @@ module Meter
|
|
22
23
|
rescue => exception
|
23
24
|
::Meter.config.logger.error exception.inspect
|
24
25
|
end
|
25
|
-
alias :track :increment
|
26
26
|
|
27
|
-
def log(key,
|
28
|
-
|
27
|
+
def log(key, tags: {}, data: {})
|
28
|
+
metric = Metric::Log.new(name: key, value: 1, sample_rate: 1, tags: tags, data: data)
|
29
|
+
send_metric_to_backends(metric)
|
30
|
+
rescue => exception
|
31
|
+
::Meter.config.logger.error exception.inspect
|
29
32
|
end
|
33
|
+
alias :track :log
|
30
34
|
|
31
35
|
def gauge(key, value, sample_rate: 1, tags: {}, data: {})
|
32
36
|
metric = Metric::Gauge.new(name: key, value: value, sample_rate: sample_rate, tags: tags, data: data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: useragent
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/meter/metric/counter.rb
|
117
117
|
- lib/meter/metric/gauge.rb
|
118
118
|
- lib/meter/metric/histogram.rb
|
119
|
+
- lib/meter/metric/log.rb
|
119
120
|
- lib/meter/metric/timing.rb
|
120
121
|
- lib/meter/rails/controller_instrumentation.rb
|
121
122
|
- lib/meter/rails/middleware.rb
|
@@ -143,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
144
|
version: '0'
|
144
145
|
requirements: []
|
145
146
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.5.1
|
147
148
|
signing_key:
|
148
149
|
specification_version: 4
|
149
150
|
summary: A generic abstraction layer for fire and forgetting measurements via UDP.
|
150
151
|
test_files: []
|
151
|
-
has_rdoc:
|