protobuf-opentracing 1.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ba46382e175568ef4fb9659969e9815c4297106c3dd7ded16dab26db71a1f735
4
+ data.tar.gz: bc86bdf97410e171c6b95956ebfbe78de877ce0b745765a05aab5cc81b80dfc8
5
+ SHA512:
6
+ metadata.gz: f4ca63dd32351de5aeb6b25d7ff8590a8bbbaaeb9874ca24c3bb0a39a48876908dd7ac682ef1922eca65183272aa3fe1e750e7a286399a59673c13b863a7fb2a
7
+ data.tar.gz: 514210d90269d8b4cad7bd983cf75bcd215576b6a654618f766540517871aa6bc574dc741641ebc022741104300a3d6c22e8229e4a1e0474946f973b6e985a85
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # lockfile
11
+ Gemfile.lock
12
+
13
+ # local rspec config
14
+ .rspec-local
15
+
16
+ # rspec failure tracking
17
+ .rspec_status
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,23 @@
1
+ cache:
2
+ paths:
3
+ - vendor
4
+
5
+ stages:
6
+ - test
7
+
8
+ before_script:
9
+ - gem update --system
10
+ - gem install bundler --no-doc --version "< 2"
11
+ - bundle install --jobs=2 --retry=3
12
+
13
+ .test-specific-version: &test-specific-version
14
+ image: "${CI_BUILD_NAME}"
15
+ stage: test
16
+ script:
17
+ - bundle exec rake
18
+
19
+ jruby:9.1.7.0:
20
+ <<: *test-specific-version
21
+
22
+ ruby:2.3.1:
23
+ <<: *test-specific-version
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
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/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in protobuf-opentracing.gemspec
6
+ gemspec
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,43 @@
1
+ # Protobuf::Opentracing
2
+
3
+ Add service to service tracing with Opentracing.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'protobuf-opentracing'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install protobuf-opentracing
20
+
21
+ ## Usage
22
+
23
+ When laoded, this gem injects middleware into the RPC client flow which will
24
+ decode tracing information and start a new active span. See the
25
+ [`opentracing`](https://rubygems.org/gems/opentracing/) gem for additional
26
+ information.
27
+
28
+ ## Development
29
+
30
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
31
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
32
+ prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To
35
+ release a new version, update the version number in `version.rb`, and then run
36
+ `bundle exec rake release`, which will create a git tag for the version, push
37
+ git commits and tags, and push the `.gem` file to
38
+ [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome at
43
+ https://github.com/mxenabled/protobuf-opentracing.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "rubocop/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ desc "Run RuboCop"
8
+ task :rubocop do
9
+ RuboCop::RakeTask.new
10
+ end
11
+
12
+ task :default => [:rubocop, :spec]
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "protobuf/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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ require "active_support"
2
+
3
+ require "protobuf/opentracing/version"
4
+ require "protobuf/opentracing/request_decoder"
5
+
6
+ module Protobuf
7
+ module Opentracing
8
+ end
9
+ end
10
+
11
+ ::ActiveSupport.on_load(:protobuf_rpc_middleware) do |rpc|
12
+ rpc.middleware.insert_after(::Protobuf::Rpc::Middleware::RequestDecoder, ::Protobuf::Opentracing::RequestDecoder)
13
+ end
@@ -0,0 +1,34 @@
1
+ module Protobuf
2
+ module Opentracing
3
+ class RequestDecoder
4
+ attr_reader :app, :env
5
+
6
+ def initialize(app)
7
+ @app = app
8
+ end
9
+
10
+ def call(env)
11
+ operation = "#{env.service_name}##{env.method_name}"
12
+ headers = request_headers(env)
13
+ parent = ::OpenTracing.extract(::OpenTracing::FORMAT_TEXT_MAP, headers)
14
+ options = {}
15
+ options[:child_of] = parent unless parent.nil?
16
+ result = nil
17
+
18
+ ::OpenTracing.start_active_span(operation, options) do
19
+ result = app.call(env)
20
+ end
21
+
22
+ result
23
+ end
24
+
25
+ def request_headers(env)
26
+ return nil if env.request_wrapper.nil?
27
+ env.request_wrapper.headers.reduce({}) do |ctx, header|
28
+ ctx[header.key] = header.value
29
+ ctx
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ module Protobuf
2
+ module Opentracing
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "protobuf/opentracing/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "protobuf-opentracing"
8
+ spec.version = Protobuf::Opentracing::VERSION
9
+ spec.authors = ["Marcos Minond"]
10
+ spec.email = ["minond.marcos@gmail.com"]
11
+
12
+ spec.summary = "Add service to service tracing with Opentracing."
13
+ spec.description = "Add service to service tracing with Opentracing."
14
+ spec.homepage = "https://github.com/mxenabled/protobuf-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
+ # Hack, as Rails 5 requires Ruby version >= 2.2.2.
27
+ active_support_max_version = "< 5" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2.2")
28
+ spec.add_dependency "activesupport", ">= 3.2", active_support_max_version
29
+ spec.add_dependency "opentracing"
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.16"
32
+ spec.add_development_dependency "mad_rubocop"
33
+ spec.add_development_dependency "pry"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: protobuf-opentracing
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marcos Minond
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: opentracing
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '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'
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.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
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: pry
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: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ description: Add service to service tracing with Opentracing.
112
+ email:
113
+ - minond.marcos@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".gitlab-ci.yml"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - Gemfile
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - lib/protobuf/opentracing.rb
129
+ - lib/protobuf/opentracing/request_decoder.rb
130
+ - lib/protobuf/opentracing/version.rb
131
+ - protobuf-opentracing.gemspec
132
+ homepage: https://github.com/mxenabled/protobuf-opentracing
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubygems_version: 3.0.2
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Add service to service tracing with Opentracing.
155
+ test_files: []