Skip to content

Commit 18678d1

Browse files
authored
chore(docs): update README.md
1 parent 99b8f61 commit 18678d1

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ You may be looking for:
1515
- [Crate Documentation](https://docs.rs/pyroscope/)
1616
- [Examples](examples)
1717
- [Release notes](https://github.com/omarabid/pyroscope/releases)
18+
- [Pyroscope CLI](pyroscope_cli)
1819

1920
## Table of Contents
2021
- [Quick Start](#quick-start)
22+
- [Pyroscope Server](#pyroscope-server)
23+
- [Multi-Threading](#multi-threading)
24+
- [Profiling Backends](#profiling-backends)
2125
- [Limitations](#limitations)
2226
- [Getting Help](#getting-help)
2327
- [License](#license)
@@ -28,8 +32,8 @@ Add this to your `Cargo.toml`:
2832

2933
```toml
3034
[dependencies]
31-
pyroscope = "0.4.0"
32-
pyroscope-pprofrs = "0.1"
35+
pyroscope = "0.5.0"
36+
pyroscope-pprofrs = "0.2"
3337
```
3438

3539
Configure and create the backend (pprof-rs)
@@ -42,7 +46,7 @@ let pprof_backend = Pprof::new(pprof_config);
4246
Configure the Pyroscope agent:
4347

4448
```rust
45-
let mut agent =
49+
let agent =
4650
PyroscopeAgent::builder("http://localhost:4040", "myapp-profile")
4751
.backend(pprof_backend)
4852
.build()?;
@@ -51,19 +55,38 @@ Configure the Pyroscope agent:
5155
Profile your code:
5256

5357
```rust
54-
agent.start();
55-
// Profiled computation
56-
agent.stop();
57-
58-
// Non-profiled computation
58+
let agent_running = agent.start()?;
59+
60+
// Computation to profile
61+
62+
let agent_ready = agent_running.stop()?;
63+
agent_ready.shutdown();
5964
```
6065

66+
### Pyroscope Server
67+
68+
The Pyroscope Agent send the profiling data to a [Pyroscope Server](https://pyroscope.io/docs/installing-pyroscope-overview/). You need to have a Pyroscope Server running in order to consume and visualize this data. It's not possible, currently, to forward the data to another endpoint.
69+
70+
### Multi-Threading
71+
72+
The Pyroscope Agent and the [pprof-rs backend](pyroscope_backends/pyroscope_pprofrs) can profile and report data from a multi-threaded program. [pprof-rs](https://github.com/tikv/pprof-rs), however, does not track child-processes and thus profiling is limited to a single process.
73+
74+
### Profiling Backends
75+
76+
The Pyroscope Agent doesn't do any profiling. The agent role is to orchasrate 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 seperately. The currently available backends are:
77+
78+
- [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).
81+
82+
6183
### Limitations
6284

6385
- **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.
64-
- **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.
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.
6588
- **Timer**: epoll (for Linux) and kqueue (for macOS) are required for a more precise timer.
66-
- **Shutdown**: The Pyroscope Agent might take some time (usually less than 10 seconds) to shutdown properly and drop its threads.
89+
- **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.
6790

6891
### Getting help
6992

0 commit comments

Comments
 (0)