gruf-profiler 1.0.0 → 1.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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +12 -3
- data/README.md +4 -6
- data/gruf-profiler.gemspec +13 -11
- data/lib/gruf/profiler.rb +2 -0
- data/lib/gruf/profiler/interceptor.rb +6 -4
- data/lib/gruf/profiler/version.rb +3 -1
- metadata +32 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8994d28b12babd1a73807ae1eeb1852a50694983315d99e7d29bd1a8e9ae9000
|
4
|
+
data.tar.gz: 175c8c9c9f7c1f93c6f9803216c034b59c2cb6ab7a4b69568ed8264172fea4c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22e5d34669a6de110f0af38afd2eb2db701a89ba3769ce4089e09f7543445f5b41acd974d424d2e422bfdcb2b1dbe0e4930d37c949c6959ad58bd827750ade3
|
7
|
+
data.tar.gz: 2d920546627190e91b7c72611af90cb1d91bfef181be566e1dce92a72b2f3c30f96dc8d092d0b0629184c51a51d5eaafc6af962caf7c11c18991be944a229760
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
Changelog for the gruf-profiler gem.
|
2
2
|
|
3
|
-
|
3
|
+
### Unreleased Version
|
4
|
+
|
5
|
+
### 1.1.0
|
6
|
+
|
7
|
+
- Add support for Ruby 3
|
8
|
+
- Loosen unnecessarily strict development dependencies
|
9
|
+
- Add bundler 2 support
|
10
|
+
- Update to Rubocop 1.0
|
11
|
+
|
12
|
+
### 1.0.0
|
4
13
|
|
5
14
|
- Support for gruf 2.0
|
6
15
|
|
7
|
-
|
16
|
+
### 0.1.0
|
8
17
|
|
9
18
|
- Add rubocop
|
10
19
|
- Add bundler-audit
|
11
20
|
- Add configuration options for logging for memory profiler
|
12
21
|
|
13
|
-
|
22
|
+
### 0.0.1
|
14
23
|
|
15
24
|
- Initial public release
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gruf-profiler - Profiler for gruf
|
2
2
|
|
3
|
-
[](https://circleci.com/gh/bigcommerce/gruf-profiler/tree/main) [](https://badge.fury.io/rb/gruf-profiler) [](http://inch-ci.org/github/bigcommerce/gruf-profiler)
|
4
4
|
|
5
5
|
Adds a profiler interceptor for [gruf](https://github.com/bigcommerce/gruf) 2.0.0 or later.
|
6
6
|
|
@@ -16,7 +16,7 @@ Then in an initializer or before use, after loading gruf:
|
|
16
16
|
require 'gruf/profiler'
|
17
17
|
|
18
18
|
Gruf.configure do |c|
|
19
|
-
c.interceptors
|
19
|
+
c.interceptors.use(Gruf::Profiler::Interceptor)
|
20
20
|
end
|
21
21
|
```
|
22
22
|
|
@@ -28,7 +28,7 @@ and [memory_profiler](https://github.com/SamSaffron/memory_profiler) gems by def
|
|
28
28
|
### rbtrace
|
29
29
|
|
30
30
|
rbtrace is automatically loaded for every gruf service. You can view the
|
31
|
-
[README](https://github.com/tmm1/rbtrace/blob/
|
31
|
+
[README](https://github.com/tmm1/rbtrace/blob/main/README.md) for rbtrace for more information,
|
32
32
|
but the general idea is that you can run against a running gruf instance to see tracing
|
33
33
|
information about a gruf server:
|
34
34
|
|
@@ -48,9 +48,7 @@ You can adjust that log level to say, INFO, like so:
|
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
Gruf.configure do |c|
|
51
|
-
c.interceptors
|
52
|
-
log_level: :info
|
53
|
-
}
|
51
|
+
c.interceptors.use(Gruf::Profiler::Interceptor, log_level: :info)
|
54
52
|
end
|
55
53
|
```
|
56
54
|
|
data/gruf-profiler.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
3
4
|
#
|
4
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -14,7 +15,7 @@
|
|
14
15
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
15
16
|
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
17
|
#
|
17
|
-
|
18
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
18
19
|
require 'gruf/profiler/version'
|
19
20
|
|
20
21
|
Gem::Specification.new do |spec|
|
@@ -23,20 +24,21 @@ Gem::Specification.new do |spec|
|
|
23
24
|
spec.authors = ['Shaun McCormick']
|
24
25
|
spec.email = ['shaun.mccormick@bigcommerce.com']
|
25
26
|
|
26
|
-
spec.summary =
|
27
|
-
spec.description =
|
27
|
+
spec.summary = 'Plugin for profiling gruf-backed gRPC requests'
|
28
|
+
spec.description = 'Adds memory reporting and rbtrace to gruf servers'
|
28
29
|
spec.homepage = 'https://github.com/bigcommerce/gruf-profiler'
|
29
30
|
spec.license = 'MIT'
|
30
31
|
|
31
32
|
spec.files = Dir['README.md', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', 'lib/**/*', 'gruf-profiler.gemspec']
|
32
33
|
spec.require_paths = ['lib']
|
33
34
|
|
34
|
-
spec.
|
35
|
-
|
36
|
-
spec.add_development_dependency '
|
37
|
-
spec.add_development_dependency '
|
35
|
+
spec.required_ruby_version = '>= 2.6'
|
36
|
+
|
37
|
+
spec.add_development_dependency 'pry', '>= 0.14'
|
38
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
39
|
+
spec.add_development_dependency 'rspec', '>= 3.8'
|
38
40
|
|
39
|
-
spec.add_runtime_dependency '
|
40
|
-
spec.add_runtime_dependency 'rbtrace', '
|
41
|
-
spec.add_runtime_dependency '
|
41
|
+
spec.add_runtime_dependency 'memory_profiler', '>= 0.9'
|
42
|
+
spec.add_runtime_dependency 'rbtrace', '>= 0.4'
|
43
|
+
spec.add_runtime_dependency 'stackprof', '>= 0.2'
|
42
44
|
end
|
data/lib/gruf/profiler.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -24,7 +26,7 @@ module Gruf
|
|
24
26
|
# Add to your gruf initializer:
|
25
27
|
# require 'gruf/profiler'
|
26
28
|
# Gruf.configure do |c|
|
27
|
-
# c.interceptors
|
29
|
+
# c.interceptors.use(Gruf::Profiler::Interceptor)
|
28
30
|
# end
|
29
31
|
#
|
30
32
|
class Interceptor < Gruf::Interceptors::ServerInterceptor
|
@@ -33,7 +35,7 @@ module Gruf
|
|
33
35
|
#
|
34
36
|
def call
|
35
37
|
result = nil
|
36
|
-
report = MemoryProfiler.report(memory_profiler_options) do
|
38
|
+
report = MemoryProfiler.report(**memory_profiler_options) do
|
37
39
|
result = yield
|
38
40
|
end
|
39
41
|
if report
|
@@ -53,7 +55,7 @@ module Gruf
|
|
53
55
|
#
|
54
56
|
def profile(report)
|
55
57
|
io_obj = pretty_print_options.fetch(:io, nil)
|
56
|
-
report_string = io_obj ? report.pretty_print(io_obj, pretty_print_options) : report.pretty_print(pretty_print_options)
|
58
|
+
report_string = io_obj ? report.pretty_print(io_obj, **pretty_print_options) : report.pretty_print(**pretty_print_options)
|
57
59
|
log("gruf profile for #{request.method_name}:\n#{report_string}")
|
58
60
|
end
|
59
61
|
|
@@ -81,7 +83,7 @@ module Gruf
|
|
81
83
|
# @return [Hash]
|
82
84
|
#
|
83
85
|
def pretty_print_options
|
84
|
-
memory_profiler_options.fetch(:pretty_print_options, {})
|
86
|
+
memory_profiler_options.fetch(:pretty_print_options, {}) || {}
|
85
87
|
end
|
86
88
|
end
|
87
89
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
@@ -15,6 +17,6 @@
|
|
15
17
|
#
|
16
18
|
module Gruf
|
17
19
|
module Profiler
|
18
|
-
VERSION = '1.
|
20
|
+
VERSION = '1.1.0'
|
19
21
|
end
|
20
22
|
end
|
metadata
CHANGED
@@ -1,113 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf-profiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: pry
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0.14'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.6'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.6'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '3.8'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '3.8'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: memory_profiler
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
61
|
+
version: '0.9'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
68
|
+
version: '0.9'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rbtrace
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- - "
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
75
|
+
version: '0.4'
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- - "
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
82
|
+
version: '0.4'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: stackprof
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
89
|
+
version: '0.2'
|
104
90
|
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
96
|
+
version: '0.2'
|
111
97
|
description: Adds memory reporting and rbtrace to gruf servers
|
112
98
|
email:
|
113
99
|
- shaun.mccormick@bigcommerce.com
|
@@ -126,7 +112,7 @@ homepage: https://github.com/bigcommerce/gruf-profiler
|
|
126
112
|
licenses:
|
127
113
|
- MIT
|
128
114
|
metadata: {}
|
129
|
-
post_install_message:
|
115
|
+
post_install_message:
|
130
116
|
rdoc_options: []
|
131
117
|
require_paths:
|
132
118
|
- lib
|
@@ -134,16 +120,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
120
|
requirements:
|
135
121
|
- - ">="
|
136
122
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
123
|
+
version: '2.6'
|
138
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
125
|
requirements:
|
140
126
|
- - ">="
|
141
127
|
- !ruby/object:Gem::Version
|
142
128
|
version: '0'
|
143
129
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
130
|
+
rubygems_version: 3.2.16
|
131
|
+
signing_key:
|
147
132
|
specification_version: 4
|
148
133
|
summary: Plugin for profiling gruf-backed gRPC requests
|
149
134
|
test_files: []
|