opentracing-instrumented 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0edfcb7254451501779fb6281f339edd1e9d6b601921b0072d27bab43429de60
4
+ data.tar.gz: 8919fd533aea9bddd5ab6c82d1a5b61e8111891302fa93ca79c0bf30528b00ef
5
+ SHA512:
6
+ metadata.gz: e5f006fb02570ee6a8eb2c23876f463e12535593885f0c9f409700273f24e1a1b38eceedd2c2017a09bb814280472e4d4777c133c19ac127f550dff1f3c49bc0
7
+ data.tar.gz: bc954fc442f5b2fb9acd6f9cab6abbe6797aa6611d79ca4e563c6023bfb6b03bd1ba620f062db60c216886679293692881b2e5c778351b57fa9dc63aef3f2ee5
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.1
6
+ before_install: gem install bundler -v 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in opentracing-instrumented.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 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.
@@ -0,0 +1,83 @@
1
+ # Opentracing::Instrumented
2
+
3
+ OpenTracing instrumentation helpers.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "opentracing-instrumented"
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install opentracing-instrumented
21
+
22
+ ## Usage
23
+
24
+ Include the `OpenTracing::Instrumented` module in your class and call the
25
+ `traced` method with the methods you would like to start an span for. Each of
26
+ these methods will be called in an active span, where the operatioon will be
27
+ follow this format: `<class name>.<method name>`
28
+
29
+ ```ruby
30
+ class MyOwnCommand
31
+ include OpenTracing::Instrumented
32
+
33
+ traced :call, :helper1, :helper2
34
+
35
+ def call
36
+ helper1
37
+ helper2
38
+
39
+ :ok
40
+ end
41
+
42
+ def helper1
43
+ end
44
+
45
+ def helper2
46
+ end
47
+ end
48
+ ```
49
+
50
+ Executing the code in the sample above will result in the following trace:
51
+
52
+ ```text
53
+ <---------------------------------- parent span ---------------------------------->
54
+ <----------------------------- MyOwnCommand.call ---------------------------->
55
+ <------ MyOwnCommand.helper1 ------> <------ MyOwnCommand.helper2 ------>
56
+ ```
57
+
58
+ ## Development
59
+
60
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
61
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
62
+ prompt that will allow you to experiment.
63
+
64
+ To install this gem onto your local machine, run `bundle exec rake install`. To
65
+ release a new version, update the version number in `version.rb`, and then run
66
+ `bundle exec rake release`, which will create a git tag for the version, push
67
+ git commits and tags, and push the `.gem` file to
68
+ [rubygems.org](https://rubygems.org).
69
+
70
+ ## Contributing
71
+
72
+ Bug reports and pull requests are welcome on GitHub at
73
+ https://github.com/minond/ruby-opentracing-instrumented.
74
+
75
+
76
+ ## License
77
+
78
+ The gem is available as open source under the terms of the [MIT
79
+ License](https://opensource.org/licenses/MIT).
80
+
81
+ ---
82
+
83
+ [![Build Status](https://travis-ci.org/minond/ruby-opentracing-instrumented.svg?branch=master)](https://travis-ci.org/minond/ruby-opentracing-instrumented)
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "opentracing/instrumented"
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__)
@@ -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,35 @@
1
+ require "opentracing"
2
+ require "opentracing/instrumented/version"
3
+
4
+ module OpenTracing
5
+ module Instrumented
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ # Wraps a method and traces its call. The span's operation name will be
12
+ # <class name>.<method name>.
13
+ #
14
+ # @param [Array<Symbol>] method_name
15
+ def traced(*method_names)
16
+ proxy = Module.new
17
+
18
+ method_names.each do |method_name|
19
+ operation_name = "#{name}.#{method_name}"
20
+ proxy.define_method(method_name) do |*args, &block|
21
+ ret = nil
22
+
23
+ OpenTracing.start_active_span(operation_name) do
24
+ ret = super(*args, &block)
25
+ end
26
+
27
+ ret
28
+ end
29
+ end
30
+
31
+ prepend proxy
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ module OpenTracing
2
+ module Instrumented
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ require_relative "lib/opentracing/instrumented/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "opentracing-instrumented"
5
+ spec.version = OpenTracing::Instrumented::VERSION
6
+ spec.authors = ["Marcos Minond"]
7
+ spec.email = ["minond.marcos@gmail.com"]
8
+
9
+ spec.summary = %q{OpenTracing instrumentation helpers}
10
+ spec.description = %q{OpenTracing instrumentation helpers}
11
+ spec.homepage = "http://github.com/minond/ruby-opentracing-instrumented"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "http://github.com/minond/ruby-opentracing-instrumented"
17
+ spec.metadata["changelog_uri"] = "http://github.com/minond/ruby-opentracing-instrumented"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_runtime_dependency "opentracing"
29
+
30
+ spec.add_development_dependency "opentracing_test_tracer"
31
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opentracing-instrumented
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marcos Minond
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-05-03 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: opentracing_test_tracer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: OpenTracing instrumentation helpers
42
+ email:
43
+ - minond.marcos@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - lib/opentracing/instrumented.rb
58
+ - lib/opentracing/instrumented/version.rb
59
+ - opentracing-instrumented.gemspec
60
+ homepage: http://github.com/minond/ruby-opentracing-instrumented
61
+ licenses:
62
+ - MIT
63
+ metadata:
64
+ homepage_uri: http://github.com/minond/ruby-opentracing-instrumented
65
+ source_code_uri: http://github.com/minond/ruby-opentracing-instrumented
66
+ changelog_uri: http://github.com/minond/ruby-opentracing-instrumented
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.3.0
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubygems_version: 3.0.6
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: OpenTracing instrumentation helpers
86
+ test_files: []