circuitry-seismograph 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/circle.yml +7 -0
- data/circuitry-seismograph.gemspec +30 -0
- data/lib/circuitry/middleware/seismograph.rb +34 -0
- data/lib/circuitry/seismograph.rb +8 -0
- data/lib/circuitry/seismograph/version.rb +5 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4231c34e973ea6aa2bcd8652fd18af0a6cff6b7f
|
4
|
+
data.tar.gz: 2ba8f3fe7e313fe05b1debf59c7e0d2f86473a67
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 11422abfdfa9f09ca5bf4c1369595d56966d8c8887d07ac808f004cca37f0696316b6e60c384cc13c74380dce980956ad902c78fe179d6dccd18b7981a1ed773
|
7
|
+
data.tar.gz: 785a20c374f6f9f9b716d15ef087238bad2e79e1b8a1eaf0db990849ec89ddc2ce2136b621ba27fa3e5f10f8cdcf1979fd76c1ae19e7f3fdf7e23e2b103595df
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Kapost
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# circuitry-seismograph
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/kapost/circuitry-seismograph)
|
4
|
+
[](https://codeclimate.com/github/kapost/circuitry-seismograph/coverage)
|
5
|
+
|
6
|
+
Adds [circuitry](https://github.com/kapost/circuitry) publisher & subscriber middlewares for
|
7
|
+
tracking message processing via [DataDog](https://www.datadoghq.com/).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'circuitry-seismograph'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install circuitry-seismograph
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
By default, this will track to DataDog within the `<app_name>.circuitry.publisher` and
|
28
|
+
`<app_name>.circuitry.subscriber` metric key/namespace when publishing or subscribed to receive
|
29
|
+
messages, respectively. You can override these options by providing custom `:namespace` (required)
|
30
|
+
and `:stat` (optional) options to the middleware entry. For example:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Circuitry.config do |config|
|
34
|
+
config.publisher_middleware.add Circuitry::Middleware::Seismograph, namespace: 'messages', stat: 'pub'
|
35
|
+
config.subscriber_middleware.add Circuitry::Middleware::Seismograph, namespace: 'messages', stat: 'sub'
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
Similarly, you can remove the middleware from either one of these via the `#remove` method per the
|
40
|
+
[circuitry documentation](https://github.com/kapost/circuitry#middleware).
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run
|
45
|
+
the tests. You can also run `bin/console` for an interactive prompt that will allow you to
|
46
|
+
experiment.
|
47
|
+
|
48
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new
|
49
|
+
version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
|
50
|
+
will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
51
|
+
[rubygems.org](https://rubygems.org).
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kapost/circuitry-seismograph.
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'circuitry/seismograph'
|
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
data/circle.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'circuitry/seismograph/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'circuitry-seismograph'
|
8
|
+
spec.version = Circuitry::Seismograph::VERSION
|
9
|
+
spec.authors = ['Matt Huggins']
|
10
|
+
spec.email = ['matt.huggins@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Circuitry middleware for DataDog tracking}
|
13
|
+
spec.description = %q{Adds circuitry middleware for tracking message processing to DataDog.}
|
14
|
+
spec.homepage = 'https://github.com/kapost/circuitry-seismograph'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'circuitry', '~> 2.1.0'
|
23
|
+
spec.add_dependency 'seismograph', '~> 0.3.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
26
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2.0'
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'seismograph'
|
2
|
+
|
3
|
+
module Circuitry
|
4
|
+
module Middleware
|
5
|
+
class Seismograph
|
6
|
+
attr_reader :namespace, :stat
|
7
|
+
|
8
|
+
def initialize(options = {})
|
9
|
+
self.namespace = options.fetch(:namespace, 'circuitry')
|
10
|
+
self.stat = options.fetch(:stat)
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(topic, _message, &block)
|
14
|
+
tags = ["topic:#{topic}"]
|
15
|
+
sensor.benchmark(stat, tags: tags, &block)
|
16
|
+
rescue StandardError => err
|
17
|
+
log.error('Circuitry message processing failed', description: err.message, tags: tags)
|
18
|
+
raise err
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_writer :namespace, :stat
|
24
|
+
|
25
|
+
def sensor
|
26
|
+
@sensor ||= ::Seismograph::Sensor.new(namespace)
|
27
|
+
end
|
28
|
+
|
29
|
+
def log
|
30
|
+
@log ||= ::Seismograph::Log
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'circuitry/seismograph/version'
|
2
|
+
require 'circuitry/middleware/seismograph'
|
3
|
+
require 'circuitry'
|
4
|
+
|
5
|
+
Circuitry.config do |config|
|
6
|
+
config.publisher_middleware.add Circuitry::Middleware::Seismograph, stat: 'publisher'
|
7
|
+
config.subscriber_middleware.add Circuitry::Middleware::Seismograph, stat: 'subscriber'
|
8
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: circuitry-seismograph
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Huggins
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: circuitry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: seismograph
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codeclimate-test-reporter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-its
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.2.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.2.0
|
111
|
+
description: Adds circuitry middleware for tracking message processing to DataDog.
|
112
|
+
email:
|
113
|
+
- matt.huggins@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- bin/console
|
125
|
+
- bin/setup
|
126
|
+
- circle.yml
|
127
|
+
- circuitry-seismograph.gemspec
|
128
|
+
- lib/circuitry/middleware/seismograph.rb
|
129
|
+
- lib/circuitry/seismograph.rb
|
130
|
+
- lib/circuitry/seismograph/version.rb
|
131
|
+
homepage: https://github.com/kapost/circuitry-seismograph
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.5.1
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: Circuitry middleware for DataDog tracking
|
155
|
+
test_files: []
|