Skip to content

Commit 5adf581

Browse files
committed
Merge branch 'main' into python-ci
2 parents f621afc + c1e7cde commit 5adf581

File tree

17 files changed

+599
-223
lines changed

17 files changed

+599
-223
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# v0.5.2
2+
## New features
3+
- Authentication Token support
4+
5+
## API Changes
6+
- use rust-tls instead of openssl
7+
8+
# v0.5.1
9+
## API Changes
10+
- Backend shutdown bug
11+
- Docs update
12+
13+
# v0.5.0
14+
## API Changes
15+
- New API for building, starting and stopping the profiling agent.
16+
- Backend supports reporting multiple threads.
17+
- Tagging within local thread-scope
18+
119
# v0.4.0
220
## API Changes
321
- Backend now support passing a configuration struct.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pyroscope Profiler Agent for continuous profiling of Rust, Python and Ruby appli
55
"""
66
keywords = ["pyroscope", "profiler", "profiling", "pprof"]
77
authors = ["Abid Omar <[email protected]>"]
8-
version = "0.5.1"
8+
version = "0.5.2"
99
edition = "2021"
1010
license = "Apache-2.0"
1111
homepage = "https://pyroscope.io/docs/rust"
@@ -53,7 +53,8 @@ path = "examples/internal/rbspy-connect.rs"
5353
[dependencies]
5454
thiserror ="1.0"
5555
log = "0.4"
56-
reqwest = { version = "0.11", features = ["blocking"]}
56+
names = "0.13.0"
57+
reqwest = { version = "0.11", features = ["blocking", "rustls-tls-native-roots"]}
5758
libc = "^0.2.124"
5859

5960
[dev-dependencies]

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Add this to your `Cargo.toml`:
3232

3333
```toml
3434
[dependencies]
35-
pyroscope = "0.5.0"
35+
pyroscope = "0.5.2"
3636
pyroscope_pprofrs = "0.2"
3737
```
3838

@@ -83,8 +83,7 @@ The Pyroscope Agent doesn't do any profiling. The agent role is to orchasrate a
8383
### Limitations
8484

8585
- **Backend**: The Pyroscope Agent uses [pprof-rs](https://github.com/tikv/pprof-rs) as a backend. As a result, the [limitations](https://github.com/tikv/pprof-rs#why-not-) for pprof-rs also applies.
86-
- **Tagging**: ~~Adding or removing tags is not possible within threads. In general, the [Pyroscope Agent](https://docs.rs/pyroscope/latest/pyroscope/pyroscope/struct.PyroscopeAgent.html) is not Sync; and as a result a reference cannot be shared between threads. A multi-threaded program could be profiled but the agent is not thread-aware and a particular thread cannot be tagged.~~
87-
As of 0.5.0, the Pyroscope Agent support tagging within threads. Check the [Tags](examples/tags.rs) and [Multi-Thread](examples/multi-thread.rs) examples for usage.
86+
- **Tagging**: As of 0.5.0, the Pyroscope Agent support tagging within threads. Check the [Tags](examples/tags.rs) and [Multi-Thread](examples/multi-thread.rs) examples for usage.
8887
- **Timer**: epoll (for Linux) and kqueue (for macOS) are required for a more precise timer.
8988
- **Shutdown**: The Pyroscope Agent might take some time (usually less than 10 seconds) to shutdown properly and drop its threads. For a proper shutdown, it's recommended that you run the `shutdown` function before dropping the Agent.
9089

examples/auth.rs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
extern crate pyroscope;
2+
3+
use pyroscope::{PyroscopeAgent, Result};
4+
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
5+
use std::hash::{Hash, Hasher};
6+
7+
fn hash_rounds(n: u64) -> u64 {
8+
let hash_str = "Some string to hash";
9+
let mut default_hasher = std::collections::hash_map::DefaultHasher::new();
10+
11+
for _ in 0..n {
12+
for _ in 0..1000 {
13+
default_hasher.write(hash_str.as_bytes());
14+
}
15+
hash_str.hash(&mut default_hasher);
16+
}
17+
18+
n
19+
}
20+
21+
fn main() -> Result<()> {
22+
// TODO: Change this token to your own.
23+
let token = String::from("<your-token>");
24+
25+
let agent = PyroscopeAgent::builder("http://localhost:4040", "example.basic")
26+
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
27+
.auth_token(token)
28+
.tags([("TagA", "ValueA"), ("TagB", "ValueB")].to_vec())
29+
.build()?;
30+
31+
// Show start time
32+
let start = std::time::SystemTime::now()
33+
.duration_since(std::time::UNIX_EPOCH)
34+
.unwrap()
35+
.as_secs();
36+
println!("Start Time: {}", start);
37+
38+
// Start Agent
39+
let agent_running = agent.start()?;
40+
41+
let _result = hash_rounds(300_000);
42+
43+
// Show stop time
44+
let stop = std::time::SystemTime::now()
45+
.duration_since(std::time::UNIX_EPOCH)
46+
.unwrap()
47+
.as_secs();
48+
println!("Stop Time: {}", stop);
49+
50+
// Stop Agent
51+
let agent_ready = agent_running.stop()?;
52+
53+
// Shutdown the Agent
54+
agent_ready.shutdown();
55+
56+
// Show program exit time
57+
let exit = std::time::SystemTime::now()
58+
.duration_since(std::time::UNIX_EPOCH)
59+
.unwrap()
60+
.as_secs();
61+
println!("Exit Time: {}", exit);
62+
63+
Ok(())
64+
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
# v0.2.1
2+
- update pyroscope-lib to 0.5.2
3+
4+
# v0.2.0
5+
- update pyroscope-lib to 0.5
6+
- multi-threading support
7+
18
# v0.1.0
2-
Initial release
9+
- Initial release

pyroscope_backends/pyroscope_pprofrs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pprof-rs backend for Pyroscope Profiler.
55
"""
66
keywords = ["pyroscope", "profiler", "pprof-rs"]
77
authors = ["Abid Omar <[email protected]>"]
8-
version = "0.2.0"
8+
version = "0.2.1"
99
edition = "2021"
1010
license = "Apache-2.0"
1111
homepage = "https://pyroscope.io"
@@ -16,7 +16,7 @@ readme = "README.md"
1616

1717
[dependencies]
1818
pprof = "0.8"
19-
pyroscope = {version = "0.5.0", path = "../../" }
19+
pyroscope = {version = "0.5.2", path = "../../" }
2020
thiserror ="1.0"
2121

2222
[profile.dev]
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
# v0.2.1
2+
- update pyroscope-lib to 0.5.2
3+
4+
# v0.2.0
5+
- update pyroscope-lib to 0.5
6+
- multi-threading support
7+
18
# v0.1.0
2-
Initial release
9+
- Initial release

pyroscope_backends/pyroscope_pyspy/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pyspy backend for Pyroscope Profiler.
55
"""
66
keywords = ["pyroscope", "profiler", "pyspy"]
77
authors = ["Abid Omar <[email protected]>"]
8-
version = "0.2.0"
8+
version = "0.2.1"
99
edition = "2021"
1010
license = "Apache-2.0"
1111
homepage = "https://pyroscope.io"
@@ -15,7 +15,7 @@ readme = "README.md"
1515

1616
[dependencies]
1717
py-spy = "0.3.11"
18-
pyroscope = { version = "0.5.0", path = "../../" }
18+
pyroscope = { version = "0.5.2", path = "../../" }
1919
thiserror ="1.0"
2020
log = "0.4"
2121

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
# v0.2.1
2+
- update pyroscope-lib to 0.5.2
3+
4+
# v0.2.0
5+
- update pyroscope-lib to 0.5
6+
- multi-threading support
7+
18
# v0.1.0
2-
Initial release
9+
- Initial release

pyroscope_backends/pyroscope_rbspy/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rbspy backend for Pyroscope Profiler.
55
"""
66
keywords = ["pyroscope", "profiler", "rbspy"]
77
authors = ["Abid Omar <[email protected]>"]
8-
version = "0.2.0"
8+
version = "0.2.1"
99
edition = "2021"
1010
license = "Apache-2.0"
1111
homepage = "https://pyroscope.io"
@@ -15,7 +15,7 @@ readme = "README.md"
1515

1616
[dependencies]
1717
rbspy = "0.12.1"
18-
pyroscope = { version = "0.5", path = "../../" }
18+
pyroscope = { version = "0.5.2", path = "../../" }
1919
thiserror ="1.0"
2020
log = "0.4"
2121
anyhow = "1.0.56"

0 commit comments

Comments
 (0)