pyroscope 0.6.7 → 1.0.9
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 +4 -4
- data/Gemfile.lock +5 -4
- data/README.md +7 -54
- data/ext/rbspy/Cargo.lock +2743 -0
- data/ext/rbspy/Cargo.toml +7 -10
- data/ext/rbspy/Rakefile +1 -1
- data/ext/rbspy/cbindgen.toml +1 -6
- data/ext/rbspy/include/rbspy.h +15 -13
- data/ext/rbspy/src/backend.rs +199 -0
- data/ext/rbspy/src/lib.rs +170 -180
- data/lib/pyroscope/version.rb +1 -1
- data/lib/pyroscope.rb +9 -30
- data/pyroscope.gemspec +8 -26
- metadata +10 -22
- data/ext/rbspy/build.rs +0 -12
- data/ext/thread_id/Cargo.toml +0 -15
- data/ext/thread_id/Rakefile +0 -163
- data/ext/thread_id/build.rs +0 -12
- data/ext/thread_id/cbindgen.toml +0 -22
- data/ext/thread_id/extconf.rb +0 -11
- data/ext/thread_id/include/thread_id.h +0 -17
- data/ext/thread_id/src/lib.rs +0 -4
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pyroscope
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pyroscope Team
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: ffi
|
|
@@ -24,7 +23,6 @@ dependencies:
|
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
|
-
force_ruby_platform: false
|
|
28
26
|
- !ruby/object:Gem::Dependency
|
|
29
27
|
name: bundler
|
|
30
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,40 +57,31 @@ email:
|
|
|
59
57
|
executables: []
|
|
60
58
|
extensions:
|
|
61
59
|
- ext/rbspy/extconf.rb
|
|
62
|
-
- ext/thread_id/extconf.rb
|
|
63
60
|
extra_rdoc_files: []
|
|
64
61
|
files:
|
|
65
62
|
- Gemfile
|
|
66
63
|
- Gemfile.lock
|
|
67
64
|
- LICENSE
|
|
68
65
|
- README.md
|
|
66
|
+
- ext/rbspy/Cargo.lock
|
|
69
67
|
- ext/rbspy/Cargo.toml
|
|
70
68
|
- ext/rbspy/Rakefile
|
|
71
|
-
- ext/rbspy/build.rs
|
|
72
69
|
- ext/rbspy/cbindgen.toml
|
|
73
70
|
- ext/rbspy/extconf.rb
|
|
74
71
|
- ext/rbspy/include/rbspy.h
|
|
72
|
+
- ext/rbspy/src/backend.rs
|
|
75
73
|
- ext/rbspy/src/lib.rs
|
|
76
|
-
- ext/thread_id/Cargo.toml
|
|
77
|
-
- ext/thread_id/Rakefile
|
|
78
|
-
- ext/thread_id/build.rs
|
|
79
|
-
- ext/thread_id/cbindgen.toml
|
|
80
|
-
- ext/thread_id/extconf.rb
|
|
81
|
-
- ext/thread_id/include/thread_id.h
|
|
82
|
-
- ext/thread_id/src/lib.rs
|
|
83
74
|
- lib/pyroscope.rb
|
|
84
75
|
- lib/pyroscope/version.rb
|
|
85
76
|
- pyroscope.gemspec
|
|
86
|
-
homepage: https://pyroscope
|
|
77
|
+
homepage: https://grafana.com/oss/pyroscope/
|
|
87
78
|
licenses:
|
|
88
79
|
- Apache-2.0
|
|
89
80
|
metadata:
|
|
90
|
-
homepage_uri: https://pyroscope
|
|
91
|
-
bug_tracker_uri: https://github.com/
|
|
92
|
-
documentation_uri: https://
|
|
93
|
-
|
|
94
|
-
source_code_uri: https://github.com/pyroscope-io/pyroscope-rs/tree/main/pyroscope_ffi/ruby
|
|
95
|
-
post_install_message:
|
|
81
|
+
homepage_uri: https://grafana.com/oss/pyroscope/
|
|
82
|
+
bug_tracker_uri: https://github.com/grafana/pyroscope-ruby/issues
|
|
83
|
+
documentation_uri: https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/ruby/
|
|
84
|
+
source_code_uri: https://github.com/grafana/pyroscope-ruby
|
|
96
85
|
rdoc_options: []
|
|
97
86
|
require_paths:
|
|
98
87
|
- lib
|
|
@@ -107,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
107
96
|
- !ruby/object:Gem::Version
|
|
108
97
|
version: '0'
|
|
109
98
|
requirements: []
|
|
110
|
-
rubygems_version:
|
|
111
|
-
signing_key:
|
|
99
|
+
rubygems_version: 4.0.10
|
|
112
100
|
specification_version: 4
|
|
113
101
|
summary: Pyroscope
|
|
114
102
|
test_files: []
|
data/ext/rbspy/build.rs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
data/ext/thread_id/Cargo.toml
DELETED
data/ext/thread_id/Rakefile
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "shellwords"
|
|
4
|
-
|
|
5
|
-
class ThreadIdRakeCargoHelper
|
|
6
|
-
attr_reader :gemname
|
|
7
|
-
|
|
8
|
-
def initialize(gemname=File.basename(__dir__))
|
|
9
|
-
@gemname = gemname
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def self.command?(name)
|
|
13
|
-
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
|
|
14
|
-
ENV["PATH"].split(File::PATH_SEPARATOR).any? do |path|
|
|
15
|
-
exts.any? do |ext|
|
|
16
|
-
exe = File.join(path, "#{name}#{ext}")
|
|
17
|
-
File.executable?(exe) && !File.directory?(exe)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.rust_toolchain
|
|
23
|
-
# return env variable if set
|
|
24
|
-
target = ENV["RUST_TARGET"]
|
|
25
|
-
return target if target
|
|
26
|
-
|
|
27
|
-
str = `rustc --version --verbose`
|
|
28
|
-
info = str.lines.map {|l| l.chomp.split(/:\s+/, 2)}.drop(1).to_h
|
|
29
|
-
info["host"]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def self.cargo_target_dir
|
|
33
|
-
return @cargo_target_dir if defined? @cargo_target_dir
|
|
34
|
-
|
|
35
|
-
str = `cargo metadata --format-version 1 --offline --no-deps --quiet`
|
|
36
|
-
begin
|
|
37
|
-
require "json"
|
|
38
|
-
dir = JSON.parse(str)["target_directory"]
|
|
39
|
-
rescue LoadError # json is usually part of the stdlib, but just in case
|
|
40
|
-
/"target_directory"\s*:\s*"(?<dir>[^"]*)"/ =~ str
|
|
41
|
-
end
|
|
42
|
-
@cargo_target_dir = dir || "target"
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.flags
|
|
46
|
-
cc_flags = Shellwords.split(RbConfig.expand(RbConfig::MAKEFILE_CONFIG["CC"].dup))
|
|
47
|
-
|
|
48
|
-
["-C", "linker=#{cc_flags.shift}",
|
|
49
|
-
*cc_flags.flat_map {|a| ["-C", "link-arg=#{a}"] },
|
|
50
|
-
"-L", "native=#{RbConfig::CONFIG["libdir"]}",
|
|
51
|
-
*dld_flags,
|
|
52
|
-
*platform_flags]
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def self.dld_flags
|
|
56
|
-
Shellwords.split(RbConfig::CONFIG["DLDFLAGS"]).flat_map do |arg|
|
|
57
|
-
arg = arg.gsub(/\$\((\w+)\)/) do
|
|
58
|
-
$1 == "DEFFILE" ? nil : RbConfig::CONFIG[name]
|
|
59
|
-
end.strip
|
|
60
|
-
next [] if arg.empty?
|
|
61
|
-
|
|
62
|
-
transform_flag(arg)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def self.platform_flags
|
|
67
|
-
return unless RbConfig::CONFIG["target_os"] =~ /mingw/i
|
|
68
|
-
|
|
69
|
-
[*Shellwords.split(RbConfig::CONFIG["LIBRUBYARG"]).flat_map {|arg| transform_flag(arg)},
|
|
70
|
-
"-C", "link-arg=-Wl,--dynamicbase",
|
|
71
|
-
"-C", "link-arg=-Wl,--disable-auto-image-base",
|
|
72
|
-
"-C", "link-arg=-static-libgcc"]
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def self.transform_flag(arg)
|
|
76
|
-
k, v = arg.split(/(?<=..)/, 2)
|
|
77
|
-
case k
|
|
78
|
-
when "-L"
|
|
79
|
-
[k, "native=#{v}"]
|
|
80
|
-
when "-l"
|
|
81
|
-
[k, v]
|
|
82
|
-
when "-F"
|
|
83
|
-
["-l", "framework=#{v}"]
|
|
84
|
-
else
|
|
85
|
-
["-C", "link_arg=#{k}#{v}"]
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def install_dir
|
|
90
|
-
File.expand_path(File.join("..", "..", "lib", gemname), __dir__)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def rust_name
|
|
94
|
-
prefix = "lib" unless Gem.win_platform?
|
|
95
|
-
suffix = if RbConfig::CONFIG["target_os"] =~ /darwin/i
|
|
96
|
-
".dylib"
|
|
97
|
-
elsif Gem.win_platform?
|
|
98
|
-
".dll"
|
|
99
|
-
else
|
|
100
|
-
".so"
|
|
101
|
-
end
|
|
102
|
-
"#{prefix}#{gemname}#{suffix}"
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def ruby_name
|
|
106
|
-
"#{gemname}.#{RbConfig::CONFIG["DLEXT"]}"
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
task default: [:thread_id_install, :thread_id_clean]
|
|
112
|
-
task thread_id: [:thread_id_install, :thread_id_clean]
|
|
113
|
-
|
|
114
|
-
desc "set dev mode for subsequent task, run like `rake dev install`"
|
|
115
|
-
task :thread_id_dev do
|
|
116
|
-
@dev = true
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
desc "build gem native extension and copy to lib"
|
|
120
|
-
task thread_id_install: [:thread_id_cd, :thread_id_build] do
|
|
121
|
-
helper = ThreadIdRakeCargoHelper.new
|
|
122
|
-
profile_dir = @dev ? "debug" : "release"
|
|
123
|
-
arch_dir = RbspyRakeCargoHelper.rust_toolchain
|
|
124
|
-
source = File.join(ThreadIdRakeCargoHelper.cargo_target_dir, arch_dir, profile_dir, helper.rust_name)
|
|
125
|
-
dest = File.join(helper.install_dir, helper.ruby_name)
|
|
126
|
-
mkdir_p(helper.install_dir)
|
|
127
|
-
rm(dest) if File.exist?(dest)
|
|
128
|
-
cp(source, dest)
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
desc "build gem native extension"
|
|
132
|
-
task thread_id_build: [:thread_id_cargo, :thread_id_cd] do
|
|
133
|
-
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--target=#{RbspyRakeCargoHelper.rust_toolchain}", "--", *RbspyRakeCargoHelper.flags
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
desc "clean up release build artifacts"
|
|
137
|
-
task thread_id_clean: [:thread_id_cargo, :thread_id_cd] do
|
|
138
|
-
sh "cargo clean --release"
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
desc "clean up build artifacts"
|
|
142
|
-
task thread_id_clobber: [:thread_id_cargo, :thread_id_cd] do
|
|
143
|
-
sh "cargo clean"
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
desc "check for cargo"
|
|
147
|
-
task :thread_id_cargo do
|
|
148
|
-
raise <<-MSG unless ThreadIdRakeCargoHelper.command?("cargo")
|
|
149
|
-
This gem requires a Rust compiler and the `cargo' build tool to build the
|
|
150
|
-
gem's native extension. See https://www.rust-lang.org/tools/install for
|
|
151
|
-
how to install Rust. `cargo' is usually part of the Rust installation.
|
|
152
|
-
MSG
|
|
153
|
-
|
|
154
|
-
raise <<-MSG if Gem.win_platform? && ThreadIdRakeCargoHelper.rust_toolchain !~ /gnu/
|
|
155
|
-
Found Rust toolchain `#{ThreadIdRakeCargoHelper.rust_toolchain}' but the gem native
|
|
156
|
-
extension requires the gnu toolchain on Windows.
|
|
157
|
-
MSG
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
# ensure task is running in the right dir
|
|
161
|
-
task :thread_id_cd do
|
|
162
|
-
cd(__dir__) unless __dir__ == pwd
|
|
163
|
-
end
|
data/ext/thread_id/build.rs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
data/ext/thread_id/cbindgen.toml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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/thread_id/extconf.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* Licensed under Apache-2.0 */
|
|
2
|
-
|
|
3
|
-
#ifndef RBSPY_H_
|
|
4
|
-
#define RBSPY_H_
|
|
5
|
-
|
|
6
|
-
/* Generated with cbindgen:0.28.0 */
|
|
7
|
-
|
|
8
|
-
/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
|
|
9
|
-
|
|
10
|
-
#include <stdarg.h>
|
|
11
|
-
#include <stdbool.h>
|
|
12
|
-
#include <stdint.h>
|
|
13
|
-
#include <stdlib.h>
|
|
14
|
-
|
|
15
|
-
uint64_t thread_id(void);
|
|
16
|
-
|
|
17
|
-
#endif /* RBSPY_H_ */
|
data/ext/thread_id/src/lib.rs
DELETED