gruf-lightstep 1.2.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -15
- data/README.md +20 -14
- data/gruf-lightstep.gemspec +13 -7
- data/lib/gruf/lightstep/client_interceptor.rb +1 -1
- data/lib/gruf/lightstep/method.rb +1 -1
- data/lib/gruf/lightstep/server_interceptor.rb +20 -7
- data/lib/gruf/lightstep/version.rb +1 -1
- metadata +87 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 287470dd4cdd7a7190852a7971c019cd9ec7e856914a870ca7501630ea4ff51d
|
4
|
+
data.tar.gz: 8b34d6ab2b31a2a5cf2f2a6b5836a539cc6001825c659951c006cc2fc24c50ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6682eb881f2ee3e439cf399c3b2d0f458a4e1e7c60dedcfe29fcdd403588a398557c7ffe2e1f8566d8d062fd0f6e5965ef573069b8818b1652b87309d08ed4
|
7
|
+
data.tar.gz: f5d5ae22dc7210d37e863f6dbe60e9611718990017f2b1c82d0edb9ab826fc95c533ae99f6b3a5e021d0a9ea07c14a8eea1cabafe89741aca37b9134e149becd
|
data/CHANGELOG.md
CHANGED
@@ -1,56 +1,80 @@
|
|
1
|
-
Changelog for the gruf-
|
1
|
+
Changelog for the gruf-lightstep gem.
|
2
2
|
|
3
|
-
|
3
|
+
### Pending Release
|
4
4
|
|
5
|
-
|
5
|
+
### 1.5.1
|
6
|
+
|
7
|
+
- Remove unnecessarily strict dev dependencies
|
8
|
+
|
9
|
+
### 1.5.0
|
10
|
+
|
11
|
+
- Add official support for Ruby 3
|
12
|
+
|
13
|
+
### 1.4.0
|
14
|
+
|
15
|
+
- Ensure `error` span tag is always set when an exception is raised
|
16
|
+
- Move from whitelist -> allowlist in server interceptor
|
17
|
+
|
18
|
+
### 1.3.0
|
19
|
+
|
20
|
+
- Bump Ruby requirement to 2.6+
|
21
|
+
- Bump bc-lightstep-ruby dependency to 2.0+
|
22
|
+
- Explicitly declare gruf requirement in gemspec
|
23
|
+
- Explicitly declare development deps for gem
|
24
|
+
|
25
|
+
### 1.2.1
|
26
|
+
|
27
|
+
- Ensure boundary span has `span.kind` set
|
28
|
+
|
29
|
+
### 1.2.0
|
6
30
|
|
7
31
|
- Add `frozen_string_literal: true` to all files
|
8
32
|
- Deprecate ruby 2.2 support
|
9
33
|
|
10
|
-
|
34
|
+
### 1.1.3
|
11
35
|
|
12
36
|
- Bump bc-lightstep-ruby to 1.2.0
|
13
37
|
|
14
|
-
|
38
|
+
### 1.1.2
|
15
39
|
|
16
40
|
- First OSS release
|
17
41
|
- Explicitly require bc-lightstep-ruby dependency
|
18
|
-
- Add option to
|
42
|
+
- Add option to allowlist request params to lightstep as span tags
|
19
43
|
|
20
|
-
|
44
|
+
### 1.1.1
|
21
45
|
|
22
46
|
- Bump bc-lightstep-ruby to 1.1.5
|
23
47
|
- Bump gruf minimum version to 2.4
|
24
48
|
|
25
|
-
|
49
|
+
### 1.1.0
|
26
50
|
|
27
51
|
- Exclude client validation errors from being "errors"
|
28
52
|
|
29
|
-
|
53
|
+
### 1.0.3
|
30
54
|
|
31
55
|
- Ensure gRPC requests are always the root span
|
32
56
|
|
33
|
-
|
57
|
+
### 1.0.2
|
34
58
|
|
35
59
|
- Add ignore_methods as an option to server interceptor
|
36
60
|
- Standardize span tags according to BC spec
|
37
61
|
|
38
|
-
|
62
|
+
### 1.0.0
|
39
63
|
|
40
64
|
- Support for gruf 2.0.0
|
41
65
|
|
42
|
-
|
66
|
+
### 0.10.3
|
43
67
|
|
44
68
|
- Update to 0.10.3, add rubocop+bundler-audit
|
45
69
|
|
46
|
-
|
70
|
+
### 0.10.2
|
47
71
|
|
48
72
|
- Updated license to MIT
|
49
73
|
|
50
|
-
|
74
|
+
### 0.10.1
|
51
75
|
|
52
76
|
- Handle case when tracer is not yet initialized before trace executes
|
53
77
|
|
54
|
-
|
78
|
+
### 0.10.0
|
55
79
|
|
56
80
|
- Initial public release
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gruf-lightstep - LightStep tracing for gruf
|
2
2
|
|
3
|
-
[![CircleCI](https://circleci.com/gh/bigcommerce/gruf-lightstep/tree/
|
3
|
+
[![CircleCI](https://circleci.com/gh/bigcommerce/gruf-lightstep/tree/main.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf-lightstep/tree/main) [![Gem Version](https://badge.fury.io/rb/gruf-lightstep.svg)](https://badge.fury.io/rb/gruf-lightstep) [![Inline docs](http://inch-ci.org/github/bigcommerce/gruf-lightstep.svg?branch=main)](http://inch-ci.org/github/bigcommerce/gruf-lightstep)
|
4
4
|
|
5
5
|
Adds LightStep tracing support for [gruf](https://github.com/bigcommerce/gruf) 2.0.0+.
|
6
6
|
|
@@ -14,18 +14,24 @@ Then in an initializer or before use, after loading gruf:
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
require 'gruf/lightstep'
|
17
|
-
|
18
|
-
Gruf::Lightstep.configure do |c|
|
19
|
-
c.component_name = 'myapp'
|
20
|
-
c.access_token = 'abcdefg'
|
21
|
-
c.host = 'my.lightstep.service.io'
|
22
|
-
c.port = 8080
|
23
|
-
c.verbosity = 1
|
24
|
-
end
|
25
|
-
Gruf::Lightstep.start
|
26
17
|
```
|
27
18
|
|
28
|
-
|
19
|
+
### Configuration
|
20
|
+
|
21
|
+
You can use the following ENV vars to configure lightstep:
|
22
|
+
|
23
|
+
| Name | Description |
|
24
|
+
| ---- | ---- |
|
25
|
+
|LIGHTSTEP_ACCESS_TOKEN|LightStep access token, if used in your satellites|
|
26
|
+
|LIGHTSTEP_COMPONENT_NAME|The name of your service|
|
27
|
+
|LIGHTSTEP_HOST|The host of your lightstep satellites|
|
28
|
+
|LIGHTSTEP_PORT|The port of your lightstep satellites|
|
29
|
+
|
30
|
+
See more configuration here: https://github.com/bigcommerce/bc-lightstep-ruby#environment-config
|
31
|
+
|
32
|
+
### Server Interceptors
|
33
|
+
|
34
|
+
In your gruf initializer:
|
29
35
|
|
30
36
|
```ruby
|
31
37
|
Gruf.configure do |c|
|
@@ -37,11 +43,11 @@ It comes with a few more options as well:
|
|
37
43
|
|
38
44
|
| Option | Description | Default |
|
39
45
|
| ------ | ----------- | ------- |
|
40
|
-
|
|
46
|
+
| allowlist | An array of parameter key names to log to lightstep. E.g. `[uuid kind]` | `[]` |
|
41
47
|
| ignore_methods | An array of method names to ignore from logging. E.g. `['namespace.health.check']` | `[]` |
|
42
48
|
|
43
|
-
It's important to maintain a safe
|
44
|
-
parameter sanitization on its own. We also recommend do not
|
49
|
+
It's important to maintain a safe allowlist should you decide to log parameters; gruf does no
|
50
|
+
parameter sanitization on its own. We also recommend do not allowlist parameters that may contain
|
45
51
|
very large values (such as binary or json data).
|
46
52
|
|
47
53
|
### Client Interceptors
|
data/gruf-lightstep.gemspec
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
16
16
|
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
17
17
|
#
|
18
|
-
|
18
|
+
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
|
19
19
|
require 'gruf/lightstep/version'
|
20
20
|
|
21
21
|
Gem::Specification.new do |spec|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.authors = ['Shaun McCormick']
|
25
25
|
spec.email = ['shaun.mccormick@bigcommerce.com']
|
26
26
|
|
27
|
-
spec.summary =
|
27
|
+
spec.summary = 'Plugin for lightstep tracing for gruf'
|
28
28
|
spec.description = spec.summary
|
29
29
|
spec.homepage = 'https://github.com/bigcommerce/gruf-lightstep'
|
30
30
|
spec.license = 'MIT'
|
@@ -32,10 +32,16 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.files = Dir['README.md', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', 'lib/**/*', 'gruf-lightstep.gemspec']
|
33
33
|
spec.require_paths = ['lib']
|
34
34
|
|
35
|
-
spec.
|
36
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
37
|
-
spec.add_development_dependency 'rspec', '~> 3.7'
|
38
|
-
spec.add_development_dependency 'pry'
|
35
|
+
spec.required_ruby_version = '>= 2.6'
|
39
36
|
|
40
|
-
spec.
|
37
|
+
spec.add_development_dependency 'bundler-audit', '>= 0.6'
|
38
|
+
spec.add_development_dependency 'pry', '>= 0.13'
|
39
|
+
spec.add_development_dependency 'rake', '>= 12.0'
|
40
|
+
spec.add_development_dependency 'rspec', '>= 3.8'
|
41
|
+
spec.add_development_dependency 'rspec_junit_formatter', '>= 0.4'
|
42
|
+
spec.add_development_dependency 'rubocop', '>= 0.82'
|
43
|
+
spec.add_development_dependency 'simplecov', '>= 0.15'
|
44
|
+
|
45
|
+
spec.add_runtime_dependency 'bc-lightstep-ruby', '~> 2.2'
|
46
|
+
spec.add_runtime_dependency 'gruf', '>= 2.4', '< 3'
|
41
47
|
end
|
@@ -21,32 +21,32 @@ module Gruf
|
|
21
21
|
# Intercepts inbound calls to provide LightStep tracing
|
22
22
|
#
|
23
23
|
class ServerInterceptor < Gruf::Interceptors::ServerInterceptor
|
24
|
+
DEFAULT_ERROR_CLASSES = %w[GRPC::Unknown GRPC::Internal GRPC::DataLoss GRPC::FailedPrecondition GRPC::Unavailable GRPC::DeadlineExceeded GRPC::Cancelled].freeze
|
25
|
+
|
24
26
|
##
|
25
27
|
# Handle the gruf around hook and trace sampled requests
|
26
28
|
#
|
27
29
|
def call(&_block)
|
28
|
-
return yield if
|
30
|
+
return yield if ignore_methods.include?(request.method_name)
|
29
31
|
|
30
32
|
result = nil
|
31
|
-
|
32
|
-
whitelist = options.fetch(:whitelist, []).map(&:to_s).map(&:to_sym)
|
33
33
|
params = request_message_params
|
34
|
-
|
35
34
|
tracer = ::Bigcommerce::Lightstep::Tracer.instance
|
36
35
|
tracer.clear_active_span! # because we're always starting from the top on a gRPC boundary
|
37
36
|
tracer.start_span(request.method_name, context: request_method.headers.to_h) do |span|
|
38
37
|
span.set_tag('grpc.method', request.method_key)
|
39
38
|
span.set_tag('grpc.request_class', request.request_class)
|
40
39
|
span.set_tag('grpc.service', request.service_key)
|
40
|
+
span.set_tag('span.kind', 'server')
|
41
41
|
|
42
|
-
|
42
|
+
allowlist.each do |param|
|
43
43
|
span.set_tag(param.to_s, params[param]) if params.key?(param)
|
44
44
|
end
|
45
45
|
|
46
46
|
begin
|
47
47
|
result = yield
|
48
48
|
rescue StandardError => e
|
49
|
-
span.set_tag('error',
|
49
|
+
span.set_tag('error', error?(e))
|
50
50
|
span.set_tag('grpc.error', true)
|
51
51
|
span.set_tag('grpc.error_code', code_for(e))
|
52
52
|
span.set_tag('grpc.error_class', e.class)
|
@@ -58,6 +58,19 @@ module Gruf
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
+
##
|
62
|
+
# @return [Array<String>]
|
63
|
+
def ignore_methods
|
64
|
+
@ignore_methods ||= options.fetch(:ignore_methods, nil) || []
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# @return [Array<Symbol>]
|
69
|
+
#
|
70
|
+
def allowlist
|
71
|
+
@allowlist ||= (options.fetch(:allowlist, nil) || []).map(&:to_s).map(&:to_sym)
|
72
|
+
end
|
73
|
+
|
61
74
|
##
|
62
75
|
# @param [StandardError]
|
63
76
|
# @return [Number] that maps to one of the GRCP::Core::StatusCodes or Gruf::Lightstep.default_error_code
|
@@ -93,7 +106,7 @@ module Gruf
|
|
93
106
|
# @return [Array]
|
94
107
|
#
|
95
108
|
def error_classes
|
96
|
-
options.fetch(:error_classes,
|
109
|
+
@error_classes ||= (options.fetch(:error_classes, nil) || DEFAULT_ERROR_CLASSES)
|
97
110
|
end
|
98
111
|
end
|
99
112
|
end
|
metadata
CHANGED
@@ -1,85 +1,147 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf-lightstep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
14
|
+
name: bundler-audit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '0.13'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '12.0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '12.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
61
|
+
version: '3.8'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
68
|
+
version: '3.8'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec_junit_formatter
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
75
|
+
version: '0.4'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
82
|
+
version: '0.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.82'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.82'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.15'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.15'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: bc-lightstep-ruby
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - "~>"
|
74
116
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
117
|
+
version: '2.2'
|
76
118
|
type: :runtime
|
77
119
|
prerelease: false
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
79
121
|
requirements:
|
80
122
|
- - "~>"
|
81
123
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
124
|
+
version: '2.2'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: gruf
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.4'
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '3'
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '2.4'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '3'
|
83
145
|
description: Plugin for lightstep tracing for gruf
|
84
146
|
email:
|
85
147
|
- shaun.mccormick@bigcommerce.com
|
@@ -102,7 +164,7 @@ homepage: https://github.com/bigcommerce/gruf-lightstep
|
|
102
164
|
licenses:
|
103
165
|
- MIT
|
104
166
|
metadata: {}
|
105
|
-
post_install_message:
|
167
|
+
post_install_message:
|
106
168
|
rdoc_options: []
|
107
169
|
require_paths:
|
108
170
|
- lib
|
@@ -110,16 +172,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
172
|
requirements:
|
111
173
|
- - ">="
|
112
174
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
175
|
+
version: '2.6'
|
114
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
177
|
requirements:
|
116
178
|
- - ">="
|
117
179
|
- !ruby/object:Gem::Version
|
118
180
|
version: '0'
|
119
181
|
requirements: []
|
120
|
-
|
121
|
-
|
122
|
-
signing_key:
|
182
|
+
rubygems_version: 3.2.16
|
183
|
+
signing_key:
|
123
184
|
specification_version: 4
|
124
185
|
summary: Plugin for lightstep tracing for gruf
|
125
186
|
test_files: []
|