pliny-librato 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +60 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/pliny/librato.rb +7 -0
- data/lib/pliny/librato/metrics/backend.rb +42 -0
- data/lib/pliny/librato/version.rb +5 -0
- data/pliny-librato.gemspec +32 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4537379850b2cbc3f82de6883462bb90cb8090eb
|
4
|
+
data.tar.gz: a08dd1d9657a788b8374fa6f58d3c9346c6f752b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9bc278ff5bf2168b479c5d559258dc02288d1b890c9f6692fc406e1d443e88fb318d07d00c4c54799dd2efb338e40a732cbc7b84f02264a45ae05d9e854dfa46
|
7
|
+
data.tar.gz: d615ddbf8e1b126d3331d299b43c993ace653bb9bb840bdcfa7d6b086351b64fae214150f9621267f7add7ba86774fcfa380c4194e9c08bab20a40a6b624be1b
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pliny-librato (0.1.0)
|
5
|
+
concurrent-ruby (~> 1.0)
|
6
|
+
librato-metrics (~> 2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
aggregate (0.2.2)
|
12
|
+
byebug (9.0.6)
|
13
|
+
coderay (1.1.1)
|
14
|
+
concurrent-ruby (1.0.2)
|
15
|
+
diff-lcs (1.2.5)
|
16
|
+
faraday (0.10.0)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
librato-metrics (2.0.2)
|
19
|
+
aggregate (~> 0.2.2)
|
20
|
+
faraday
|
21
|
+
method_source (0.8.2)
|
22
|
+
multipart-post (2.0.0)
|
23
|
+
pry (0.10.4)
|
24
|
+
coderay (~> 1.1.0)
|
25
|
+
method_source (~> 0.8.1)
|
26
|
+
slop (~> 3.4)
|
27
|
+
pry-byebug (3.4.1)
|
28
|
+
byebug (~> 9.0)
|
29
|
+
pry (~> 0.10)
|
30
|
+
rake (10.5.0)
|
31
|
+
rspec (3.5.0)
|
32
|
+
rspec-core (~> 3.5.0)
|
33
|
+
rspec-expectations (~> 3.5.0)
|
34
|
+
rspec-mocks (~> 3.5.0)
|
35
|
+
rspec-core (3.5.4)
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-expectations (3.5.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.5.0)
|
40
|
+
rspec-mocks (3.5.0)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.5.0)
|
43
|
+
rspec-support (3.5.0)
|
44
|
+
slop (3.6.0)
|
45
|
+
timecop (0.8.1)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
bundler (~> 1.13)
|
52
|
+
pliny-librato!
|
53
|
+
pry
|
54
|
+
pry-byebug
|
55
|
+
rake (~> 10.0)
|
56
|
+
rspec (~> 3.3)
|
57
|
+
timecop (~> 0.8.1)
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
1.13.6
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Pliny Librato
|
2
|
+
|
3
|
+
A [Librato](https://librato.com) metrics reporter backend for [pliny](https://github.com/interagent/pliny).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "pliny-librato"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install pliny-librato
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Add a new initializer `config/initializers/librato.rb`:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Librato::Metrics.authenticate(Config.librato_email, Config.librato_key)
|
27
|
+
Pliny::Metrics.backends << Pliny::Librato::Metrics::Backend.new(source: "myapp.production")
|
28
|
+
```
|
29
|
+
|
30
|
+
Now `Pliny::Metrics` methods send directly to Librato:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Pliny::Metrics.count(:foo, 3)
|
34
|
+
Pliny::Metrics.measure(:bar) do
|
35
|
+
# Some stuff you want to time
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
## Development
|
40
|
+
|
41
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
42
|
+
|
43
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pliny-librato.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pliny/librato"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require "librato/metrics"
|
2
|
+
require "concurrent"
|
3
|
+
|
4
|
+
module Pliny::Librato
|
5
|
+
module Metrics
|
6
|
+
class Backend
|
7
|
+
include Concurrent::Async
|
8
|
+
|
9
|
+
def initialize(source: nil)
|
10
|
+
super()
|
11
|
+
@source = source
|
12
|
+
end
|
13
|
+
|
14
|
+
def report_counts(counts)
|
15
|
+
self.async._report_counts(counts)
|
16
|
+
end
|
17
|
+
|
18
|
+
def report_measures(measures)
|
19
|
+
self.async._report_measures(measures)
|
20
|
+
end
|
21
|
+
|
22
|
+
def _report_counts(counts)
|
23
|
+
::Librato::Metrics.submit(expand(:counter, counts))
|
24
|
+
end
|
25
|
+
|
26
|
+
def _report_measures(measures)
|
27
|
+
::Librato::Metrics.submit(expand(:gauge, measures))
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :librato_client, :source
|
33
|
+
|
34
|
+
def expand(type, metrics)
|
35
|
+
metrics.reduce({}) do |mets, (k, v)|
|
36
|
+
mets[k] = { type: type, value: v, source: source }
|
37
|
+
mets
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pliny/librato/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pliny-librato"
|
8
|
+
spec.version = Pliny::Librato::VERSION
|
9
|
+
spec.authors = ["Andrew Appleton", "Josh W Lewis"]
|
10
|
+
spec.email = "andysapple@gmail.com"
|
11
|
+
|
12
|
+
spec.summary = %q{A Librato metrics reporter backend for pliny}
|
13
|
+
spec.homepage = "https://github.com/appleton/pliny-librato"
|
14
|
+
|
15
|
+
spec.licenses = ["MIT"]
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "librato-metrics", "~> 2.0"
|
24
|
+
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
27
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
28
|
+
spec.add_development_dependency "pry-byebug", "~> 3.4"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.3"
|
31
|
+
spec.add_development_dependency "timecop", "~> 0.8.1"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pliny-librato
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Appleton
|
8
|
+
- Josh W Lewis
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: librato-metrics
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '2.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '2.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: concurrent-ruby
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.13'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.13'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: pry
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.10'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.10'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: pry-byebug
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.4'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.4'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '10.0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '10.0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rspec
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '3.3'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '3.3'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: timecop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.8.1
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.1
|
126
|
+
description:
|
127
|
+
email: andysapple@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".rspec"
|
133
|
+
- Gemfile
|
134
|
+
- Gemfile.lock
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- bin/console
|
138
|
+
- bin/setup
|
139
|
+
- lib/pliny/librato.rb
|
140
|
+
- lib/pliny/librato/metrics/backend.rb
|
141
|
+
- lib/pliny/librato/version.rb
|
142
|
+
- pliny-librato.gemspec
|
143
|
+
homepage: https://github.com/appleton/pliny-librato
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.5.1
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: A Librato metrics reporter backend for pliny
|
167
|
+
test_files: []
|