@@ -19,46 +19,49 @@ func Stop() {}
19
19
20
20
## ` func Start(opts ...Option) error `
21
21
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
23
23
it to the Agent periodically.
24
24
25
25
An example using all available ` Option ` 's that can be used with ` Start ` :
26
26
27
27
``` go
28
+ import (
29
+ profiler " github.com/blackfireio/go-continuous-profiling"
30
+ )
31
+
28
32
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 ),
39
47
)
40
48
defer profiler.Stop ()
41
49
```
42
50
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.
59
51
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 ` .
62
65
63
66
Note:
64
67
If the same parameter is set by both an environment variable and a ` Start ` call, the explicit
0 commit comments