action_subscriber-opentracing 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +15 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +12 -0
- data/action_subscriber-opentracing.gemspec +35 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/action_subscriber/opentracing/middleware.rb +29 -0
- data/lib/action_subscriber/opentracing/version.rb +5 -0
- data/lib/action_subscriber/opentracing.rb +7 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c5908b8849827b7537347ac4d3f9fb010d1e08fcae03ee8b0bda2e3193351241
|
4
|
+
data.tar.gz: 412e9832f44977c0f1b30cb0e97bfafea60c0ecc978780bb8d99e7c5ada675de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f42099792162f5f856a37302ad11e78ee9c5c05cb9a013b57821dd89f94c6d7e610511afc91b73f140faca6af1051e0a9fd819f3b22012a26646682f3f9411f
|
7
|
+
data.tar.gz: 731ee63d9ac97d047573f480a977421965b3a366301229b4d4c2c23c319eb4883c834f622f6664ebc6bd2897dd50f9117e43872321c38b68493a53ec71ba70b6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Styles are inherited from Mad Rubocop
|
2
|
+
|
3
|
+
inherit_gem:
|
4
|
+
mad_rubocop: .rubocop.yml
|
5
|
+
|
6
|
+
# Styles that are modified from the defaults
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.3
|
9
|
+
|
10
|
+
Style/BlockDelimiters:
|
11
|
+
Description: >-
|
12
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
13
|
+
always ugly).
|
14
|
+
Prefer {...} over do...end for single-line blocks.
|
15
|
+
StyleGuide: 'https://git.moneydesktop.com/dev/ruby-style-guide#single-line-blocks'
|
16
|
+
Exclude:
|
17
|
+
- 'spec/**/*'
|
18
|
+
|
19
|
+
Style/HashSyntax:
|
20
|
+
Description: >-
|
21
|
+
Prefer Ruby 1.8 hash syntax { :a => 1, :b => 2 }
|
22
|
+
over 1.9 syntax { a: 1, b: 2 }.
|
23
|
+
StyleGuide: 'https://git.moneydesktop.com/dev/ruby-style-guide#hash-literals'
|
24
|
+
EnforcedStyle: hash_rockets
|
25
|
+
Exclude:
|
26
|
+
- 'Gemfile'
|
27
|
+
|
28
|
+
Layout/SpaceAroundOperators:
|
29
|
+
Exclude:
|
30
|
+
- 'mx-connection_status.gemspec'
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Marcos Minond
|
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,51 @@
|
|
1
|
+
# ActionSubscriber::OpenTracing
|
2
|
+
|
3
|
+
Tracing for ActionSubscriber
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'action_subscriber-opentracing'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install action_subscriber-opentracing
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
After you have initialized the OpenTracing gem, simply add the middleware
|
24
|
+
provided by this gem to `ActionSubscriber`'s middleware stack and you're good
|
25
|
+
to go:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
::ActionSubscriber.config.middleware.use(::ActionSubscriber::OpenTracing::Middleware)
|
29
|
+
```
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
34
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
35
|
+
prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
38
|
+
release a new version, update the version number in `version.rb`, and then run
|
39
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
40
|
+
git commits and tags, and push the `.gem` file to
|
41
|
+
[rubygems.org](https://rubygems.org).
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
Bug reports and pull requests are welcome on GitHub at
|
46
|
+
https://github.com/mxenabled/action_subscriber-opentracing.
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT
|
51
|
+
License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "action_subscriber/opentracing/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "action_subscriber-opentracing"
|
8
|
+
spec.version = ActionSubscriber::OpenTracing::VERSION
|
9
|
+
spec.authors = ["Marcos Minond"]
|
10
|
+
spec.email = ["minond.marcos@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "ActionSubscriber"
|
13
|
+
spec.description = "ActionSubscriber"
|
14
|
+
spec.homepage = "https://github.com/mxenabled/action_subscriber-opentracing"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "opentracing"
|
27
|
+
|
28
|
+
spec.add_development_dependency "action_subscriber", "~> 5.1.3"
|
29
|
+
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "mad_rubocop"
|
31
|
+
spec.add_development_dependency "opentracing_test_tracer"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "action_subscriber/opentracing"
|
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(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "opentracing"
|
2
|
+
|
3
|
+
module ActionSubscriber
|
4
|
+
module OpenTracing
|
5
|
+
class Middleware
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
operation = "#{env.subscriber}##{env.action}"
|
12
|
+
parent = ::OpenTracing.extract(::OpenTracing::FORMAT_TEXT_MAP, env.headers)
|
13
|
+
published_at = env.headers["published_at"]
|
14
|
+
|
15
|
+
options = {}
|
16
|
+
options[:references] = [::OpenTracing::Reference.follows_from(parent)] if parent
|
17
|
+
options[:tags] = {}
|
18
|
+
options[:tags]["routing_key"] = env.routing_key
|
19
|
+
options[:tags]["published_at"] = published_at if published_at
|
20
|
+
|
21
|
+
result = nil
|
22
|
+
::OpenTracing.start_active_span(operation, options) do
|
23
|
+
result = @app.call(env)
|
24
|
+
end
|
25
|
+
result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: action_subscriber-opentracing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcos Minond
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opentracing
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: action_subscriber
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.1.3
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.1.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mad_rubocop
|
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: opentracing_test_tracer
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
description: ActionSubscriber
|
126
|
+
email:
|
127
|
+
- minond.marcos@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- action_subscriber-opentracing.gemspec
|
141
|
+
- bin/console
|
142
|
+
- bin/setup
|
143
|
+
- lib/action_subscriber/opentracing.rb
|
144
|
+
- lib/action_subscriber/opentracing/middleware.rb
|
145
|
+
- lib/action_subscriber/opentracing/version.rb
|
146
|
+
homepage: https://github.com/mxenabled/action_subscriber-opentracing
|
147
|
+
licenses:
|
148
|
+
- MIT
|
149
|
+
metadata: {}
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubygems_version: 3.0.2
|
166
|
+
signing_key:
|
167
|
+
specification_version: 4
|
168
|
+
summary: ActionSubscriber
|
169
|
+
test_files: []
|