pyroscope 0.5.2-arm64-darwin → 0.5.3-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
data/ext/rbspy/Cargo.toml CHANGED
@@ -14,6 +14,7 @@ pyroscope_rbspy = { path = "../../../../pyroscope_backends/pyroscope_rbspy" }
14
14
  ffikit = { path = "../../../ffikit" }
15
15
  pretty_env_logger = "0.4.0"
16
16
  inferno = "=0.11.14"
17
+ log = "0.4"
17
18
 
18
19
  [build-dependencies]
19
20
  cbindgen = "0.20.0"
data/ext/rbspy/src/lib.rs CHANGED
@@ -8,10 +8,14 @@ use std::str::FromStr;
8
8
  use ffikit::Signal;
9
9
  use pyroscope_rbspy::{rbspy_backend, RbspyConfig};
10
10
 
11
+ use pyroscope;
11
12
  use pyroscope::{pyroscope::Compression, PyroscopeAgent};
12
13
  use pyroscope::backend::{Report, StackFrame, Tag};
13
14
  use pyroscope::pyroscope::ReportEncoding;
14
15
 
16
+ const LOG_TAG: &str = "Pyroscope::rbspy::ffi";
17
+
18
+
15
19
  pub fn transform_report(report: Report) -> Report {
16
20
  let cwd = env::current_dir().unwrap();
17
21
  let cwd = cwd.to_str().unwrap_or("");
@@ -106,10 +110,21 @@ pub extern "C" fn initialize_logging(logging_level: u32) -> bool {
106
110
 
107
111
  #[no_mangle]
108
112
  pub extern "C" fn initialize_agent(
109
- application_name: *const c_char, server_address: *const c_char, auth_token: *const c_char,
110
- sample_rate: u32, detect_subprocesses: bool, oncpu: bool, report_pid: bool,
111
- report_thread_id: bool, tags: *const c_char, compression: *const c_char,
112
- report_encoding: *const c_char
113
+ application_name: *const c_char,
114
+ server_address: *const c_char,
115
+ auth_token: *const c_char,
116
+ basic_auth_user: *const c_char,
117
+ basic_auth_password: *const c_char,
118
+ sample_rate: u32,
119
+ detect_subprocesses: bool,
120
+ oncpu: bool,
121
+ report_pid: bool,
122
+ report_thread_id: bool,
123
+ tags: *const c_char,
124
+ compression: *const c_char,
125
+ report_encoding: *const c_char,
126
+ scope_org_id: *const c_char,
127
+ http_headers_json: *const c_char,
113
128
  ) -> bool {
114
129
  // Initialize FFIKit
115
130
  let recv = ffikit::initialize_ffi().unwrap();
@@ -129,6 +144,16 @@ pub extern "C" fn initialize_agent(
129
144
  .unwrap()
130
145
  .to_string();
131
146
 
147
+ let basic_auth_user = unsafe { CStr::from_ptr(basic_auth_user) }
148
+ .to_str()
149
+ .unwrap()
150
+ .to_string();
151
+
152
+ let basic_auth_password = unsafe { CStr::from_ptr(basic_auth_password) }
153
+ .to_str()
154
+ .unwrap()
155
+ .to_string();
156
+
132
157
  let tags_string = unsafe { CStr::from_ptr(tags) }
133
158
  .to_str()
134
159
  .unwrap()
@@ -144,6 +169,16 @@ pub extern "C" fn initialize_agent(
144
169
  .unwrap()
145
170
  .to_string();
146
171
 
172
+ let scope_org_id = unsafe { CStr::from_ptr(scope_org_id) }
173
+ .to_str()
174
+ .unwrap()
175
+ .to_string();
176
+
177
+ let http_headers_json = unsafe { CStr::from_ptr(http_headers_json) }
178
+ .to_str()
179
+ .unwrap()
180
+ .to_string();
181
+
147
182
  let compression = Compression::from_str(&compression_string);
148
183
  let report_encoding = ReportEncoding::from_str(&report_encoding)
149
184
  .unwrap_or(ReportEncoding::FOLDED);
@@ -170,6 +205,30 @@ pub extern "C" fn initialize_agent(
170
205
 
171
206
  if auth_token != "" {
172
207
  agent_builder = agent_builder.auth_token(auth_token);
208
+ } else if basic_auth_user != "" && basic_auth_password != "" {
209
+ agent_builder = agent_builder.basic_auth(basic_auth_user, basic_auth_password);
210
+ }
211
+
212
+ if scope_org_id != "" {
213
+ agent_builder = agent_builder.scope_org_id(scope_org_id);
214
+ }
215
+
216
+ let http_headers = pyroscope::pyroscope::parse_http_headers_json(http_headers_json);
217
+ match http_headers {
218
+ Ok(http_headers) => {
219
+ agent_builder = agent_builder.http_headers(http_headers);
220
+ }
221
+ Err(e) => {
222
+ match e {
223
+ pyroscope::PyroscopeError::Json(e) => {
224
+ log::error!(target: LOG_TAG, "parse_http_headers_json error {}", e);
225
+ }
226
+ pyroscope::PyroscopeError::AdHoc(e) => {
227
+ log::error!(target: LOG_TAG, "parse_http_headers_json {}", e);
228
+ }
229
+ _ => {}
230
+ }
231
+ }
173
232
  }
174
233
 
175
234
  if let Ok(compression) = compression {
@@ -17,7 +17,7 @@ version = "0.2.14"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
18
  checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
19
19
  dependencies = [
20
- "hermit-abi",
20
+ "hermit-abi 0.1.19",
21
21
  "libc",
22
22
  "winapi",
23
23
  ]
@@ -48,11 +48,17 @@ dependencies = [
48
48
  "quote",
49
49
  "serde",
50
50
  "serde_json",
51
- "syn",
51
+ "syn 1.0.109",
52
52
  "tempfile",
53
53
  "toml",
54
54
  ]
55
55
 
56
+ [[package]]
57
+ name = "cc"
58
+ version = "1.0.79"
59
+ source = "registry+https://github.com/rust-lang/crates.io-index"
60
+ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
61
+
56
62
  [[package]]
57
63
  name = "cfg-if"
58
64
  version = "1.0.0"
@@ -74,6 +80,27 @@ dependencies = [
74
80
  "vec_map",
75
81
  ]
76
82
 
83
+ [[package]]
84
+ name = "errno"
85
+ version = "0.3.1"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
88
+ dependencies = [
89
+ "errno-dragonfly",
90
+ "libc",
91
+ "windows-sys 0.48.0",
92
+ ]
93
+
94
+ [[package]]
95
+ name = "errno-dragonfly"
96
+ version = "0.1.2"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
99
+ dependencies = [
100
+ "cc",
101
+ "libc",
102
+ ]
103
+
77
104
  [[package]]
78
105
  name = "fastrand"
79
106
  version = "1.9.0"
@@ -107,11 +134,17 @@ dependencies = [
107
134
  "libc",
108
135
  ]
109
136
 
137
+ [[package]]
138
+ name = "hermit-abi"
139
+ version = "0.3.1"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
142
+
110
143
  [[package]]
111
144
  name = "indexmap"
112
- version = "1.9.2"
145
+ version = "1.9.3"
113
146
  source = "registry+https://github.com/rust-lang/crates.io-index"
114
- checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
147
+ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
115
148
  dependencies = [
116
149
  "autocfg",
117
150
  "hashbrown",
@@ -126,17 +159,34 @@ dependencies = [
126
159
  "cfg-if",
127
160
  ]
128
161
 
162
+ [[package]]
163
+ name = "io-lifetimes"
164
+ version = "1.0.10"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+ checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
167
+ dependencies = [
168
+ "hermit-abi 0.3.1",
169
+ "libc",
170
+ "windows-sys 0.48.0",
171
+ ]
172
+
129
173
  [[package]]
130
174
  name = "itoa"
131
- version = "1.0.5"
175
+ version = "1.0.6"
132
176
  source = "registry+https://github.com/rust-lang/crates.io-index"
133
- checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
177
+ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
134
178
 
135
179
  [[package]]
136
180
  name = "libc"
137
- version = "0.2.139"
181
+ version = "0.2.142"
138
182
  source = "registry+https://github.com/rust-lang/crates.io-index"
139
- checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
183
+ checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
184
+
185
+ [[package]]
186
+ name = "linux-raw-sys"
187
+ version = "0.3.4"
188
+ source = "registry+https://github.com/rust-lang/crates.io-index"
189
+ checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf"
140
190
 
141
191
  [[package]]
142
192
  name = "log"
@@ -149,71 +199,76 @@ dependencies = [
149
199
 
150
200
  [[package]]
151
201
  name = "proc-macro2"
152
- version = "1.0.51"
202
+ version = "1.0.56"
153
203
  source = "registry+https://github.com/rust-lang/crates.io-index"
154
- checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
204
+ checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
155
205
  dependencies = [
156
206
  "unicode-ident",
157
207
  ]
158
208
 
159
209
  [[package]]
160
210
  name = "quote"
161
- version = "1.0.23"
211
+ version = "1.0.26"
162
212
  source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
213
+ checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
164
214
  dependencies = [
165
215
  "proc-macro2",
166
216
  ]
167
217
 
168
218
  [[package]]
169
219
  name = "redox_syscall"
170
- version = "0.2.16"
220
+ version = "0.3.5"
171
221
  source = "registry+https://github.com/rust-lang/crates.io-index"
172
- checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
222
+ checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
173
223
  dependencies = [
174
224
  "bitflags",
175
225
  ]
176
226
 
177
227
  [[package]]
178
- name = "remove_dir_all"
179
- version = "0.5.3"
228
+ name = "rustix"
229
+ version = "0.37.15"
180
230
  source = "registry+https://github.com/rust-lang/crates.io-index"
181
- checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
231
+ checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece"
182
232
  dependencies = [
183
- "winapi",
233
+ "bitflags",
234
+ "errno",
235
+ "io-lifetimes",
236
+ "libc",
237
+ "linux-raw-sys",
238
+ "windows-sys 0.48.0",
184
239
  ]
185
240
 
186
241
  [[package]]
187
242
  name = "ryu"
188
- version = "1.0.12"
243
+ version = "1.0.13"
189
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
190
- checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
245
+ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
191
246
 
192
247
  [[package]]
193
248
  name = "serde"
194
- version = "1.0.152"
249
+ version = "1.0.160"
195
250
  source = "registry+https://github.com/rust-lang/crates.io-index"
196
- checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
251
+ checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
197
252
  dependencies = [
198
253
  "serde_derive",
199
254
  ]
200
255
 
201
256
  [[package]]
202
257
  name = "serde_derive"
203
- version = "1.0.152"
258
+ version = "1.0.160"
204
259
  source = "registry+https://github.com/rust-lang/crates.io-index"
205
- checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
260
+ checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
206
261
  dependencies = [
207
262
  "proc-macro2",
208
263
  "quote",
209
- "syn",
264
+ "syn 2.0.15",
210
265
  ]
211
266
 
212
267
  [[package]]
213
268
  name = "serde_json"
214
- version = "1.0.93"
269
+ version = "1.0.96"
215
270
  source = "registry+https://github.com/rust-lang/crates.io-index"
216
- checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
271
+ checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
217
272
  dependencies = [
218
273
  "itoa",
219
274
  "ryu",
@@ -228,9 +283,20 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
228
283
 
229
284
  [[package]]
230
285
  name = "syn"
231
- version = "1.0.107"
286
+ version = "1.0.109"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
289
+ dependencies = [
290
+ "proc-macro2",
291
+ "quote",
292
+ "unicode-ident",
293
+ ]
294
+
295
+ [[package]]
296
+ name = "syn"
297
+ version = "2.0.15"
232
298
  source = "registry+https://github.com/rust-lang/crates.io-index"
233
- checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
299
+ checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
234
300
  dependencies = [
235
301
  "proc-macro2",
236
302
  "quote",
@@ -239,16 +305,15 @@ dependencies = [
239
305
 
240
306
  [[package]]
241
307
  name = "tempfile"
242
- version = "3.3.0"
308
+ version = "3.5.0"
243
309
  source = "registry+https://github.com/rust-lang/crates.io-index"
244
- checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
310
+ checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
245
311
  dependencies = [
246
312
  "cfg-if",
247
313
  "fastrand",
248
- "libc",
249
314
  "redox_syscall",
250
- "remove_dir_all",
251
- "winapi",
315
+ "rustix",
316
+ "windows-sys 0.45.0",
252
317
  ]
253
318
 
254
319
  [[package]]
@@ -279,9 +344,9 @@ dependencies = [
279
344
 
280
345
  [[package]]
281
346
  name = "unicode-ident"
282
- version = "1.0.6"
347
+ version = "1.0.8"
283
348
  source = "registry+https://github.com/rust-lang/crates.io-index"
284
- checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
349
+ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
285
350
 
286
351
  [[package]]
287
352
  name = "unicode-segmentation"
@@ -322,3 +387,135 @@ name = "winapi-x86_64-pc-windows-gnu"
322
387
  version = "0.4.0"
323
388
  source = "registry+https://github.com/rust-lang/crates.io-index"
324
389
  checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
390
+
391
+ [[package]]
392
+ name = "windows-sys"
393
+ version = "0.45.0"
394
+ source = "registry+https://github.com/rust-lang/crates.io-index"
395
+ checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
396
+ dependencies = [
397
+ "windows-targets 0.42.2",
398
+ ]
399
+
400
+ [[package]]
401
+ name = "windows-sys"
402
+ version = "0.48.0"
403
+ source = "registry+https://github.com/rust-lang/crates.io-index"
404
+ checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
405
+ dependencies = [
406
+ "windows-targets 0.48.0",
407
+ ]
408
+
409
+ [[package]]
410
+ name = "windows-targets"
411
+ version = "0.42.2"
412
+ source = "registry+https://github.com/rust-lang/crates.io-index"
413
+ checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
414
+ dependencies = [
415
+ "windows_aarch64_gnullvm 0.42.2",
416
+ "windows_aarch64_msvc 0.42.2",
417
+ "windows_i686_gnu 0.42.2",
418
+ "windows_i686_msvc 0.42.2",
419
+ "windows_x86_64_gnu 0.42.2",
420
+ "windows_x86_64_gnullvm 0.42.2",
421
+ "windows_x86_64_msvc 0.42.2",
422
+ ]
423
+
424
+ [[package]]
425
+ name = "windows-targets"
426
+ version = "0.48.0"
427
+ source = "registry+https://github.com/rust-lang/crates.io-index"
428
+ checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
429
+ dependencies = [
430
+ "windows_aarch64_gnullvm 0.48.0",
431
+ "windows_aarch64_msvc 0.48.0",
432
+ "windows_i686_gnu 0.48.0",
433
+ "windows_i686_msvc 0.48.0",
434
+ "windows_x86_64_gnu 0.48.0",
435
+ "windows_x86_64_gnullvm 0.48.0",
436
+ "windows_x86_64_msvc 0.48.0",
437
+ ]
438
+
439
+ [[package]]
440
+ name = "windows_aarch64_gnullvm"
441
+ version = "0.42.2"
442
+ source = "registry+https://github.com/rust-lang/crates.io-index"
443
+ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
444
+
445
+ [[package]]
446
+ name = "windows_aarch64_gnullvm"
447
+ version = "0.48.0"
448
+ source = "registry+https://github.com/rust-lang/crates.io-index"
449
+ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
450
+
451
+ [[package]]
452
+ name = "windows_aarch64_msvc"
453
+ version = "0.42.2"
454
+ source = "registry+https://github.com/rust-lang/crates.io-index"
455
+ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
456
+
457
+ [[package]]
458
+ name = "windows_aarch64_msvc"
459
+ version = "0.48.0"
460
+ source = "registry+https://github.com/rust-lang/crates.io-index"
461
+ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
462
+
463
+ [[package]]
464
+ name = "windows_i686_gnu"
465
+ version = "0.42.2"
466
+ source = "registry+https://github.com/rust-lang/crates.io-index"
467
+ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
468
+
469
+ [[package]]
470
+ name = "windows_i686_gnu"
471
+ version = "0.48.0"
472
+ source = "registry+https://github.com/rust-lang/crates.io-index"
473
+ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
474
+
475
+ [[package]]
476
+ name = "windows_i686_msvc"
477
+ version = "0.42.2"
478
+ source = "registry+https://github.com/rust-lang/crates.io-index"
479
+ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
480
+
481
+ [[package]]
482
+ name = "windows_i686_msvc"
483
+ version = "0.48.0"
484
+ source = "registry+https://github.com/rust-lang/crates.io-index"
485
+ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
486
+
487
+ [[package]]
488
+ name = "windows_x86_64_gnu"
489
+ version = "0.42.2"
490
+ source = "registry+https://github.com/rust-lang/crates.io-index"
491
+ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
492
+
493
+ [[package]]
494
+ name = "windows_x86_64_gnu"
495
+ version = "0.48.0"
496
+ source = "registry+https://github.com/rust-lang/crates.io-index"
497
+ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
498
+
499
+ [[package]]
500
+ name = "windows_x86_64_gnullvm"
501
+ version = "0.42.2"
502
+ source = "registry+https://github.com/rust-lang/crates.io-index"
503
+ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
504
+
505
+ [[package]]
506
+ name = "windows_x86_64_gnullvm"
507
+ version = "0.48.0"
508
+ source = "registry+https://github.com/rust-lang/crates.io-index"
509
+ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
510
+
511
+ [[package]]
512
+ name = "windows_x86_64_msvc"
513
+ version = "0.42.2"
514
+ source = "registry+https://github.com/rust-lang/crates.io-index"
515
+ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
516
+
517
+ [[package]]
518
+ name = "windows_x86_64_msvc"
519
+ version = "0.48.0"
520
+ source = "registry+https://github.com/rust-lang/crates.io-index"
521
+ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
@@ -1,3 +1,3 @@
1
1
  module Pyroscope
2
- VERSION = '0.5.2'.freeze
2
+ VERSION = '0.5.3'.freeze
3
3
  end
data/lib/pyroscope.rb CHANGED
@@ -2,13 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'ffi'
5
+ require 'json'
5
6
 
6
7
  module Pyroscope
7
8
  module Rust
8
9
  extend FFI::Library
9
10
  ffi_lib File.expand_path(File.dirname(__FILE__)) + "/rbspy/rbspy.#{RbConfig::CONFIG["DLEXT"]}"
10
11
  attach_function :initialize_logging, [:int], :bool
11
- attach_function :initialize_agent, [:string, :string, :string, :int, :bool, :bool, :bool, :bool, :string, :string, :string], :bool
12
+ attach_function :initialize_agent, [:string, :string, :string, :string, :string, :int, :bool, :bool, :bool, :bool, :string, :string, :string, :string, :string], :bool
12
13
  attach_function :add_thread_tag, [:uint64, :string, :string], :bool
13
14
  attach_function :remove_thread_tag, [:uint64, :string, :string], :bool
14
15
  attach_function :add_global_tag, [:string, :string], :bool
@@ -37,6 +38,8 @@ module Pyroscope
37
38
  :app_name,
38
39
  :server_address,
39
40
  :auth_token,
41
+ :basic_auth_username,
42
+ :basic_auth_password,
40
43
  :log_level,
41
44
  :sample_rate,
42
45
  :detect_subprocesses,
@@ -47,6 +50,8 @@ module Pyroscope
47
50
  :compression,
48
51
  :report_encoding,
49
52
  :autoinstrument_rails,
53
+ :scope_org_id,
54
+ :http_headers,
50
55
  ) do
51
56
  def initialize(*)
52
57
  super
@@ -54,6 +59,8 @@ module Pyroscope
54
59
  self.application_name = ''
55
60
  self.server_address = 'http://localhost:4040'
56
61
  self.auth_token = ''
62
+ self.basic_auth_username = ''
63
+ self.basic_auth_password = ''
57
64
  self.sample_rate = 100
58
65
  self.detect_subprocesses = false
59
66
  self.oncpu = true
@@ -64,6 +71,8 @@ module Pyroscope
64
71
  self.compression = 'gzip'
65
72
  self.report_encoding = 'pprof'
66
73
  self.autoinstrument_rails = true
74
+ self.scope_org_id = ''
75
+ self.http_headers = {}
67
76
  end
68
77
  end
69
78
 
@@ -101,6 +110,8 @@ module Pyroscope
101
110
  @config.app_name || @config.application_name || "",
102
111
  @config.server_address || "",
103
112
  @config.auth_token || "",
113
+ @config.basic_auth_username || "",
114
+ @config.basic_auth_password || "",
104
115
  @config.sample_rate || 100,
105
116
  @config.detect_subprocesses || false,
106
117
  @config.oncpu || false,
@@ -108,7 +119,9 @@ module Pyroscope
108
119
  @config.report_thread_id || false,
109
120
  tags_to_string(@config.tags || {}),
110
121
  @config.compression || "",
111
- @config.report_encoding || "pprof"
122
+ @config.report_encoding || "pprof",
123
+ @config.scope_org_id || "",
124
+ http_headers_to_json(@config.http_headers || {})
112
125
  )
113
126
  end
114
127
 
@@ -170,5 +183,10 @@ module Pyroscope
170
183
  def tags_to_string(tags)
171
184
  tags.map { |k, v| "#{k}=#{v}" }.join(',')
172
185
  end
186
+
187
+ def http_headers_to_json(http_headers)
188
+ JSON.dump(http_headers)
189
+ end
190
+
173
191
  end
174
192
  end
Binary file
Binary file
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.2
4
+ version: 0.5.3
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Pyroscope Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi