Skip to content

Commit 33c6a5e

Browse files
committed
imp(backends): move backends to separate crates
1 parent fca7d50 commit 33c6a5e

34 files changed

+691
-271
lines changed

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ autobenches = true
1919

2020
[workspace]
2121
members = [
22-
"pyroscope_backends"
2322
]
2423
exclude = [
24+
"pyroscope_backends",
2525
"pyroscope_cli",
2626
"pyroscope_ffi",
2727
]
@@ -55,7 +55,6 @@ name = "internal-rbspy-connect"
5555
path = "examples/internal/rbspy-connect.rs"
5656

5757
[dependencies]
58-
pyroscope_backends = {path = "pyroscope_backends"}
5958
thiserror ="1.0"
6059
log = "0.4"
6160
reqwest = { version = "0.11", features = ["blocking"]}
@@ -65,6 +64,9 @@ libc = "^0.2.66"
6564
tokio = { version = "1.13", features = ["full"] }
6665
pretty_env_logger = "0.4.0"
6766
assert_matches = "1"
67+
pyroscope_pprofrs = { path = "pyroscope_backends/pyroscope_pprofrs" }
68+
pyroscope_rbspy = { path = "pyroscope_backends/pyroscope_rbspy" }
69+
pyroscope_pyspy = { path = "pyroscope_backends/pyroscope_pyspy" }
6870

6971
[profile.dev]
7072
opt-level=0

examples/async.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern crate pyroscope;
22

33
use pyroscope::{PyroscopeAgent, Result};
4+
use pyroscope_pprofrs::{Pprof, PprofConfig};
45
use std::hash::{Hash, Hasher};
56

67
fn hash_rounds1(n: u64) -> u64 {
@@ -34,6 +35,7 @@ fn hash_rounds2(n: u64) -> u64 {
3435
#[tokio::main]
3536
async fn main() -> Result<()> {
3637
let mut agent = PyroscopeAgent::builder("http://localhost:4040", "example.async")
38+
.backend(Pprof::new(PprofConfig::new(100)))
3739
.tags(&[("TagA", "ValueA"), ("TagB", "ValueB")])
3840
.build()?;
3941

examples/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extern crate pyroscope;
22

33
use pyroscope::{PyroscopeAgent, Result};
4-
use pyroscope_backends::pprof::{Pprof, PprofConfig};
4+
use pyroscope_pprofrs::{Pprof, PprofConfig};
55
use std::hash::{Hash, Hasher};
66

77
fn hash_rounds(n: u64) -> u64 {

examples/basic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern crate pyroscope;
22

33
use pyroscope::{PyroscopeAgent, Result};
4+
use pyroscope_pprofrs::{Pprof, PprofConfig};
45
use std::hash::{Hash, Hasher};
56

67
fn hash_rounds(n: u64) -> u64 {
@@ -19,6 +20,7 @@ fn hash_rounds(n: u64) -> u64 {
1920

2021
fn main() -> Result<()> {
2122
let mut agent = PyroscopeAgent::builder("http://localhost:4040", "example.basic")
23+
.backend(Pprof::new(PprofConfig::new(100)))
2224
.tags(&[("TagA", "ValueA"), ("TagB", "ValueB")])
2325
.build()?;
2426

examples/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern crate pyroscope;
22

33
use pyroscope::{PyroscopeAgent, Result};
4+
use pyroscope_pprofrs::{Pprof, PprofConfig};
45

56
fn fibonacci(n: u64) -> u64 {
67
match n {
@@ -17,6 +18,7 @@ fn main() -> Result<()> {
1718
pretty_env_logger::init_timed();
1819

1920
let mut agent = PyroscopeAgent::builder("http://invalid_url", "example.error")
21+
.backend(Pprof::new(PprofConfig::new(100)))
2022
.build()
2123
.unwrap();
2224
// Start Agent

examples/internal/backend-pprof.rs

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

3+
use pyroscope::backend::Backend;
34
use pyroscope::Result;
4-
use pyroscope_backends::pprof::{Pprof, PprofConfig};
5-
use pyroscope_backends::types::Backend;
5+
use pyroscope_pprofrs::{Pprof, PprofConfig};
66

77
fn fibonacci(n: u64) -> u64 {
88
match n {

examples/internal/backend-void-run.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ extern crate pyroscope;
22

33
use log::info;
44

5+
use pyroscope::backend::{void_backend, VoidConfig};
56
use pyroscope::{PyroscopeAgent, Result};
6-
use pyroscope_backends::void::{void_backend, VoidConfig};
77

88
fn main() -> Result<()> {
99
// Force rustc to display the log messages in the console.
@@ -20,7 +20,6 @@ fn main() -> Result<()> {
2020
// Create backend
2121
let backend = void_backend(backend_config);
2222

23-
2423
// Create a new agent.
2524
let mut agent = PyroscopeAgent::builder("http://localhost:4040", "void.backend")
2625
.backend(backend.backend)

examples/internal/backend-void.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extern crate pyroscope;
22

3+
use pyroscope::backend::{void_backend, VoidConfig};
34
use pyroscope::Result;
4-
use pyroscope_backends::void::{void_backend, VoidConfig};
55

66
fn main() -> Result<()> {
77
// Create new VoidConfig

examples/internal/pyspy-connect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate pyroscope;
33
use std::env;
44

55
use pyroscope::{PyroscopeAgent, Result};
6-
use pyroscope_backends::pyspy::{Pyspy, PyspyConfig};
6+
use pyroscope_pyspy::{Pyspy, PyspyConfig};
77

88
fn main() -> Result<()> {
99
// Force rustc to display the log messages in the console.
@@ -24,7 +24,7 @@ fn main() -> Result<()> {
2424
.include_idle(false)
2525
.native(false);
2626

27-
let mut agent = PyroscopeAgent::builder("http://localhost:4040", "rbspy.basic")
27+
let mut agent = PyroscopeAgent::builder("http://localhost:4040", "pyspy.basic")
2828
.backend(Pyspy::new(config))
2929
.build()?;
3030

examples/internal/rbspy-connect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate pyroscope;
33
use std::env;
44

55
use pyroscope::{PyroscopeAgent, Result};
6-
use pyroscope_backends::rbspy::{Rbspy, RbspyConfig};
6+
use pyroscope_rbspy::{Rbspy, RbspyConfig};
77

88
fn main() -> Result<()> {
99
// Force rustc to display the log messages in the console.

0 commit comments

Comments
 (0)