pyroscope 0.5.0-x86_64-darwin → 0.5.2-x86_64-darwin

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.
data/ext/rbspy/Cargo.toml CHANGED
@@ -2,22 +2,18 @@
2
2
  name = "rbspy"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
+ rust-version = "1.63"
5
6
 
6
7
  [lib]
7
8
  name = "rbspy"
8
9
  crate-type = ["cdylib"]
9
10
 
10
11
  [dependencies]
11
- #pyroscope = {version = "0.5.2" }
12
12
  pyroscope = { path = "../../../../" }
13
- #pyroscope_rbspy = { version = "0.2" }
14
13
  pyroscope_rbspy = { path = "../../../../pyroscope_backends/pyroscope_rbspy" }
15
14
  ffikit = { path = "../../../ffikit" }
16
15
  pretty_env_logger = "0.4.0"
17
-
18
- [patch.crates-io]
19
- read-process-memory = {git = "https://github.com/omarabid/read-process-memory.git", branch = "0.1.4-fix"}
20
- rbspy = {git="https://github.com/omarabid/rbspy.git", branch="oncpu-fix"}
16
+ inferno = "=0.11.14"
21
17
 
22
18
  [build-dependencies]
23
19
  cbindgen = "0.20.0"
@@ -0,0 +1,324 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "ansi_term"
7
+ version = "0.12.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
10
+ dependencies = [
11
+ "winapi",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "atty"
16
+ version = "0.2.14"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
19
+ dependencies = [
20
+ "hermit-abi",
21
+ "libc",
22
+ "winapi",
23
+ ]
24
+
25
+ [[package]]
26
+ name = "autocfg"
27
+ version = "1.1.0"
28
+ source = "registry+https://github.com/rust-lang/crates.io-index"
29
+ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
30
+
31
+ [[package]]
32
+ name = "bitflags"
33
+ version = "1.3.2"
34
+ source = "registry+https://github.com/rust-lang/crates.io-index"
35
+ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
36
+
37
+ [[package]]
38
+ name = "cbindgen"
39
+ version = "0.20.0"
40
+ source = "registry+https://github.com/rust-lang/crates.io-index"
41
+ checksum = "51e3973b165dc0f435831a9e426de67e894de532754ff7a3f307c03ee5dec7dc"
42
+ dependencies = [
43
+ "clap",
44
+ "heck",
45
+ "indexmap",
46
+ "log",
47
+ "proc-macro2",
48
+ "quote",
49
+ "serde",
50
+ "serde_json",
51
+ "syn",
52
+ "tempfile",
53
+ "toml",
54
+ ]
55
+
56
+ [[package]]
57
+ name = "cfg-if"
58
+ version = "1.0.0"
59
+ source = "registry+https://github.com/rust-lang/crates.io-index"
60
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
61
+
62
+ [[package]]
63
+ name = "clap"
64
+ version = "2.34.0"
65
+ source = "registry+https://github.com/rust-lang/crates.io-index"
66
+ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
67
+ dependencies = [
68
+ "ansi_term",
69
+ "atty",
70
+ "bitflags",
71
+ "strsim",
72
+ "textwrap",
73
+ "unicode-width",
74
+ "vec_map",
75
+ ]
76
+
77
+ [[package]]
78
+ name = "fastrand"
79
+ version = "1.9.0"
80
+ source = "registry+https://github.com/rust-lang/crates.io-index"
81
+ checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
82
+ dependencies = [
83
+ "instant",
84
+ ]
85
+
86
+ [[package]]
87
+ name = "hashbrown"
88
+ version = "0.12.3"
89
+ source = "registry+https://github.com/rust-lang/crates.io-index"
90
+ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
91
+
92
+ [[package]]
93
+ name = "heck"
94
+ version = "0.3.3"
95
+ source = "registry+https://github.com/rust-lang/crates.io-index"
96
+ checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
97
+ dependencies = [
98
+ "unicode-segmentation",
99
+ ]
100
+
101
+ [[package]]
102
+ name = "hermit-abi"
103
+ version = "0.1.19"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
106
+ dependencies = [
107
+ "libc",
108
+ ]
109
+
110
+ [[package]]
111
+ name = "indexmap"
112
+ version = "1.9.2"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
115
+ dependencies = [
116
+ "autocfg",
117
+ "hashbrown",
118
+ ]
119
+
120
+ [[package]]
121
+ name = "instant"
122
+ version = "0.1.12"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
125
+ dependencies = [
126
+ "cfg-if",
127
+ ]
128
+
129
+ [[package]]
130
+ name = "itoa"
131
+ version = "1.0.5"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
134
+
135
+ [[package]]
136
+ name = "libc"
137
+ version = "0.2.139"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
140
+
141
+ [[package]]
142
+ name = "log"
143
+ version = "0.4.17"
144
+ source = "registry+https://github.com/rust-lang/crates.io-index"
145
+ checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
146
+ dependencies = [
147
+ "cfg-if",
148
+ ]
149
+
150
+ [[package]]
151
+ name = "proc-macro2"
152
+ version = "1.0.51"
153
+ source = "registry+https://github.com/rust-lang/crates.io-index"
154
+ checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
155
+ dependencies = [
156
+ "unicode-ident",
157
+ ]
158
+
159
+ [[package]]
160
+ name = "quote"
161
+ version = "1.0.23"
162
+ source = "registry+https://github.com/rust-lang/crates.io-index"
163
+ checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
164
+ dependencies = [
165
+ "proc-macro2",
166
+ ]
167
+
168
+ [[package]]
169
+ name = "redox_syscall"
170
+ version = "0.2.16"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
173
+ dependencies = [
174
+ "bitflags",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "remove_dir_all"
179
+ version = "0.5.3"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
182
+ dependencies = [
183
+ "winapi",
184
+ ]
185
+
186
+ [[package]]
187
+ name = "ryu"
188
+ version = "1.0.12"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
191
+
192
+ [[package]]
193
+ name = "serde"
194
+ version = "1.0.152"
195
+ source = "registry+https://github.com/rust-lang/crates.io-index"
196
+ checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
197
+ dependencies = [
198
+ "serde_derive",
199
+ ]
200
+
201
+ [[package]]
202
+ name = "serde_derive"
203
+ version = "1.0.152"
204
+ source = "registry+https://github.com/rust-lang/crates.io-index"
205
+ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
206
+ dependencies = [
207
+ "proc-macro2",
208
+ "quote",
209
+ "syn",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "serde_json"
214
+ version = "1.0.93"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
217
+ dependencies = [
218
+ "itoa",
219
+ "ryu",
220
+ "serde",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "strsim"
225
+ version = "0.8.0"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
228
+
229
+ [[package]]
230
+ name = "syn"
231
+ version = "1.0.107"
232
+ source = "registry+https://github.com/rust-lang/crates.io-index"
233
+ checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
234
+ dependencies = [
235
+ "proc-macro2",
236
+ "quote",
237
+ "unicode-ident",
238
+ ]
239
+
240
+ [[package]]
241
+ name = "tempfile"
242
+ version = "3.3.0"
243
+ source = "registry+https://github.com/rust-lang/crates.io-index"
244
+ checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
245
+ dependencies = [
246
+ "cfg-if",
247
+ "fastrand",
248
+ "libc",
249
+ "redox_syscall",
250
+ "remove_dir_all",
251
+ "winapi",
252
+ ]
253
+
254
+ [[package]]
255
+ name = "textwrap"
256
+ version = "0.11.0"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
259
+ dependencies = [
260
+ "unicode-width",
261
+ ]
262
+
263
+ [[package]]
264
+ name = "thread_id"
265
+ version = "0.1.0"
266
+ dependencies = [
267
+ "cbindgen",
268
+ "libc",
269
+ ]
270
+
271
+ [[package]]
272
+ name = "toml"
273
+ version = "0.5.11"
274
+ source = "registry+https://github.com/rust-lang/crates.io-index"
275
+ checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
276
+ dependencies = [
277
+ "serde",
278
+ ]
279
+
280
+ [[package]]
281
+ name = "unicode-ident"
282
+ version = "1.0.6"
283
+ source = "registry+https://github.com/rust-lang/crates.io-index"
284
+ checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
285
+
286
+ [[package]]
287
+ name = "unicode-segmentation"
288
+ version = "1.10.1"
289
+ source = "registry+https://github.com/rust-lang/crates.io-index"
290
+ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
291
+
292
+ [[package]]
293
+ name = "unicode-width"
294
+ version = "0.1.10"
295
+ source = "registry+https://github.com/rust-lang/crates.io-index"
296
+ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
297
+
298
+ [[package]]
299
+ name = "vec_map"
300
+ version = "0.8.2"
301
+ source = "registry+https://github.com/rust-lang/crates.io-index"
302
+ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
303
+
304
+ [[package]]
305
+ name = "winapi"
306
+ version = "0.3.9"
307
+ source = "registry+https://github.com/rust-lang/crates.io-index"
308
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
309
+ dependencies = [
310
+ "winapi-i686-pc-windows-gnu",
311
+ "winapi-x86_64-pc-windows-gnu",
312
+ ]
313
+
314
+ [[package]]
315
+ name = "winapi-i686-pc-windows-gnu"
316
+ version = "0.4.0"
317
+ source = "registry+https://github.com/rust-lang/crates.io-index"
318
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
319
+
320
+ [[package]]
321
+ name = "winapi-x86_64-pc-windows-gnu"
322
+ version = "0.4.0"
323
+ source = "registry+https://github.com/rust-lang/crates.io-index"
324
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
@@ -2,6 +2,7 @@
2
2
  name = "thread_id"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
+ rust-version = "1.63"
5
6
 
6
7
  [lib]
7
8
  name = "thread_id"
@@ -1,3 +1,3 @@
1
1
  module Pyroscope
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.5.2'.freeze
3
3
  end
data/lib/pyroscope.rb CHANGED
@@ -22,7 +22,32 @@ module Pyroscope
22
22
  attach_function :thread_id, [], :uint64
23
23
  end
24
24
 
25
- Config = Struct.new(:application_name, :app_name, :server_address, :auth_token, :log_level, :sample_rate, :detect_subprocesses, :oncpu, :report_pid, :report_thread_id, :tags, :compression, :report_encoding) do
25
+ if defined?(::Rails::Engine)
26
+ class Engine < ::Rails::Engine
27
+ config.after_initialize do
28
+ next unless ::Pyroscope.current_config && ::Pyroscope.current_config.autoinstrument_rails
29
+
30
+ ::Pyroscope.initialize_rails_hooks
31
+ end
32
+ end
33
+ end
34
+
35
+ Config = Struct.new(
36
+ :application_name,
37
+ :app_name,
38
+ :server_address,
39
+ :auth_token,
40
+ :log_level,
41
+ :sample_rate,
42
+ :detect_subprocesses,
43
+ :oncpu,
44
+ :report_pid,
45
+ :report_thread_id,
46
+ :tags,
47
+ :compression,
48
+ :report_encoding,
49
+ :autoinstrument_rails,
50
+ ) do
26
51
  def initialize(*)
27
52
  super
28
53
  # defaults:
@@ -38,10 +63,15 @@ module Pyroscope
38
63
  self.tags = {}
39
64
  self.compression = 'gzip'
40
65
  self.report_encoding = 'pprof'
66
+ self.autoinstrument_rails = true
41
67
  end
42
68
  end
43
69
 
44
70
  class << self
71
+ def current_config
72
+ @config
73
+ end
74
+
45
75
  def configure
46
76
  @config = Config.new
47
77
 
@@ -64,11 +94,8 @@ module Pyroscope
64
94
  @log_level = 50
65
95
  end
66
96
 
67
- # Initialize Logging
68
97
  Rust.initialize_logging(@log_level)
69
98
 
70
-
71
- # initialize Pyroscope Agent
72
99
  Rust.initialize_agent(
73
100
  # these are defaults in case user-provided values are nil:
74
101
  @config.app_name || @config.application_name || "",
@@ -85,6 +112,17 @@ module Pyroscope
85
112
  )
86
113
  end
87
114
 
115
+ def initialize_rails_hooks
116
+ block = lambda do |ctrl, action|
117
+ Pyroscope.tag_wrapper({
118
+ "action" => "#{ctrl.controller_name}/#{ctrl.action_name}"
119
+ }, &action)
120
+ end
121
+
122
+ ActionController::API.__send__(:around_action, block) if defined? ActionController::API
123
+ ActionController::Base.__send__(:around_action, block) if defined? ActionController::Base
124
+ end
125
+
88
126
  def tag_wrapper(tags)
89
127
  tid = thread_id
90
128
  _add_tags(tid, tags)
@@ -103,32 +141,34 @@ module Pyroscope
103
141
  warn("deprecated. Use `Pyroscope.tag_wrapper` instead.")
104
142
  end
105
143
 
106
- # convert tags object to string
107
- def tags_to_string(tags)
108
- tags.map { |k, v| "#{k}=#{v}" }.join(',')
109
- end
110
-
111
- # get thread id
112
144
  def thread_id
113
145
  return Utils.thread_id
114
146
  end
115
147
 
116
- # add tags
117
148
  def _add_tags(thread_id, tags)
118
149
  tags.each do |tag_name, tag_value|
119
150
  Rust.add_thread_tag(thread_id, tag_name.to_s, tag_value.to_s)
120
151
  end
121
152
  end
122
153
 
123
- # remove tags
124
154
  def _remove_tags(thread_id, tags)
125
155
  tags.each do |tag_name, tag_value|
126
156
  Rust.remove_thread_tag(thread_id, tag_name.to_s, tag_value.to_s)
127
157
  end
128
158
  end
129
159
 
130
- def shutdown
160
+ def stop
131
161
  Rust.drop_agent
132
162
  end
163
+
164
+ def shutdown
165
+ stop
166
+ end
167
+
168
+ private
169
+
170
+ def tags_to_string(tags)
171
+ tags.map { |k, v| "#{k}=#{v}" }.join(',')
172
+ end
133
173
  end
134
174
  end
Binary file
Binary file
data/scripts/docker.sh CHANGED
@@ -1,16 +1,23 @@
1
1
  #!/bin/bash
2
2
  set -ex
3
3
 
4
+ if [ "${BUILD_ARCH}" != "manylinux2010_x86_64" ] && [ "${BUILD_ARCH}" != "manylinux2014_aarch64" ];
5
+ then
6
+ echo set BUILD_ARCH to one of manylinux2010_x86_64 or manylinux2014_aarch64
7
+ exit 239
8
+ fi
9
+
4
10
  BUILD_DIR="/work"
11
+ MANYLINUX_PREFIX=pyroscope/rust_builder
5
12
 
6
13
  docker run \
7
14
  -w /work/pyroscope_ffi/ruby/elflib/rbspy \
8
15
  -v `pwd`:/work \
9
- quay.io/pypa/${BUILD_ARCH} \
16
+ ${MANYLINUX_PREFIX}_${BUILD_ARCH} \
10
17
  sh manylinux.sh
11
18
 
12
19
  docker run \
13
20
  -w /work/pyroscope_ffi/ruby/elflib/thread_id \
14
21
  -v `pwd`:/work \
15
- quay.io/pypa/${BUILD_ARCH} \
22
+ ${MANYLINUX_PREFIX}_${BUILD_ARCH} \
16
23
  sh manylinux.sh
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyroscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Pyroscope Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -71,12 +71,14 @@ files:
71
71
  - elflib/thread_id/setup.cfg
72
72
  - elflib/thread_id/setup.py
73
73
  - elflib/thread_id/thread_id/__init__.py
74
+ - ext/rbspy/Cargo.lock
74
75
  - ext/rbspy/Cargo.toml
75
76
  - ext/rbspy/Rakefile
76
77
  - ext/rbspy/build.rs
77
78
  - ext/rbspy/cbindgen.toml
78
79
  - ext/rbspy/extconf.rb
79
80
  - ext/rbspy/src/lib.rs
81
+ - ext/thread_id/Cargo.lock
80
82
  - ext/thread_id/Cargo.toml
81
83
  - ext/thread_id/Rakefile
82
84
  - ext/thread_id/build.rs
@@ -114,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
116
  - !ruby/object:Gem::Version
115
117
  version: '0'
116
118
  requirements: []
117
- rubygems_version: 3.3.7
119
+ rubygems_version: 3.3.26
118
120
  signing_key:
119
121
  specification_version: 4
120
122
  summary: Pyroscope