pyroscope_beta 0.2.0-x86_64-linux → 0.2.3-x86_64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ec743f7959ad8b78fb8b943d69234262a2e9ebf327a0a11058e712f90877b80
4
- data.tar.gz: f2573016238b9ef10a3dab0cad12a91e691a7e8841a613f74c0edb0e4b084247
3
+ metadata.gz: 6ccf9727c5185ebd79ec4a3e1b699ac40ce589b8919aec71bdfceaf9faa69e3a
4
+ data.tar.gz: b94d146c4177ee10d6ae3ae421540d6b6a34f9037d76d6d671d581c4857ef54e
5
5
  SHA512:
6
- metadata.gz: a75731d0a54f8cca67221de682d44a1cc260daeab49efb659126cbd71d1de3ae76b911de5154cd68cd8aec78f60ff7a7b1d10209081d7e29ad36925a6bfaa2bc
7
- data.tar.gz: 88fdd672d6c518f959b11d222adb81112a2e6e0c2665604bb67441b43128cf86e73621eec60ba56abe8bddf5334d6e3c8a7c9fa97f23e8cbe4bc79584ea63824
6
+ metadata.gz: 72473e4b6464dd002b0d5d698d844ef8887f1fbb16e91e5d7a12a748c3efe1a2ecf231f3f56ce5f0978fc266d65e049eca50442a50312805213db1a66dce51d0
7
+ data.tar.gz: ecc1077338f7193a9a79de530b5c8b59059c528e083b799909aa2095b0696c3f7ab9ebbfe8d979930b33aaf0651a21890c0d3c4cf0481c51caad1c92afe4b663
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # Install tooling
5
+ #yum -y -q install wget gcc libffi-devel openssl-devel
6
+
7
+ # Install Rust
8
+ #curl https://sh.rustup.rs -sSf | sh -s -- -y
9
+ #export PATH=~/.cargo/bin:$PATH
10
+
11
+ # Build wheels
12
+ #/opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
13
+
14
+ # Audit wheels
15
+ #for wheel in dist/*.whl; do
16
+ #auditwheel repair $wheel -w dist/
17
+ #rm $wheel
18
+ #done
19
+
20
+ # Extract wheels
21
+ for wheel in dist/*.whl; do
22
+ /opt/python/cp37-cp37m/bin/wheel unpack $wheel -d wheelhouse
23
+ done
@@ -0,0 +1,7 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=42",
4
+ "wheel",
5
+ "milksnakex>=0.1.6"
6
+ ]
7
+ build-backend = "setuptools.build_meta"
File without changes
@@ -0,0 +1,22 @@
1
+ [metadata]
2
+ name = rbspy
3
+ version= 1.0.0
4
+ description = Fake wheel to generate audtiwheel libs
5
+ url = https://proscope.io
6
+ maintainer = Abid Omar
7
+ maintainer_email = contact@pyroscope.io
8
+ license = Apache 2.0
9
+ classifiers =
10
+ Intended Audience :: Developers
11
+ project_urls =
12
+ Documentation = https://proscope.io
13
+ Bug Tracker = https://proscope.io
14
+ Discussions = https://proscope.io
15
+ Changelog = https://proscope.io
16
+
17
+ [options]
18
+ packages = find:
19
+ install_requires =
20
+ milksnakex>=0.1.6
21
+ include_package_data = True
22
+ zip_safe = False
@@ -0,0 +1,46 @@
1
+ import os
2
+ import sys
3
+ from setuptools import find_packages, setup
4
+ from pathlib import Path
5
+
6
+ SCRIPT_DIR = Path(__file__).resolve().parent
7
+
8
+ os.chdir(SCRIPT_DIR)
9
+
10
+ # print script_dir
11
+ print(SCRIPT_DIR)
12
+
13
+ LIB_DIR = str(SCRIPT_DIR / "../../ext/rbspy")
14
+
15
+ def build_native(spec):
16
+ # Step 1: build the rust library
17
+ build = spec.add_external_build(
18
+ cmd=['cargo', 'build', '--release'],
19
+ path=LIB_DIR
20
+ )
21
+
22
+ def find_dylib():
23
+ cargo_target = os.environ.get('CARGO_BUILD_TARGET')
24
+ if cargo_target:
25
+ in_path = 'target/%s/release' % (cargo_target)
26
+ else:
27
+ in_path = 'target/release'
28
+ return build.find_dylib('rbspy', in_path=in_path)
29
+
30
+ # Step 2: package the compiled library
31
+ rtld_flags = ["NOW"]
32
+ if sys.platform == "darwin":
33
+ rtld_flags.append("NODELETE")
34
+
35
+ spec.add_cffi_module(module_path='rbspy._native',
36
+ dylib=find_dylib,
37
+ header_filename=lambda:
38
+ build.find_header('rbspy.h',in_path='include'),
39
+ rtld_flags=rtld_flags,
40
+ )
41
+
42
+ setup(
43
+ platforms="any",
44
+ milksnake_tasks=[build_native],
45
+ setup_requires=["milksnakex>=0.1.6"],
46
+ )
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # Install tooling
5
+ #yum -y -q install wget gcc libffi-devel openssl-devel
6
+
7
+ # Install Rust
8
+ #curl https://sh.rustup.rs -sSf | sh -s -- -y
9
+ #export PATH=~/.cargo/bin:$PATH
10
+
11
+ # Build wheels
12
+ #/opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
13
+
14
+ # Audit wheels
15
+ #for wheel in dist/*.whl; do
16
+ #auditwheel repair $wheel -w dist/
17
+ #rm $wheel
18
+ #done
19
+
20
+ # Extract wheels
21
+ for wheel in dist/*.whl; do
22
+ /opt/python/cp37-cp37m/bin/wheel unpack $wheel -d wheelhouse
23
+ done
@@ -0,0 +1,7 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=42",
4
+ "wheel",
5
+ "milksnakex>=0.1.6"
6
+ ]
7
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,22 @@
1
+ [metadata]
2
+ name = thread_id
3
+ version= 1.0.0
4
+ description = Fake wheel to generate audtiwheel libs
5
+ url = https://proscope.io
6
+ maintainer = Abid Omar
7
+ maintainer_email = contact@pyroscope.io
8
+ license = Apache 2.0
9
+ classifiers =
10
+ Intended Audience :: Developers
11
+ project_urls =
12
+ Documentation = https://proscope.io
13
+ Bug Tracker = https://proscope.io
14
+ Discussions = https://proscope.io
15
+ Changelog = https://proscope.io
16
+
17
+ [options]
18
+ packages = find:
19
+ install_requires =
20
+ milksnakex>=0.1.6
21
+ include_package_data = True
22
+ zip_safe = False
@@ -0,0 +1,46 @@
1
+ import os
2
+ import sys
3
+ from setuptools import find_packages, setup
4
+ from pathlib import Path
5
+
6
+ SCRIPT_DIR = Path(__file__).resolve().parent
7
+
8
+ os.chdir(SCRIPT_DIR)
9
+
10
+ # print script_dir
11
+ print(SCRIPT_DIR)
12
+
13
+ LIB_DIR = str(SCRIPT_DIR / "../../ext/thread_id")
14
+
15
+ def build_native(spec):
16
+ # Step 1: build the rust library
17
+ build = spec.add_external_build(
18
+ cmd=['cargo', 'build', '--release'],
19
+ path=LIB_DIR
20
+ )
21
+
22
+ def find_dylib():
23
+ cargo_target = os.environ.get('CARGO_BUILD_TARGET')
24
+ if cargo_target:
25
+ in_path = 'target/%s/release' % (cargo_target)
26
+ else:
27
+ in_path = 'target/release'
28
+ return build.find_dylib('thread_id', in_path=in_path)
29
+
30
+ # Step 2: package the compiled library
31
+ rtld_flags = ["NOW"]
32
+ if sys.platform == "darwin":
33
+ rtld_flags.append("NODELETE")
34
+
35
+ spec.add_cffi_module(module_path='thread_id._native',
36
+ dylib=find_dylib,
37
+ header_filename=lambda:
38
+ build.find_header('thread_id.h',in_path='include'),
39
+ rtld_flags=rtld_flags,
40
+ )
41
+
42
+ setup(
43
+ platforms="any",
44
+ milksnake_tasks=[build_native],
45
+ setup_requires=["milksnakex>=0.1.6"],
46
+ )
File without changes
data/ext/rbspy/Cargo.toml CHANGED
@@ -13,3 +13,12 @@ pyroscope_rbspy = { version = "0.2" }
13
13
 
14
14
  [patch.crates-io]
15
15
  read-process-memory = {git = "https://github.com/omarabid/read-process-memory.git", branch = "0.1.4-fix"}
16
+
17
+ [build-dependencies]
18
+ cbindgen = "0.20.0"
19
+
20
+ [profile.release]
21
+ opt-level= "z"
22
+ debug = false
23
+ lto = true
24
+ codegen-units = 1
@@ -0,0 +1,12 @@
1
+ extern crate cbindgen;
2
+
3
+ use cbindgen::Config;
4
+
5
+ fn main() {
6
+ let bindings = {
7
+ let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
8
+ let config = Config::from_file("cbindgen.toml").unwrap();
9
+ cbindgen::generate_with_config(&crate_dir, config).unwrap()
10
+ };
11
+ bindings.write_to_file("include/rbspy.h");
12
+ }
@@ -0,0 +1,22 @@
1
+ # The language to output bindings in
2
+ language = "C"
3
+ documentation_style = "C"
4
+
5
+ style = "type"
6
+
7
+ # An optional name to use as an include guard
8
+ include_guard = "RBSPY_H_"
9
+ # include a comment with the version of cbindgen used to generate the file
10
+ include_version = true
11
+
12
+ # An optional string of text to output at the beginning of the generated file
13
+ header = "/* Licensed under Apache-2.0 */"
14
+ autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
15
+
16
+ braces = "SameLine"
17
+ tab_width = 2
18
+ line_length = 80
19
+
20
+ [parse]
21
+ # Do not parse dependent crates
22
+ parse_deps = false
data/ext/rbspy/src/lib.rs CHANGED
@@ -36,17 +36,24 @@ fn signalpass() -> &'static SignalPass {
36
36
 
37
37
  #[no_mangle]
38
38
  pub extern "C" fn initialize_agent(
39
- application_name: *const c_char, server_address: *const c_char, sample_rate: u32,
40
- detect_subprocesses: bool, tags: *const c_char,
39
+ application_name: *const c_char, server_address: *const c_char, auth_token: *const c_char,
40
+ sample_rate: u32, detect_subprocesses: bool, tags: *const c_char,
41
41
  ) -> bool {
42
42
  let application_name = unsafe { CStr::from_ptr(application_name) }
43
43
  .to_str()
44
44
  .unwrap()
45
45
  .to_string();
46
+
46
47
  let server_address = unsafe { CStr::from_ptr(server_address) }
47
48
  .to_str()
48
49
  .unwrap()
49
50
  .to_string();
51
+
52
+ let auth_token = unsafe { CStr::from_ptr(auth_token) }
53
+ .to_str()
54
+ .unwrap()
55
+ .to_string();
56
+
50
57
  let tags_string = unsafe { CStr::from_ptr(tags) }
51
58
  .to_str()
52
59
  .unwrap()
@@ -65,11 +72,16 @@ pub extern "C" fn initialize_agent(
65
72
  let tags_ref = tags_string.as_str();
66
73
  let tags = string_to_tags(tags_ref);
67
74
  let rbspy = rbspy_backend(rbspy_config);
68
- let agent = PyroscopeAgent::builder(server_address, application_name)
75
+
76
+ let mut agent_builder = PyroscopeAgent::builder(server_address, application_name)
69
77
  .backend(rbspy)
70
- .tags(tags)
71
- .build()
72
- .unwrap();
78
+ .tags(tags);
79
+
80
+ if auth_token != "" {
81
+ agent_builder = agent_builder.auth_token(auth_token);
82
+ }
83
+
84
+ let agent = agent_builder.build().unwrap();
73
85
 
74
86
  let agent_running = agent.start().unwrap();
75
87
 
@@ -9,3 +9,12 @@ crate-type = ["cdylib"]
9
9
 
10
10
  [dependencies]
11
11
  libc = "*"
12
+
13
+ [build-dependencies]
14
+ cbindgen = "0.20.0"
15
+
16
+ [profile.release]
17
+ opt-level= "z"
18
+ debug = false
19
+ lto = true
20
+ codegen-units = 1
@@ -0,0 +1,12 @@
1
+ extern crate cbindgen;
2
+
3
+ use cbindgen::Config;
4
+
5
+ fn main() {
6
+ let bindings = {
7
+ let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
8
+ let config = Config::from_file("cbindgen.toml").unwrap();
9
+ cbindgen::generate_with_config(&crate_dir, config).unwrap()
10
+ };
11
+ bindings.write_to_file("include/thread_id.h");
12
+ }
@@ -0,0 +1,22 @@
1
+ # The language to output bindings in
2
+ language = "C"
3
+ documentation_style = "C"
4
+
5
+ style = "type"
6
+
7
+ # An optional name to use as an include guard
8
+ include_guard = "RBSPY_H_"
9
+ # include a comment with the version of cbindgen used to generate the file
10
+ include_version = true
11
+
12
+ # An optional string of text to output at the beginning of the generated file
13
+ header = "/* Licensed under Apache-2.0 */"
14
+ autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
15
+
16
+ braces = "SameLine"
17
+ tab_width = 2
18
+ line_length = 80
19
+
20
+ [parse]
21
+ # Do not parse dependent crates
22
+ parse_deps = false
@@ -1,3 +1,3 @@
1
1
  module Pyroscope
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
@@ -1,24 +1,27 @@
1
1
  require 'ffi'
2
- require 'fiddle'
3
-
4
- $libm = Fiddle.dlopen(File.expand_path(File.dirname(__FILE__)) + "/thread_id/thread_id.#{RbConfig::CONFIG["DLEXT"]}")
5
-
6
2
 
7
3
  module Rust
8
4
  extend FFI::Library
9
5
  ffi_lib File.expand_path(File.dirname(__FILE__)) + "/rbspy/rbspy.#{RbConfig::CONFIG["DLEXT"]}"
10
- attach_function :initialize_agent, [:string, :string, :int, :bool, :string], :bool
6
+ attach_function :initialize_agent, [:string, :string, :string, :int, :bool, :string], :bool
11
7
  attach_function :add_tag, [:uint64, :string, :string], :bool
12
8
  attach_function :remove_tag, [:uint64, :string, :string], :bool
13
9
  attach_function :drop_agent, [], :bool
14
10
  end
15
11
 
12
+ module Utils
13
+ extend FFI::Library
14
+ ffi_lib File.expand_path(File.dirname(__FILE__)) + "/thread_id/thread_id.#{RbConfig::CONFIG["DLEXT"]}"
15
+ attach_function :thread_id, [], :uint64
16
+ end
17
+
16
18
  module Pyroscope
17
- Config = Struct.new(:application_name, :server_address, :sample_rate, :detect_subprocesses, :log_level, :tags) do
19
+ Config = Struct.new(:application_name, :server_address, :auth_token, :sample_rate, :detect_subprocesses, :log_level, :tags) do
18
20
  def initialize(*)
19
21
  super
20
22
  self.application_name ||= ''
21
23
  self.server_address ||= 'http://localhost:4040'
24
+ self.auth_token ||= ''
22
25
  self.sample_rate ||= 100
23
26
  self.detect_subprocesses ||= true
24
27
  self.log_level ||= 'info'
@@ -36,6 +39,7 @@ module Pyroscope
36
39
  Rust.initialize_agent(
37
40
  @config.application_name,
38
41
  @config.server_address,
42
+ @config.auth_token,
39
43
  @config.sample_rate,
40
44
  @config.detect_subprocesses,
41
45
  tags_to_string(@config.tags)
@@ -66,8 +70,7 @@ end
66
70
 
67
71
  # get thread id
68
72
  def thread_id
69
- thread_id = Fiddle::Function.new($libm['thread_id'], [], Fiddle::TYPE_LONG_LONG)
70
- thread_id.call
73
+ return Utils.thread_id()
71
74
  end
72
75
 
73
76
  # add tags
data/lib/rbspy/rbspy.so CHANGED
Binary file
Binary file
data/pyroscope.gemspec CHANGED
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
26
26
  s.extensions = ['ext/rbspy/extconf.rb', 'ext/thread_id/extconf.rb']
27
27
 
28
28
  s.add_dependency 'ffi'
29
- s.add_dependency 'fiddle'
30
29
 
31
30
  s.add_development_dependency 'bundler'
32
31
  s.add_development_dependency 'rake', '~> 13.0'
data/scripts/docker.sh ADDED
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ set -ex
3
+
4
+ BUILD_DIR="/work"
5
+
6
+ docker run \
7
+ -w /work/pyroscope_ffi/ruby/elflib/rbspy \
8
+ -v `pwd`:/work \
9
+ quay.io/pypa/${BUILD_ARCH} \
10
+ sh manylinux.sh
11
+
12
+ docker run \
13
+ -w /work/pyroscope_ffi/ruby/elflib/thread_id \
14
+ -v `pwd`:/work \
15
+ quay.io/pypa/${BUILD_ARCH} \
16
+ sh manylinux.sh
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyroscope_beta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Pyroscope Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-13 00:00:00.000000000 Z
11
+ date: 2022-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: fiddle
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,21 +61,43 @@ extra_rdoc_files: []
75
61
  files:
76
62
  - LICENSE
77
63
  - README.md
78
- - ext/rbspy/Cargo.lock
64
+ - elflib/rbspy/manylinux.sh
65
+ - elflib/rbspy/pyproject.toml
66
+ - elflib/rbspy/rbspy/__init__.py
67
+ - elflib/rbspy/setup.cfg
68
+ - elflib/rbspy/setup.py
69
+ - elflib/thread_id/manylinux.sh
70
+ - elflib/thread_id/pyproject.toml
71
+ - elflib/thread_id/setup.cfg
72
+ - elflib/thread_id/setup.py
73
+ - elflib/thread_id/thread_id/__init__.py
79
74
  - ext/rbspy/Cargo.toml
80
75
  - ext/rbspy/Rakefile
76
+ - ext/rbspy/build.rs
77
+ - ext/rbspy/cbindgen.toml
81
78
  - ext/rbspy/extconf.rb
82
79
  - ext/rbspy/src/lib.rs
83
- - ext/thread_id/Cargo.lock
84
80
  - ext/thread_id/Cargo.toml
85
81
  - ext/thread_id/Rakefile
82
+ - ext/thread_id/build.rs
83
+ - ext/thread_id/cbindgen.toml
86
84
  - ext/thread_id/extconf.rb
87
85
  - ext/thread_id/src/lib.rs
88
86
  - lib/pyroscope/version.rb
89
87
  - lib/pyroscope_beta.rb
88
+ - lib/rbspy.libs/libcom_err-f79b9776.so.2.1
89
+ - lib/rbspy.libs/libcrypto-142cf8a3.so.1.0.1e
90
+ - lib/rbspy.libs/libgssapi_krb5-bb73e344.so.2.2
91
+ - lib/rbspy.libs/libk5crypto-ab4ddf4c.so.3.1
92
+ - lib/rbspy.libs/libkeyutils-68db41cc.so.1.3
93
+ - lib/rbspy.libs/libkrb5-7e4170ab.so.3.3
94
+ - lib/rbspy.libs/libkrb5support-2ce1fd50.so.0.1
95
+ - lib/rbspy.libs/libselinux-d72a37e2.so.1
96
+ - lib/rbspy.libs/libssl-09014658.so.1.0.1e
90
97
  - lib/rbspy/rbspy.so
91
98
  - lib/thread_id/thread_id.so
92
99
  - pyroscope.gemspec
100
+ - scripts/docker.sh
93
101
  homepage: https://pyroscope.io
94
102
  licenses:
95
103
  - Apache-2.0