lightstep 0.13.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile.lock +20 -20
- data/Makefile +2 -2
- data/README.md +1 -1
- data/lib/lightstep.rb +2 -0
- data/lib/lightstep/span.rb +18 -5
- data/lib/lightstep/tracer.rb +25 -8
- data/lib/lightstep/transport/http_json.rb +1 -6
- data/lib/lightstep/version.rb +1 -1
- data/lightstep.gemspec +6 -2
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3dd55736997047494f81d964b3af41ae7d46df3d
|
4
|
+
data.tar.gz: 2cb5bd4f73f16d8a7ec05347f73574c660b57bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cd1f14fc114101da63e675f0e5e5e3317b09ded56822d2a65bafafd1666ab44205c5e1759287ce6887bd8e48ea6b62547aff747e57c62d86da4fd3feb9bb002
|
7
|
+
data.tar.gz: cd21715f9042383212e30701971ce48bae5954427786ad57adfecabecf1d27795b46a33877e2adfa179736f985278a9f39d827b93f870921d9ee36d6b62f27a1
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
### Added
|
9
|
+
- A Changelog
|
10
|
+
- Now supports Span#log_kv
|
11
|
+
- Updated to opentracing-ruby 0.5.0
|
12
|
+
- Now delegates Lightstep#active_span to the tracer
|
13
|
+
- Now supports passing a block to #start_span
|
14
|
+
- The block forms of #start_span and #start active_span now return the result of executing the block
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- Tracer#extract now supports symbols in carrier
|
18
|
+
|
19
|
+
### Deprecated
|
20
|
+
- Span#log (reflecting deprecation in opentracing 0.4.0)
|
21
|
+
|
22
|
+
### Removed
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
- Fix handling of non-string tag values in `start_span`.
|
26
|
+
|
27
|
+
### Security
|
28
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lightstep (0.
|
4
|
+
lightstep (0.15.0)
|
5
5
|
concurrent-ruby (~> 1.0)
|
6
|
-
opentracing (~> 0.
|
6
|
+
opentracing (~> 0.5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
bump (0.6.1)
|
12
|
-
concurrent-ruby (1.
|
12
|
+
concurrent-ruby (1.1.5)
|
13
13
|
diff-lcs (1.3)
|
14
|
-
docile (1.3.
|
15
|
-
json (2.
|
16
|
-
opentracing (0.
|
17
|
-
rack (2.0.
|
14
|
+
docile (1.3.2)
|
15
|
+
json (2.2.0)
|
16
|
+
opentracing (0.5.0)
|
17
|
+
rack (2.0.7)
|
18
18
|
rake (11.3.0)
|
19
|
-
rspec (3.
|
20
|
-
rspec-core (~> 3.
|
21
|
-
rspec-expectations (~> 3.
|
22
|
-
rspec-mocks (~> 3.
|
23
|
-
rspec-core (3.
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-expectations (3.
|
19
|
+
rspec (3.8.0)
|
20
|
+
rspec-core (~> 3.8.0)
|
21
|
+
rspec-expectations (~> 3.8.0)
|
22
|
+
rspec-mocks (~> 3.8.0)
|
23
|
+
rspec-core (3.8.2)
|
24
|
+
rspec-support (~> 3.8.0)
|
25
|
+
rspec-expectations (3.8.4)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-mocks (3.8.1)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
32
|
-
simplecov (0.
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-support (3.8.2)
|
32
|
+
simplecov (0.17.0)
|
33
33
|
docile (~> 1.1)
|
34
34
|
json (>= 1.8, < 3)
|
35
35
|
simplecov-html (~> 0.10.0)
|
@@ -49,4 +49,4 @@ DEPENDENCIES
|
|
49
49
|
timecop (~> 0.8.0)
|
50
50
|
|
51
51
|
BUNDLED WITH
|
52
|
-
|
52
|
+
2.0.2
|
data/Makefile
CHANGED
@@ -14,10 +14,10 @@ benchmark:
|
|
14
14
|
ruby benchmark/threading/thread_test.rb
|
15
15
|
|
16
16
|
bump-version:
|
17
|
-
|
17
|
+
ruby -e 'require "bump"; Bump::Bump.run("$(RELEASE_TYPE)")'
|
18
18
|
make build # rebuild after version increment
|
19
19
|
git tag `ruby scripts/version.rb`
|
20
|
-
|
20
|
+
git push
|
21
21
|
git push --tags
|
22
22
|
|
23
23
|
publish: build test benchmark bump-version
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# lightstep-tracer-ruby
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/lightstep
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/lightstep.svg)](https://badge.fury.io/rb/lightstep) [![Circle CI](https://circleci.com/gh/lightstep/lightstep-tracer-ruby.svg?style=shield)](https://circleci.com/gh/lightstep/lightstep-tracer-ruby) [![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) [![Code Climate](https://codeclimate.com/github/lightstep/lightstep-tracer-ruby/badges/gpa.svg)](https://codeclimate.com/github/lightstep/lightstep-tracer-ruby)
|
4
4
|
|
5
5
|
The LightStep distributed tracing library for Ruby.
|
6
6
|
|
data/lib/lightstep.rb
CHANGED
@@ -15,6 +15,8 @@ module LightStep
|
|
15
15
|
|
16
16
|
def_delegator :instance, :configure
|
17
17
|
def_delegator :instance, :start_span
|
18
|
+
def_delegator :instance, :start_active_span
|
19
|
+
def_delegator :instance, :active_span
|
18
20
|
def_delegator :instance, :disable
|
19
21
|
def_delegator :instance, :enable
|
20
22
|
def_delegator :instance, :flush
|
data/lib/lightstep/span.rb
CHANGED
@@ -42,7 +42,7 @@ module LightStep
|
|
42
42
|
)
|
43
43
|
|
44
44
|
@tags = Concurrent::Hash.new
|
45
|
-
@tags.update(tags) unless tags.nil?
|
45
|
+
@tags.update(tags.each { |k, v| tags[k] = v.to_s }) unless tags.nil?
|
46
46
|
@log_records = Concurrent::Array.new
|
47
47
|
@dropped_logs = Concurrent::AtomicFixnum.new
|
48
48
|
@max_log_records = max_log_records
|
@@ -105,22 +105,35 @@ module LightStep
|
|
105
105
|
context.baggage[key]
|
106
106
|
end
|
107
107
|
|
108
|
+
# @deprecated Use {#log_kv} instead.
|
108
109
|
# Add a log entry to this span
|
109
110
|
# @param event [String] event name for the log
|
110
111
|
# @param timestamp [Time] time of the log
|
111
|
-
# @param fields [Hash] Additional information to log
|
112
|
+
# @param fields [Hash{Symbol=>Object}] Additional information to log
|
112
113
|
def log(event: nil, timestamp: Time.now, **fields)
|
114
|
+
warn 'Span#log is deprecated. Please use Span#log_kv instead.'
|
113
115
|
return unless tracer.enabled?
|
114
116
|
|
115
117
|
fields = {} if fields.nil?
|
116
118
|
unless event.nil?
|
117
119
|
fields[:event] = event.to_s
|
118
120
|
end
|
121
|
+
|
122
|
+
log_kv(timestamp: timestamp, **fields)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Add a log entry to this span
|
126
|
+
# @param timestamp [Time] time of the log
|
127
|
+
# @param fields [Hash{Symbol=>Object}] Additional information to log
|
128
|
+
def log_kv(timestamp: Time.now, **fields)
|
129
|
+
return unless tracer.enabled?
|
130
|
+
|
131
|
+
fields = {} if fields.nil?
|
119
132
|
record = {
|
120
133
|
timestamp_micros: LightStep.micros(timestamp),
|
121
|
-
fields: fields.to_a.map
|
122
|
-
{Key: key.to_s, Value: value.to_s}
|
123
|
-
|
134
|
+
fields: fields.to_a.map do |key, value|
|
135
|
+
{ Key: key.to_s, Value: value.to_s }
|
136
|
+
end
|
124
137
|
}
|
125
138
|
|
126
139
|
log_records.push(record)
|
data/lib/lightstep/tracer.rb
CHANGED
@@ -83,10 +83,12 @@ module LightStep
|
|
83
83
|
# References#CHILD_OF reference to the ScopeManager#active.
|
84
84
|
# @param finish_on_close [Boolean] whether span should automatically be
|
85
85
|
# finished when Scope#close is called
|
86
|
-
# @yield [Scope] If an optional block is passed to
|
86
|
+
# @yield [Scope] If an optional block is passed to start_active_span it will
|
87
87
|
# yield the newly-started Scope. If `finish_on_close` is true then the
|
88
88
|
# Span will be finished automatically after the block is executed.
|
89
|
-
# @return [Scope]
|
89
|
+
# @return [Scope, Object] If passed an optional block, start_active_span
|
90
|
+
# returns the block's return value, otherwise it returns the newly-started
|
91
|
+
# and activated Scope
|
90
92
|
def start_active_span(operation_name,
|
91
93
|
child_of: nil,
|
92
94
|
references: nil,
|
@@ -109,8 +111,9 @@ module LightStep
|
|
109
111
|
|
110
112
|
scope_manager.activate(span: span, finish_on_close: finish_on_close).tap do |scope|
|
111
113
|
if block_given?
|
112
|
-
yield
|
113
|
-
|
114
|
+
return yield(scope).tap do
|
115
|
+
scope.close
|
116
|
+
end
|
114
117
|
end
|
115
118
|
end
|
116
119
|
end
|
@@ -138,13 +141,19 @@ module LightStep
|
|
138
141
|
# @param tags [Hash] Tags to assign to the Span at start time
|
139
142
|
# @param ignore_active_scope [Boolean] whether to create an implicit
|
140
143
|
# References#CHILD_OF reference to the ScopeManager#active.
|
141
|
-
# @
|
144
|
+
# @yield [Span] If passed an optional block, start_span will yield the
|
145
|
+
# newly-created span to the block. The span will be finished automatically
|
146
|
+
# after the block is executed.
|
147
|
+
# @return [Span, Object] If passed an optional block, start_span will return
|
148
|
+
# the block's return value, otherwise it returns the newly-started Span
|
149
|
+
# instance, which has not been automatically registered via the
|
150
|
+
# ScopeManager
|
142
151
|
def start_span(operation_name, child_of: nil, references: nil, start_time: nil, tags: nil, ignore_active_scope: false)
|
143
152
|
if child_of.nil? && references.nil? && !ignore_active_scope
|
144
153
|
child_of = active_span
|
145
154
|
end
|
146
155
|
|
147
|
-
|
156
|
+
span_options = {
|
148
157
|
tracer: self,
|
149
158
|
operation_name: operation_name,
|
150
159
|
child_of: child_of,
|
@@ -152,7 +161,15 @@ module LightStep
|
|
152
161
|
start_micros: start_time.nil? ? LightStep.micros(Time.now) : LightStep.micros(start_time),
|
153
162
|
tags: tags,
|
154
163
|
max_log_records: max_log_records,
|
155
|
-
|
164
|
+
}
|
165
|
+
|
166
|
+
Span.new(span_options).tap do |span|
|
167
|
+
if block_given?
|
168
|
+
return yield(span).tap do
|
169
|
+
span.finish
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
156
173
|
end
|
157
174
|
|
158
175
|
# Inject a SpanContext into the given carrier
|
@@ -311,7 +328,7 @@ module LightStep
|
|
311
328
|
def extract_from_rack(env)
|
312
329
|
extract_from_text_map(env.reduce({}){|memo, tuple|
|
313
330
|
raw_header, value = tuple
|
314
|
-
header = raw_header.gsub(/^HTTP_/, '').tr('_', '-').downcase
|
331
|
+
header = raw_header.to_s.gsub(/^HTTP_/, '').tr('_', '-').downcase
|
315
332
|
|
316
333
|
memo[header] = value if header.start_with?(CARRIER_TRACER_STATE_PREFIX, CARRIER_BAGGAGE_PREFIX)
|
317
334
|
memo
|
@@ -4,12 +4,7 @@ require 'lightstep/transport/base'
|
|
4
4
|
module LightStep
|
5
5
|
module Transport
|
6
6
|
# HTTPJSON is a transport that sends reports via HTTP in JSON format.
|
7
|
-
# It is thread-safe
|
8
|
-
# in the queue will be copied and sent in duplicate.
|
9
|
-
#
|
10
|
-
# When forking, you should first `disable` the tracer, then `enable` it from
|
11
|
-
# within the fork (and in the parent post-fork). See
|
12
|
-
# `examples/fork_children/main.rb` for an example.
|
7
|
+
# It is thread-safe.
|
13
8
|
class HTTPJSON < Base
|
14
9
|
LIGHTSTEP_HOST = 'collector.lightstep.com'.freeze
|
15
10
|
LIGHTSTEP_PORT = 443
|
data/lib/lightstep/version.rb
CHANGED
data/lightstep.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'lightstep/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'lightstep'
|
8
8
|
spec.version = LightStep::VERSION
|
9
|
-
spec.authors = ['
|
9
|
+
spec.authors = ['lightstep']
|
10
10
|
spec.email = ['support@lightstep.com']
|
11
11
|
|
12
12
|
spec.summary = 'LightStep OpenTracing Ruby bindings'
|
@@ -16,8 +16,12 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
+
spec.metadata = {
|
20
|
+
"changelog_uri" => "https://github.com/lightstep/lightstep-tracer-ruby/blob/master/CHANGELOG.md",
|
21
|
+
}
|
22
|
+
|
19
23
|
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
20
|
-
spec.add_dependency 'opentracing', '~> 0.
|
24
|
+
spec.add_dependency 'opentracing', '~> 0.5.0'
|
21
25
|
spec.add_development_dependency 'rake', '~> 11.3'
|
22
26
|
spec.add_development_dependency 'rack', '~> 2.0'
|
23
27
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightstep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- lightstep
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.5.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- ".gitignore"
|
134
134
|
- ".rspec"
|
135
135
|
- ".rubocop.yml"
|
136
|
+
- CHANGELOG.md
|
136
137
|
- Gemfile
|
137
138
|
- Gemfile.lock
|
138
139
|
- LICENSE.txt
|
@@ -167,7 +168,8 @@ files:
|
|
167
168
|
homepage: https://github.com/lightstep/lightstep-tracer-ruby
|
168
169
|
licenses:
|
169
170
|
- MIT
|
170
|
-
metadata:
|
171
|
+
metadata:
|
172
|
+
changelog_uri: https://github.com/lightstep/lightstep-tracer-ruby/blob/master/CHANGELOG.md
|
171
173
|
post_install_message:
|
172
174
|
rdoc_options: []
|
173
175
|
require_paths:
|
@@ -184,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
186
|
version: '0'
|
185
187
|
requirements: []
|
186
188
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.5.2.3
|
188
190
|
signing_key:
|
189
191
|
specification_version: 4
|
190
192
|
summary: LightStep OpenTracing Ruby bindings
|