Skip to content

Commit bb1aeb1

Browse files
chore: simplify crates (#244)
merge ffi/ruby crate with the rbspy backend crate merge ffi/python crate with the pyspy backend crate remove backend-pyspy config - use pyspy::Config directly remove backend-rbspy config - use rbspy::Sampler directly remove publishing ruby python backends remove backend trait's get_config / set_config functions remove void backend
1 parent 39b3b3d commit bb1aeb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+356
-1825
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,6 @@ jobs:
4040
set -ex
4141
cargo login ${{ secrets.CARGO_TOKEN }}
4242
cargo publish --manifest-path pyroscope_backends/pyroscope_pprofrs/Cargo.toml
43-
publish-rbspy:
44-
name: "Backend: rbspy"
45-
runs-on: ubuntu-x64-small
46-
if: "startsWith(github.event.release.tag_name, 'rbspy-')"
47-
steps:
48-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49-
with:
50-
persist-credentials: false
51-
- uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
52-
with:
53-
toolchain: 1.85.0
54-
- name: publish rbspy crate
55-
run: |
56-
cargo login ${{ secrets.CARGO_TOKEN }}
57-
cargo publish --manifest-path pyroscope_backends/pyroscope_rbspy/Cargo.toml
58-
publish-pyspy:
59-
name: "Backend: pyspy"
60-
runs-on: ubuntu-x64-small
61-
if: "startsWith(github.event.release.tag_name, 'pyspy-')"
62-
steps:
63-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64-
with:
65-
persist-credentials: false
66-
- uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
67-
with:
68-
toolchain: 1.85.0
69-
- name: publish pyspy crate
70-
run: |
71-
cargo login ${{ secrets.CARGO_TOKEN }}
72-
cargo publish --manifest-path pyroscope_backends/pyroscope_pyspy/Cargo.toml
7343
publish-python:
7444
name: "Python"
7545
runs-on: ubuntu-x64-small

.github/workflows/release.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,6 @@ jobs:
3131
title: "Backend: ${{ github.ref_name }}"
3232
draft: true
3333
prerelease: false
34-
rbspy-release:
35-
name: pyroscope-rbspy
36-
runs-on: ubuntu-x64-small
37-
if: "startsWith(github.ref, 'refs/tags/rbspy-')"
38-
steps:
39-
- uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" # v1.2.1 TODO(korniltsev): get rid of this, this one is unmaintained
40-
with:
41-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
42-
automatic_release_tag: "${{ github.ref_name }}"
43-
title: "Backend: ${{ github.ref_name }}"
44-
draft: true
45-
prerelease: false
46-
pyspy-release:
47-
name: pyroscope-pyspy
48-
runs-on: ubuntu-x64-small
49-
if: "startsWith(github.ref, 'refs/tags/pyspy-')"
50-
steps:
51-
- uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" # v1.2.1 TODO(korniltsev): get rid of this, this one is unmaintained
52-
with:
53-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
54-
automatic_release_tag: "${{ github.ref_name }}"
55-
title: "Backend: ${{ github.ref_name }}"
56-
draft: true
57-
prerelease: false
5834
python-release-linux:
5935
needs: [ 'python-release' ]
6036
name: Release python linux amd64

Cargo.lock

Lines changed: 8 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,12 @@ rust-version = "1.64"
2121
[workspace]
2222
members = [
2323
"pyroscope_backends/pyroscope_pprofrs",
24-
"pyroscope_backends/pyroscope_pyspy",
2524
"pyroscope_ffi/ruby/ext/rbspy",
2625
"pyroscope_ffi/ruby/ext/thread_id",
2726
"pyroscope_ffi/python/lib",
2827
"pyroscope_ffi/ffikit",
2928
]
3029

31-
[[example]]
32-
name = "internal-backend-void"
33-
path = "examples/internal/backend-void.rs"
34-
35-
[[example]]
36-
name = "internal-backend-void-run"
37-
path = "examples/internal/backend-void-run.rs"
3830

3931
[[example]]
4032
name = "internal-backend-pprof"
@@ -44,13 +36,7 @@ path = "examples/internal/backend-pprof.rs"
4436
name = "internal-timer"
4537
path = "examples/internal/timer.rs"
4638

47-
[[example]]
48-
name = "internal-pyspy-connect"
49-
path = "examples/internal/pyspy-connect.rs"
5039

51-
[[example]]
52-
name = "internal-rbspy-connect"
53-
path = "examples/internal/rbspy-connect.rs"
5440

5541
[dependencies]
5642
thiserror = "2.0.12"
@@ -70,8 +56,6 @@ pretty_env_logger = "0.5.0"
7056
assert_matches = "1"
7157
claims = "0.8.0"
7258
pyroscope_pprofrs = { path = "pyroscope_backends/pyroscope_pprofrs" }
73-
pyroscope_pyspy = { path = "pyroscope_backends/pyroscope_pyspy" }
74-
pyroscope_rbspy = { path = "pyroscope_backends/pyroscope_rbspy" }
7559

7660
[features]
7761
default = ["rustls-tls"]

Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,13 @@ lib/test:
1313
pprofrs/test:
1414
cargo test --manifest-path pyroscope_backends/pyroscope_pprofrs/Cargo.toml
1515

16-
.PHONY: pyspy/test
17-
pyspy/test:
18-
cargo test --manifest-path pyroscope_backends/pyroscope_pyspy/Cargo.toml
19-
20-
.PHONY: rbspy/test
21-
rbspy/test:
22-
cargo test --manifest-path pyroscope_backends/pyroscope_rbspy/Cargo.toml
23-
2416

2517
.PHONY: ffikit/test
2618
ffikit/test:
2719
cargo test --manifest-path pyroscope_ffi/ffikit/Cargo.toml
2820

2921
.PHONY: test
30-
test: pprofrs/test pyspy/test rbspy/test lib/test ffikit/test
22+
test: pprofrs/test lib/test ffikit/test
3123

3224

3325
include ffi.mk

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ The Pyroscope Agent and the [pprof-rs backend](pyroscope_backends/pyroscope_ppro
7676
The Pyroscope Agent doesn't do any profiling. The agent role is to orchestrate a profiling backend, and report the profiling data to the Pyroscope Server. The Agent can support external backends (in fact, all current backends are independent crates), and you can make your own. Backends can also be used separately. The currently available backends are:
7777

7878
- [pprof-rs](pyroscope_backends/pyroscope_pprofrs): Rust profiler. A wrapper around [pprof-rs](https://github.com/tikv/pprof-rs).
79-
- [rbspy](pyroscope_backends/pyroscope_rbspy): Ruby Profiler. A wrapper around [rbspy](https://rbspy.github.io/).
80-
- [py-spy](pyroscope_backends/pyroscope_pyspy): Python Profiler. A wrapper around [py-spy](https://github.com/benfred/py-spy).
8179

8280
### Native Integration
8381

examples/async.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ extern crate pyroscope;
33
use pyroscope::{PyroscopeAgent, Result};
44
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
55
use std::hash::{Hash, Hasher};
6+
use pyroscope::backend::BackendConfig;
7+
use pyroscope::pyroscope::PyroscopeAgentBuilder;
68

79
fn hash_rounds1(n: u64) -> u64 {
810
let hash_str = "Some string to hash";
@@ -34,8 +36,8 @@ fn hash_rounds2(n: u64) -> u64 {
3436

3537
#[tokio::main]
3638
async fn main() -> Result<()> {
37-
let agent = PyroscopeAgent::builder("http://localhost:4040", "example.async")
38-
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
39+
let backend = pprof_backend(PprofConfig { sample_rate: 100 }, BackendConfig::default());
40+
let agent = PyroscopeAgentBuilder::new("http://localhost:4040", "example.async", backend)
3941
.tags([("TagA", "ValueA"), ("TagB", "ValueB")].to_vec())
4042
.build()?;
4143

examples/auth.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ extern crate pyroscope;
33
use pyroscope::{PyroscopeAgent, Result};
44
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
55
use std::hash::{Hash, Hasher};
6+
use pyroscope::backend::BackendConfig;
7+
use pyroscope::pyroscope::PyroscopeAgentBuilder;
68

79
fn hash_rounds(n: u64) -> u64 {
810
let hash_str = "Some string to hash";
@@ -22,13 +24,12 @@ fn main() -> Result<()> {
2224
// TODO: Change this token to your own.
2325
let token = String::from("<your-token>");
2426

25-
let agent = PyroscopeAgent::builder("http://localhost:4040", "example.basic")
26-
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
27+
let backend = pprof_backend(PprofConfig{sample_rate: 100}, BackendConfig::default());
28+
let agent = PyroscopeAgentBuilder::new("http://localhost:4040", "example.basic", backend)
2729
.auth_token(token)
2830
.tags([("TagA", "ValueA"), ("TagB", "ValueB")].to_vec())
2931
.build()?;
3032

31-
// Show start time
3233
let start = std::time::SystemTime::now()
3334
.duration_since(std::time::UNIX_EPOCH)
3435
.unwrap()

examples/basic.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ extern crate pyroscope;
33
use pyroscope::{PyroscopeAgent, Result};
44
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
55
use std::hash::{Hash, Hasher};
6+
use pyroscope::backend::BackendConfig;
7+
use pyroscope::pyroscope::PyroscopeAgentBuilder;
68

79
fn hash_rounds(n: u64) -> u64 {
810
let hash_str = "Some string to hash";
@@ -19,8 +21,8 @@ fn hash_rounds(n: u64) -> u64 {
1921
}
2022

2123
fn main() -> Result<()> {
22-
let agent = PyroscopeAgent::builder("http://localhost:4040", "example.basic")
23-
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
24+
let backend = pprof_backend(PprofConfig { sample_rate: 100 }, BackendConfig::default());
25+
let agent = PyroscopeAgentBuilder::new("http://localhost:4040", "example.basic", backend)
2426
.tags([("TagA", "ValueA"), ("TagB", "ValueB")].to_vec())
2527
.build()?;
2628

examples/error.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
extern crate pyroscope;
22

33
use pyroscope::{PyroscopeAgent, Result};
4+
use pyroscope::backend::BackendConfig;
5+
use pyroscope::pyroscope::PyroscopeAgentBuilder;
46
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
57

68
fn fibonacci(n: u64) -> u64 {
@@ -16,9 +18,8 @@ fn main() -> Result<()> {
1618

1719
// Initialize the logger.
1820
pretty_env_logger::init_timed();
19-
20-
let agent = PyroscopeAgent::builder("http://invalid_url", "example.error")
21-
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
21+
let backend = pprof_backend(PprofConfig{sample_rate: 100}, BackendConfig::default());
22+
let agent = PyroscopeAgentBuilder::new("http://invalid_url", "example.error", backend)
2223
.build()
2324
.unwrap();
2425
// Start Agent

0 commit comments

Comments
 (0)