opentracing-instrumentation 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/.BUNDLER_VERSION +1 -0
- data/.drone.jsonnet +35 -0
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +80 -0
- data/.rubocop.yml +36 -0
- data/.ruby-version +1 -0
- data/GEM_VERSION +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +11 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/opentracing/instrumentation.rb +23 -0
- data/lib/opentracing/instrumentation/common.rb +13 -0
- data/lib/opentracing/instrumentation/common/error_writer.rb +56 -0
- data/lib/opentracing/instrumentation/faraday.rb +10 -0
- data/lib/opentracing/instrumentation/faraday/response_logger.rb +76 -0
- data/lib/opentracing/instrumentation/faraday/trace_middleware.rb +202 -0
- data/lib/opentracing/instrumentation/mongo.rb +12 -0
- data/lib/opentracing/instrumentation/mongo/direct_sanitazer.rb +16 -0
- data/lib/opentracing/instrumentation/mongo/query_sanitazer.rb +84 -0
- data/lib/opentracing/instrumentation/mongo/trace_subscriber.rb +107 -0
- data/lib/opentracing/instrumentation/object_wrapper.rb +59 -0
- data/lib/opentracing/instrumentation/rack.rb +11 -0
- data/lib/opentracing/instrumentation/rack/http_tagger.rb +69 -0
- data/lib/opentracing/instrumentation/rack/trace_middleware.rb +94 -0
- data/lib/opentracing/instrumentation/redis.rb +18 -0
- data/lib/opentracing/instrumentation/redis/config.rb +40 -0
- data/lib/opentracing/instrumentation/redis/span_builder.rb +85 -0
- data/lib/opentracing/instrumentation/redis/tracing_driver_wrapper.rb +117 -0
- data/lib/opentracing/instrumentation/sidekiq.rb +17 -0
- data/lib/opentracing/instrumentation/sidekiq/client_middleware.rb +66 -0
- data/lib/opentracing/instrumentation/sidekiq/job_tagger.rb +61 -0
- data/lib/opentracing/instrumentation/sidekiq/server_middleware.rb +70 -0
- data/lib/opentracing/instrumentation/sinatra.rb +11 -0
- data/lib/opentracing/instrumentation/sinatra/trace_middleware.rb +64 -0
- data/lib/opentracing/instrumentation/thrift.rb +15 -0
- data/lib/opentracing/instrumentation/thrift/config.rb +24 -0
- data/lib/opentracing/instrumentation/thrift/traced_protocol.rb +145 -0
- data/lib/opentracing/instrumentation/thrift/traced_protocol_factory.rb +48 -0
- data/lib/opentracing/instrumentation/version.rb +7 -0
- data/opentracing-instrumentation.gemspec +40 -0
- metadata +255 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e1a7a960852d95f9a8810881bd4b74421330f569dec7d9a3ef801d6c07bfbb40
|
4
|
+
data.tar.gz: d32bfec69138f3b042fcbce34e396ff74252b6b8f8a25f4e89aaabdbd18d3f82
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a5d8d605d0866129d16c229137bb09916ebf31ee57e0d6e395cee12c8ede90cfe404c8558f4d17ff337fde04c891fd9da205a1e35ea13f6a26eb85f1db59420
|
7
|
+
data.tar.gz: 89cd9d2f5a466fa7163fcb60351446c228c639b85d15aa0f3b5601ed1e25781b7464eb3c23f309e5046b44077bad34e681071be7211f2cf1e369ea16c8bea1a7
|
data/.BUNDLER_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.4
|
data/.drone.jsonnet
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
local TestPipeline(os, arch, ruby_version) = {
|
2
|
+
kind: "pipeline",
|
3
|
+
type: "docker",
|
4
|
+
name: os + "_" + arch + "_ruby_" + ruby_version,
|
5
|
+
|
6
|
+
platform: {
|
7
|
+
os: os,
|
8
|
+
arch: arch,
|
9
|
+
},
|
10
|
+
|
11
|
+
steps: [
|
12
|
+
{
|
13
|
+
name: "tests",
|
14
|
+
image: "ruby:" + ruby_version + "-alpine",
|
15
|
+
commands: [
|
16
|
+
"apk add --update git ruby-dev build-base",
|
17
|
+
"gem install bundler:2.1.4",
|
18
|
+
"bundle",
|
19
|
+
"rake",
|
20
|
+
]
|
21
|
+
}
|
22
|
+
]
|
23
|
+
};
|
24
|
+
|
25
|
+
local TARGETS = [
|
26
|
+
{os: "linux", arch: "arm64", ruby_version: "2.4"},
|
27
|
+
{os: "linux", arch: "arm", ruby_version: "2.5"},
|
28
|
+
{os: "linux", arch: "arm", ruby_version: "2.6"},
|
29
|
+
{os: "linux", arch: "arm64", ruby_version: "2.7"},
|
30
|
+
];
|
31
|
+
|
32
|
+
[
|
33
|
+
TestPipeline(target.os, target.arch, target.ruby_version)
|
34
|
+
for target in TARGETS
|
35
|
+
]
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.rspec_status
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
stages:
|
2
|
+
- test
|
3
|
+
- publish
|
4
|
+
|
5
|
+
.test_shared: &test_shared
|
6
|
+
before_script:
|
7
|
+
- apk add --update
|
8
|
+
git
|
9
|
+
ruby-dev
|
10
|
+
build-base
|
11
|
+
|
12
|
+
- gem update --system
|
13
|
+
- gem install bundler --version $(cat .BUNDLER_VERSION)
|
14
|
+
|
15
|
+
- export BUNDLE_PATH=vendor/
|
16
|
+
- bundler install --jobs $(nproc)
|
17
|
+
- bundler update
|
18
|
+
|
19
|
+
- ruby --version
|
20
|
+
- gem --version
|
21
|
+
- bundler --version
|
22
|
+
|
23
|
+
script:
|
24
|
+
- bundle exec rake
|
25
|
+
|
26
|
+
test/2.4:
|
27
|
+
<<: *test_shared
|
28
|
+
stage: test
|
29
|
+
image: ruby:2.4-alpine
|
30
|
+
|
31
|
+
cache:
|
32
|
+
paths:
|
33
|
+
- vendor/ruby/2.4.0
|
34
|
+
|
35
|
+
test/2.5:
|
36
|
+
<<: *test_shared
|
37
|
+
stage: test
|
38
|
+
image: ruby:2.5-alpine
|
39
|
+
|
40
|
+
cache:
|
41
|
+
paths:
|
42
|
+
- vendor/ruby/2.5.0
|
43
|
+
|
44
|
+
test/2.6:
|
45
|
+
<<: *test_shared
|
46
|
+
stage: test
|
47
|
+
image: ruby:2.6-alpine
|
48
|
+
|
49
|
+
cache:
|
50
|
+
paths:
|
51
|
+
- vendor/ruby/2.6.0
|
52
|
+
|
53
|
+
test/2.7:
|
54
|
+
<<: *test_shared
|
55
|
+
stage: test
|
56
|
+
image: ruby:2.7-alpine
|
57
|
+
|
58
|
+
cache:
|
59
|
+
paths:
|
60
|
+
- vendor/ruby/2.7.0
|
61
|
+
|
62
|
+
publish:
|
63
|
+
stage: publish
|
64
|
+
image: ruby:2.7-alpine
|
65
|
+
only:
|
66
|
+
refs:
|
67
|
+
- /^v\d+\.\d+\.\d+$/
|
68
|
+
script:
|
69
|
+
- apk add --update git
|
70
|
+
|
71
|
+
- export SOURCE_GEM_VERSION=$(cat GEM_VERSION)
|
72
|
+
- test ${CI_COMMIT_TAG} == v${SOURCE_GEM_VERSION}
|
73
|
+
|
74
|
+
- export GEM_FILE_NAME="multiprotocol_thrift_rack_app-${CI_COMMIT_TAG}.gem"
|
75
|
+
- export GEM_FILE_PATH="pkg/${GEM_FILE_NAME}"
|
76
|
+
|
77
|
+
- mkdir -p pkg/
|
78
|
+
|
79
|
+
- gem build --output ${GEM_FILE_PATH}
|
80
|
+
- gem push ${GEM_FILE_PATH}
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
Layout/LineLength:
|
5
|
+
Max: 100
|
6
|
+
|
7
|
+
Style/TrailingCommaInHashLiteral:
|
8
|
+
EnforcedStyleForMultiline: comma
|
9
|
+
|
10
|
+
Style/TrailingCommaInArguments:
|
11
|
+
EnforcedStyleForMultiline: comma
|
12
|
+
|
13
|
+
Style/TrailingCommaInArrayLiteral:
|
14
|
+
EnforcedStyleForMultiline: comma
|
15
|
+
|
16
|
+
Style/HashEachMethods:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
Style/HashTransformKeys:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
Style/HashTransformValues:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
Style/RescueModifier:
|
26
|
+
Exclude:
|
27
|
+
- 'spec/**/*_spec.rb'
|
28
|
+
|
29
|
+
Metrics/BlockLength:
|
30
|
+
Exclude:
|
31
|
+
- 'spec/**/*_spec.rb'
|
32
|
+
- '*.gemspec'
|
33
|
+
|
34
|
+
RSpec/FilePath:
|
35
|
+
CustomTransform:
|
36
|
+
OpenTracing: opentracing
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.0
|
data/GEM_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
|
7
|
+
# Specify your gem's dependencies in opentracing-instrumentation.gemspec
|
8
|
+
gemspec
|
9
|
+
|
10
|
+
gem 'test-tracer',
|
11
|
+
github: 'michal-granec/ruby-test-tracer',
|
12
|
+
branch: 'update_opentracing_dependencies'
|
13
|
+
gem 'tracing-matchers',
|
14
|
+
github: 'c0va23/ruby-tracing-matchers',
|
15
|
+
branch: 'feature/michal-granec/ruby-test-tracer-compatibility'
|
16
|
+
|
17
|
+
group :development do
|
18
|
+
gem 'pry-byebug', '~> 3.8'
|
19
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/c0va23/ruby-tracing-matchers
|
3
|
+
revision: ffd1466261c0ec34b54794ec912a7801acde2f16
|
4
|
+
branch: feature/michal-granec/ruby-test-tracer-compatibility
|
5
|
+
specs:
|
6
|
+
tracing-matchers (1.3.0)
|
7
|
+
rspec (>= 2.0)
|
8
|
+
test-tracer (~> 1.1)
|
9
|
+
|
10
|
+
GIT
|
11
|
+
remote: https://github.com/michal-granec/ruby-test-tracer
|
12
|
+
revision: ecb41addfff91e9355879d676c8a0b153cace966
|
13
|
+
branch: update_opentracing_dependencies
|
14
|
+
specs:
|
15
|
+
test-tracer (1.2.1)
|
16
|
+
opentracing (~> 0.5.0)
|
17
|
+
|
18
|
+
PATH
|
19
|
+
remote: .
|
20
|
+
specs:
|
21
|
+
opentracing-instrumentation (0.1.0)
|
22
|
+
json (~> 2.0)
|
23
|
+
opentracing (~> 0.5.0)
|
24
|
+
|
25
|
+
GEM
|
26
|
+
remote: https://rubygems.org/
|
27
|
+
specs:
|
28
|
+
ast (2.4.0)
|
29
|
+
bson (4.8.0)
|
30
|
+
byebug (11.1.1)
|
31
|
+
coderay (1.1.2)
|
32
|
+
diff-lcs (1.3)
|
33
|
+
faraday (0.9.2)
|
34
|
+
multipart-post (>= 1.2, < 3)
|
35
|
+
jaro_winkler (1.5.4)
|
36
|
+
json (2.3.0)
|
37
|
+
method_source (0.9.2)
|
38
|
+
multipart-post (2.1.1)
|
39
|
+
opentracing (0.5.0)
|
40
|
+
parallel (1.19.1)
|
41
|
+
parser (2.7.0.3)
|
42
|
+
ast (~> 2.4.0)
|
43
|
+
pry (0.12.2)
|
44
|
+
coderay (~> 1.1.0)
|
45
|
+
method_source (~> 0.9.0)
|
46
|
+
pry-byebug (3.8.0)
|
47
|
+
byebug (~> 11.0)
|
48
|
+
pry (~> 0.10)
|
49
|
+
rack (2.2.2)
|
50
|
+
rainbow (3.0.0)
|
51
|
+
rake (10.5.0)
|
52
|
+
redis (3.3.5)
|
53
|
+
rexml (3.2.4)
|
54
|
+
rspec (3.9.0)
|
55
|
+
rspec-core (~> 3.9.0)
|
56
|
+
rspec-expectations (~> 3.9.0)
|
57
|
+
rspec-mocks (~> 3.9.0)
|
58
|
+
rspec-core (3.9.1)
|
59
|
+
rspec-support (~> 3.9.1)
|
60
|
+
rspec-expectations (3.9.0)
|
61
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
+
rspec-support (~> 3.9.0)
|
63
|
+
rspec-mocks (3.9.1)
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
+
rspec-support (~> 3.9.0)
|
66
|
+
rspec-support (3.9.2)
|
67
|
+
rubocop (0.80.0)
|
68
|
+
jaro_winkler (~> 1.5.1)
|
69
|
+
parallel (~> 1.10)
|
70
|
+
parser (>= 2.7.0.1)
|
71
|
+
rainbow (>= 2.2.2, < 4.0)
|
72
|
+
rexml
|
73
|
+
ruby-progressbar (~> 1.7)
|
74
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
75
|
+
rubocop-rspec (1.38.1)
|
76
|
+
rubocop (>= 0.68.1)
|
77
|
+
ruby-progressbar (1.10.1)
|
78
|
+
thrift (0.11.0.0)
|
79
|
+
unicode-display_width (1.6.1)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
ruby
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
bson (~> 4.0)
|
86
|
+
bundler (~> 2.1.4)
|
87
|
+
faraday (~> 0.9.2)
|
88
|
+
opentracing-instrumentation!
|
89
|
+
pry-byebug (~> 3.8)
|
90
|
+
rack (~> 2.2.2)
|
91
|
+
rake (~> 10.0)
|
92
|
+
redis (~> 3.3.5)
|
93
|
+
rspec (~> 3.0)
|
94
|
+
rubocop (~> 0.80.0)
|
95
|
+
rubocop-rspec (~> 1.38.1)
|
96
|
+
test-tracer!
|
97
|
+
thrift (~> 0.11.0)
|
98
|
+
tracing-matchers!
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Fedorenko Dmitrii
|
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,39 @@
|
|
1
|
+
# Opentracing::Instrumentation
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/opentracing/instrumentation`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'opentracing-instrumentation'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install opentracing-instrumentation
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/opentracing-instrumentation.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'opentracing/instrumentation'
|
7
|
+
|
8
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
9
|
+
# with your gem easier. You can also use a different console, if you like.
|
10
|
+
|
11
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
12
|
+
# require "pry"
|
13
|
+
# Pry.start
|
14
|
+
|
15
|
+
require 'irb'
|
16
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'opentracing/instrumentation/version'
|
4
|
+
|
5
|
+
module OpenTracing
|
6
|
+
# module OpenTracing::Instrumentation provide instrumentation modules for some
|
7
|
+
# popular Ruby gems.
|
8
|
+
#
|
9
|
+
# All instrumentations modules is lazy loaded (via autoload).
|
10
|
+
module Instrumentation
|
11
|
+
class Error < StandardError; end
|
12
|
+
|
13
|
+
autoload :ObjectWrapper, 'opentracing/instrumentation/object_wrapper'
|
14
|
+
autoload :Common, 'opentracing/instrumentation/common'
|
15
|
+
autoload :Rack, 'opentracing/instrumentation/rack'
|
16
|
+
autoload :Mongo, 'opentracing/instrumentation/mongo'
|
17
|
+
autoload :Faraday, 'opentracing/instrumentation/faraday'
|
18
|
+
autoload :Sinatra, 'opentracing/instrumentation/sinatra'
|
19
|
+
autoload :Thrift, 'opentracing/instrumentation/thrift'
|
20
|
+
autoload :Redis, 'opentracing/instrumentation/redis'
|
21
|
+
autoload :Sidekiq, 'opentracing/instrumentation/sidekiq'
|
22
|
+
end
|
23
|
+
end
|