Skip to content

Commit 275a4fe

Browse files
committed
Update go continuous profiling documentation
1 parent ece0c44 commit 275a4fe

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,49 @@ func Stop() {}
1919

2020
## `func Start(opts ...Option) error`
2121

22-
`Start` starts the continuous profiler probe. It collects profiling information and uploads
22+
- `Start` starts the continuous profiler probe. It collects profiling information and uploads
2323
it to the Agent periodically.
2424

2525
An example using all available `Option`'s that can be used with `Start`:
2626

2727
```go
28+
import (
29+
profiler "github.com/blackfireio/go-continuous-profiling"
30+
)
31+
2832
profiler.Start(
29-
WithAppName("my-app"),
30-
WithCPUDuration(3 * time.Second),
31-
WithCPUProfileRate(1000),
32-
WithProfileTypes(CPUProfile),
33-
WithLabels({
34-
"key1": "value1",
35-
"key2": "value2",
36-
}),
37-
WithAgentSocket("unix:///tmp/blackfire-agent.sock"),
38-
WithUploadTimeout(5 * time.Second),
33+
profiler.WithAppName("my-app"),
34+
profiler.WithCPUDuration(3 * time.Second),
35+
profiler.WithCPUProfileRate(1000),
36+
profiler.WithProfileTypes(
37+
profiler.CPUProfile,
38+
profiler.HeapProfile,
39+
profiler.GoroutineProfile,
40+
),
41+
profiler.WithLabels({
42+
"key1": "value1",
43+
"key2": "value2",
44+
}),
45+
profiler.WithAgentSocket("unix:///tmp/blackfire-agent.sock"),
46+
profiler.WithUploadTimeout(5 * time.Second),
3947
)
4048
defer profiler.Stop()
4149
```
4250

43-
`WithAppName`: Sets the application name. Can also be set via the environment variable `BLACKFIRE_CONPROF_APP_NAME`.
44-
45-
`WithCPUDuration`: Specifies the length at which to collect CPU profiles.
46-
The default is 45 seconds. Can also be set via the environment variable `BLACKFIRE_CONPROF_CPU_DURATION`.
47-
48-
`WithCPUProfileRate`: Sets the CPU profiling rate to Hz samples per second.
49-
The default is defined by the Go runtime as 100 Hz. Can also be set via the environment
50-
variable `BLACKFIRE_CONPROF_CPU_PROFILERATE`.
51-
52-
`WithProfileTypes`: WithProfileTypes sets the profiler types. Multiple profile types can be set.
53-
The default is `CPUProfile`.
54-
55-
`WithLabels`: Sets custom labels specific to the profile payload that is sent.
56-
57-
`WithAgentSocket`: Sets the Blackfire Agent's socket. The default is platform dependent
58-
and uses the same default as the Blackfire Agent.
5951

60-
`WithUploadTimeout`: Sets the upload timeout of the message that is sent to the Blackfire Agent.
61-
The default is 10 seconds. Can also be set via the environment variable `BLACKFIRE_CONPROF_UPLOAD_TIMEOUT`.
52+
- `WithAppName`: Sets the application name. Can also be set via the environment variable `BLACKFIRE_CONPROF_APP_NAME`.
53+
- `WithCPUDuration`: Specifies the length at which to collect CPU profiles.
54+
The default is 45 seconds. Can also be set via the environment variable `BLACKFIRE_CONPROF_CPU_DURATION`.
55+
- `WithCPUProfileRate`: Sets the CPU profiling rate to Hz samples per second.
56+
The default is defined by the Go runtime as 100 Hz. Can also be set via the environment
57+
variable `BLACKFIRE_CONPROF_CPU_PROFILERATE`.
58+
- `WithProfileTypes`: WithProfileTypes sets the profiler types. Multiple profile types can be set.
59+
The default is `CPUProfile`, availables are `CPUProfile`, `HeapProfile`, `GoroutineProfile`
60+
- `WithLabels`: Sets custom labels specific to the profile payload that is sent.
61+
- `WithAgentSocket`: Sets the Blackfire Agent's socket. The default is platform dependent
62+
and uses the same default as the Blackfire Agent.
63+
- `WithUploadTimeout`: Sets the upload timeout of the message that is sent to the Blackfire Agent.
64+
The default is 10 seconds. Can also be set via the environment variable `BLACKFIRE_CONPROF_UPLOAD_TIMEOUT`.
6265

6366
Note:
6467
If the same parameter is set by both an environment variable and a `Start` call, the explicit

0 commit comments

Comments
 (0)