yabeda 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.travis.yml +4 -4
- data/README.md +9 -1
- data/Rakefile +4 -1
- data/lib/yabeda.rb +16 -4
- data/lib/yabeda/base_adapter.rb +1 -0
- data/lib/yabeda/dsl.rb +12 -0
- data/lib/yabeda/gauge.rb +1 -1
- data/lib/yabeda/histogram.rb +2 -0
- data/lib/yabeda/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c30404230f234aefbf4f0f8341f276583b30f5cc9a75495e5c57e8acab23187
|
4
|
+
data.tar.gz: 980db126d071f8fe8c879798bbe35d5755819dd0384770dae7fe19d940f09840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20bf75e05040cc0ea26035422a4a64a5856ba683c0b98c81b756cc39311e41488972a57fca6174554d2d5175d85b7c5e59f5bd2375627cfb3756155cb31423ee
|
7
|
+
data.tar.gz: df6d12199c647f43858d0b6f73cd09ce1f7ab62b00190f251a7e37cbb17257b682fc844bbd65a03816c6c007e5757aef444637fcf410b65809dcccc96ae1a17a
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Yabeda
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/yabeda.svg)](https://rubygems.org/gems/yabeda) [![Build Status](https://travis-ci.org/yabeda-rb/yabeda.svg?branch=master)](https://travis-ci.org/yabeda-rb/yabeda)
|
4
|
+
|
3
5
|
**This software is Work in Progress: features will appear and disappear, API will be changed, your feedback is always welcome!**
|
4
6
|
|
5
|
-
|
7
|
+
Extendable solution for easy setup of monitoring in your Ruby apps.
|
8
|
+
|
9
|
+
<a href="https://evilmartians.com/?utm_source=yabeda&utm_campaign=project_page">
|
10
|
+
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
11
|
+
</a>
|
12
|
+
|
13
|
+
> Read more about Yabeda and the reasoning behind it in Martian Chronicles: [“Meet Yabeda: Modular framework for instrumenting Ruby applications”](https://evilmartians.com/chronicles/meet-yabeda-modular-framework-for-instrumenting-ruby-applications)
|
6
14
|
|
7
15
|
## Installation
|
8
16
|
|
data/Rakefile
CHANGED
data/lib/yabeda.rb
CHANGED
@@ -5,14 +5,26 @@ require "concurrent"
|
|
5
5
|
require "yabeda/version"
|
6
6
|
require "yabeda/dsl"
|
7
7
|
|
8
|
+
# Extendable framework for collecting and exporting metrics from Ruby apps
|
8
9
|
module Yabeda
|
9
10
|
include DSL
|
10
11
|
|
11
|
-
cattr_reader :metrics, default: Concurrent::Hash.new
|
12
|
-
cattr_reader :adapters, default: Concurrent::Hash.new
|
13
|
-
cattr_reader :collectors, default: Concurrent::Array.new
|
14
|
-
|
15
12
|
class << self
|
13
|
+
# @return [Hash<String, Yabeda::Metric>] All registered metrics
|
14
|
+
def metrics
|
15
|
+
@metrics ||= Concurrent::Hash.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Hash<String, Yabeda::BaseAdapter>] All loaded adapters
|
19
|
+
def adapters
|
20
|
+
@adapters ||= Concurrent::Hash.new
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Array<Proc>] All collectors for periodical retrieving of metrics
|
24
|
+
def collectors
|
25
|
+
@collectors ||= Concurrent::Array.new
|
26
|
+
end
|
27
|
+
|
16
28
|
# @param [Symbol] name
|
17
29
|
# @param [BaseAdapter] instance
|
18
30
|
def register_adapter(name, instance)
|
data/lib/yabeda/base_adapter.rb
CHANGED
data/lib/yabeda/dsl.rb
CHANGED
@@ -6,33 +6,44 @@ require "yabeda/gauge"
|
|
6
6
|
require "yabeda/histogram"
|
7
7
|
|
8
8
|
module Yabeda
|
9
|
+
# DSL for ease of work with Yabeda
|
9
10
|
module DSL
|
10
11
|
def self.included(base)
|
11
12
|
base.extend ClassMethods
|
12
13
|
end
|
13
14
|
|
15
|
+
# rubocop: disable Style/Documentation
|
14
16
|
module ClassMethods
|
17
|
+
# Block for grouping and simplifying configuration of related metrics
|
15
18
|
def configure(&block)
|
16
19
|
class_exec(&block)
|
17
20
|
@group = nil
|
18
21
|
end
|
19
22
|
|
23
|
+
# Define the actions that should be performed
|
20
24
|
def collect(&block)
|
21
25
|
::Yabeda.collectors.push(block)
|
22
26
|
end
|
23
27
|
|
28
|
+
# Specify metric category or group for all consecutive metrics in this
|
29
|
+
# +configure+ block.
|
30
|
+
# On most adapters it is only adds prefix to the metric name but on some
|
31
|
+
# (like NewRelic) it is treated individually and have special meaning.
|
24
32
|
def group(group_name)
|
25
33
|
@group = group_name
|
26
34
|
end
|
27
35
|
|
36
|
+
# Register a growing-only counter
|
28
37
|
def counter(*args, **kwargs)
|
29
38
|
register(Counter.new(*args, **kwargs, group: @group))
|
30
39
|
end
|
31
40
|
|
41
|
+
# Register a gauge
|
32
42
|
def gauge(*args, **kwargs)
|
33
43
|
register(Gauge.new(*args, **kwargs, group: @group))
|
34
44
|
end
|
35
45
|
|
46
|
+
# Register an histogram
|
36
47
|
def histogram(*args, **kwargs)
|
37
48
|
register(Histogram.new(*args, **kwargs, group: @group))
|
38
49
|
end
|
@@ -49,5 +60,6 @@ module Yabeda
|
|
49
60
|
metric
|
50
61
|
end
|
51
62
|
end
|
63
|
+
# rubocop: enable Style/Documentation
|
52
64
|
end
|
53
65
|
end
|
data/lib/yabeda/gauge.rb
CHANGED
data/lib/yabeda/histogram.rb
CHANGED
data/lib/yabeda/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|