opentracing 0.1.0 → 0.2.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,25 @@
1
+ module OpenTracing
2
+ # Carriers are used for inject and extract operations. A carrier should be a
3
+ # Hash or hash-like object. At a minimum, it should implement `[]`, `[]=`, and
4
+ # `each` shown here.
5
+ class Carrier
6
+ # [] retrieves a value by the given key
7
+ # @param key [String] key to retrieve the value
8
+ # @return [String] the desired value
9
+ def [](key)
10
+ end
11
+
12
+ # []= sets the value for the given key
13
+ # @param key [String] key to set
14
+ # @param value [String] value to set
15
+ def []=(key, value)
16
+ end
17
+
18
+ # each iterates over every key-value pair in the carrier
19
+ # @yield [key, value]
20
+ # @yieldparam key [String] the key of the tuple
21
+ # @yieldparam value [String] the value of the tuple
22
+ def each(&block)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,61 @@
1
+ module OpenTracing
2
+ # Span represents an OpenTracer Span
3
+ #
4
+ # See http://www.opentracing.io for more information.
5
+ class Span
6
+ NOOP_INSTANCE = Span.new.freeze
7
+
8
+ # Set the name of the operation
9
+ def operation_name=(name)
10
+ end
11
+
12
+ # Span Context
13
+ def context
14
+ SpanContext::NOOP_INSTANCE
15
+ end
16
+
17
+ # Creates a new {Span}
18
+ #
19
+ # @param tracer [Tracer] the tracer that created this span
20
+ # @param context [SpanContext] the context of the span
21
+ # @return [Span] a new Span
22
+ def initialize(tracer:, context:)
23
+ end
24
+
25
+ # Set a tag value on this span
26
+ # @param key [String] the key of the tag
27
+ # @param value [String, Numeric, Boolean] the value of the tag. If it's not
28
+ # a String, Numeric, or Boolean it will be encoded with to_s
29
+ def set_tag(key, value)
30
+ self
31
+ end
32
+
33
+ # Set a baggage item on the span
34
+ # @param key [String] the key of the baggage item
35
+ # @param value [String] the value of the baggage item
36
+ def set_baggage_item(key, value)
37
+ self
38
+ end
39
+
40
+ # Get a baggage item
41
+ # @param key [String] the key of the baggage item
42
+ # @return Value of the baggage item
43
+ def get_baggage_item(key)
44
+ nil
45
+ end
46
+
47
+ # Add a log entry to this span
48
+ # @param event [String] event name for the log
49
+ # @param timestamp [Time] time of the log
50
+ # @param fields [Hash] Additional information to log
51
+ def log(event: nil, timestamp: Time.now, **fields)
52
+ nil
53
+ end
54
+
55
+ # Finish the {Span}
56
+ # @param end_time [Time] custom end time, if not now
57
+ def finish(end_time: Time.now)
58
+ nil
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,15 @@
1
+ module OpenTracing
2
+ # SpanContext holds the data for a span that gets inherited to child spans
3
+ class SpanContext
4
+ NOOP_INSTANCE = SpanContext.new.freeze
5
+
6
+ attr_reader :baggage
7
+
8
+ # Create a new SpanContext
9
+ # @param id the ID of the Context
10
+ # @param trace_id the ID of the current trace
11
+ # @param baggage baggage
12
+ def initialize(baggage: {})
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,42 @@
1
+ module OpenTracing
2
+ class Tracer
3
+ # Start a new span
4
+ # @param operation_name [String] The name of the operation represented by the span
5
+ # @param child_of [Span] A span to be used as the ChildOf reference
6
+ # @param start_time [Time] the start time of the span
7
+ # @param tags [Hash] Starting tags for the span
8
+ def start_span(operation_name, child_of: nil, start_time: nil, tags: nil)
9
+ Span::NOOP_INSTANCE
10
+ end
11
+
12
+
13
+ # Inject a span into the given carrier
14
+ # @param span_context [SpanContext]
15
+ # @param format [OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK]
16
+ # @param carrier [Carrier]
17
+ def inject(span_context, format, carrier)
18
+ case format
19
+ when OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK
20
+ return nil
21
+ else
22
+ warn 'Unknown inject format'
23
+ end
24
+ end
25
+
26
+ # Extract a span from a carrier
27
+ # @param operation_name [String]
28
+ # @param format [OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK]
29
+ # @param carrier [Carrier]
30
+ # @param tracer [Tracer] the tracer the span will be attached to (for finish)
31
+ # @return [Span]
32
+ def extract(operation_name, format, carrier)
33
+ case format
34
+ when OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK
35
+ return Span::NOOP_INSTANCE
36
+ else
37
+ warn 'Unknown extract format'
38
+ nil
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,3 @@
1
+ module OpenTracing
2
+ VERSION = "0.2.0"
3
+ end
data/opentracing.gemspec CHANGED
@@ -1,61 +1,28 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: opentracing ruby lib
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'opentracing/version'
6
5
 
7
- Gem::Specification.new do |s|
8
- s.name = "opentracing"
9
- s.version = ""
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "opentracing"
8
+ spec.version = OpenTracing::VERSION
9
+ spec.authors = ["ngauthier", "bcronin", "bensigelman"]
10
+ spec.email = ["info@opentracing.io"]
10
11
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Dimitar Kostov"]
14
- s.date = "2016-12-12"
15
- s.description = "OpenTracing support for Ruby frameworks"
16
- s.email = "mitko.kostov@gmail.com"
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE",
26
- "README.md",
27
- "Rakefile",
28
- "lib/opentracing.rb",
29
- "test/helper.rb",
30
- "test/test_opentracing.rb"
31
- ]
32
- s.homepage = "http://github.com/mytrile/opentracing"
33
- s.licenses = ["MIT"]
34
- s.rubygems_version = "2.4.8"
35
- s.summary = "OpenTracing support for Ruby frameworks"
12
+ spec.summary = %q{OpenTracing Ruby Platform API}
13
+ spec.homepage = "https://github.com/opentracing/opentracing-ruby"
14
+ spec.license = "MIT"
36
15
 
37
- if s.respond_to? :specification_version then
38
- s.specification_version = 4
39
-
40
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
- s.add_development_dependency(%q<shoulda>, [">= 0"])
42
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
43
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
44
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
45
- s.add_development_dependency(%q<simplecov>, [">= 0"])
46
- else
47
- s.add_dependency(%q<shoulda>, [">= 0"])
48
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
49
- s.add_dependency(%q<bundler>, ["~> 1.0"])
50
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
51
- s.add_dependency(%q<simplecov>, [">= 0"])
52
- end
53
- else
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<bundler>, ["~> 1.0"])
57
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
58
- s.add_dependency(%q<simplecov>, [">= 0"])
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
59
18
  end
60
- end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
61
22
 
23
+ spec.add_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "minitest", "~> 5.0"
26
+ spec.add_development_dependency "simplecov"
27
+ spec.add_development_dependency "simplecov-console"
28
+ end
metadata CHANGED
@@ -1,73 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentracing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Dimitar Kostov
7
+ - ngauthier
8
+ - bcronin
9
+ - bensigelman
8
10
  autorequire:
9
- bindir: bin
11
+ bindir: exe
10
12
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
13
+ date: 2016-12-20 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
- name: shoulda
16
+ name: bundler
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - ">="
19
+ - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '0'
21
+ version: '1.13'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - ">="
26
+ - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
28
+ version: '1.13'
27
29
  - !ruby/object:Gem::Dependency
28
- name: rdoc
30
+ name: rake
29
31
  requirement: !ruby/object:Gem::Requirement
30
32
  requirements:
31
33
  - - "~>"
32
34
  - !ruby/object:Gem::Version
33
- version: '3.12'
35
+ version: '10.0'
34
36
  type: :development
35
37
  prerelease: false
36
38
  version_requirements: !ruby/object:Gem::Requirement
37
39
  requirements:
38
40
  - - "~>"
39
41
  - !ruby/object:Gem::Version
40
- version: '3.12'
42
+ version: '10.0'
41
43
  - !ruby/object:Gem::Dependency
42
- name: bundler
44
+ name: minitest
43
45
  requirement: !ruby/object:Gem::Requirement
44
46
  requirements:
45
47
  - - "~>"
46
48
  - !ruby/object:Gem::Version
47
- version: '1.0'
49
+ version: '5.0'
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - "~>"
53
55
  - !ruby/object:Gem::Version
54
- version: '1.0'
56
+ version: '5.0'
55
57
  - !ruby/object:Gem::Dependency
56
- name: jeweler
58
+ name: simplecov
57
59
  requirement: !ruby/object:Gem::Requirement
58
60
  requirements:
59
- - - "~>"
61
+ - - ">="
60
62
  - !ruby/object:Gem::Version
61
- version: 2.0.1
63
+ version: '0'
62
64
  type: :development
63
65
  prerelease: false
64
66
  version_requirements: !ruby/object:Gem::Requirement
65
67
  requirements:
66
- - - "~>"
68
+ - - ">="
67
69
  - !ruby/object:Gem::Version
68
- version: 2.0.1
70
+ version: '0'
69
71
  - !ruby/object:Gem::Dependency
70
- name: simplecov
72
+ name: simplecov-console
71
73
  requirement: !ruby/object:Gem::Requirement
72
74
  requirements:
73
75
  - - ">="
@@ -80,26 +82,31 @@ dependencies:
80
82
  - - ">="
81
83
  - !ruby/object:Gem::Version
82
84
  version: '0'
83
- description: OpenTracing support for Ruby frameworks
84
- email: mitko.kostov@gmail.com
85
+ description:
86
+ email:
87
+ - info@opentracing.io
85
88
  executables: []
86
89
  extensions: []
87
- extra_rdoc_files:
88
- - LICENSE
89
- - README.md
90
+ extra_rdoc_files: []
90
91
  files:
91
- - ".document"
92
+ - ".codeclimate.yml"
93
+ - ".gitignore"
94
+ - ".rubocop.yml"
95
+ - ".travis.yml"
92
96
  - Gemfile
93
- - Gemfile.lock
94
97
  - LICENSE
95
98
  - README.md
96
99
  - Rakefile
97
- - VERSION
100
+ - bin/console
101
+ - bin/setup
98
102
  - lib/opentracing.rb
103
+ - lib/opentracing/carrier.rb
104
+ - lib/opentracing/span.rb
105
+ - lib/opentracing/span_context.rb
106
+ - lib/opentracing/tracer.rb
107
+ - lib/opentracing/version.rb
99
108
  - opentracing.gemspec
100
- - test/helper.rb
101
- - test/test_opentracing.rb
102
- homepage: http://github.com/mytrile/opentracing
109
+ homepage: https://github.com/opentracing/opentracing-ruby
103
110
  licenses:
104
111
  - MIT
105
112
  metadata: {}
@@ -119,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
126
  version: '0'
120
127
  requirements: []
121
128
  rubyforge_project:
122
- rubygems_version: 2.4.8
129
+ rubygems_version: 2.5.1
123
130
  signing_key:
124
131
  specification_version: 4
125
- summary: OpenTracing support for Ruby frameworks
132
+ summary: OpenTracing Ruby Platform API
126
133
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE
data/Gemfile.lock DELETED
@@ -1,81 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (5.0.0.1)
5
- concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (~> 0.7)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- addressable (2.4.0)
10
- builder (3.2.2)
11
- concurrent-ruby (1.0.2)
12
- descendants_tracker (0.0.4)
13
- thread_safe (~> 0.3, >= 0.3.1)
14
- docile (1.1.5)
15
- faraday (0.9.2)
16
- multipart-post (>= 1.2, < 3)
17
- git (1.3.0)
18
- github_api (0.14.5)
19
- addressable (~> 2.4.0)
20
- descendants_tracker (~> 0.0.4)
21
- faraday (~> 0.8, < 0.10)
22
- hashie (>= 3.4)
23
- oauth2 (~> 1.0)
24
- hashie (3.4.6)
25
- highline (1.7.8)
26
- i18n (0.7.0)
27
- jeweler (2.0.1)
28
- builder
29
- bundler (>= 1.0)
30
- git (>= 1.2.5)
31
- github_api
32
- highline (>= 1.6.15)
33
- nokogiri (>= 1.5.10)
34
- rake
35
- rdoc
36
- json (1.8.3)
37
- jwt (1.5.6)
38
- mini_portile2 (2.1.0)
39
- minitest (5.10.1)
40
- multi_json (1.12.1)
41
- multi_xml (0.6.0)
42
- multipart-post (2.0.0)
43
- nokogiri (1.6.8.1)
44
- mini_portile2 (~> 2.1.0)
45
- oauth2 (1.2.0)
46
- faraday (>= 0.8, < 0.10)
47
- jwt (~> 1.0)
48
- multi_json (~> 1.3)
49
- multi_xml (~> 0.5)
50
- rack (>= 1.2, < 3)
51
- rack (2.0.1)
52
- rake (12.0.0)
53
- rdoc (3.12.2)
54
- json (~> 1.4)
55
- shoulda (3.5.0)
56
- shoulda-context (~> 1.0, >= 1.0.1)
57
- shoulda-matchers (>= 1.4.1, < 3.0)
58
- shoulda-context (1.2.2)
59
- shoulda-matchers (2.8.0)
60
- activesupport (>= 3.0.0)
61
- simplecov (0.12.0)
62
- docile (~> 1.1.0)
63
- json (>= 1.8, < 3)
64
- simplecov-html (~> 0.10.0)
65
- simplecov-html (0.10.0)
66
- thread_safe (0.3.5)
67
- tzinfo (1.2.2)
68
- thread_safe (~> 0.1)
69
-
70
- PLATFORMS
71
- ruby
72
-
73
- DEPENDENCIES
74
- bundler (~> 1.0)
75
- jeweler (~> 2.0.1)
76
- rdoc (~> 3.12)
77
- shoulda
78
- simplecov
79
-
80
- BUNDLED WITH
81
- 1.12.5