Skip to content

Commit 7ddd0d3

Browse files
codebienjoanlopez
andauthored
Document imported modules and used outputs report (#1478)
Added the new collected data and refreshed a bit the page. --------- Co-authored-by: Joan López de la Franca Beltran <[email protected]>
1 parent 02b46d1 commit 7ddd0d3

File tree

1 file changed

+8
-44
lines changed

1 file changed

+8
-44
lines changed

docs/sources/next/misc/usage-collection.md

+8-44
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ weight: 02
66

77
# Usage collection
88

9-
By default, k6 sends a usage report each time it is run, so that we can track how often people use it. This report can be turned off by setting the environment variable `K6_NO_USAGE_REPORT` or by adding the option `--no-usage-report` when executing k6.
9+
By default, k6 sends an anonymous usage report each time it is run, so that we can track relevant information to be able to build the product making better data-driven decisions. Prioritizing the features that benefit the most and reducing the impact of changes.
10+
11+
The report can be turned off by setting the [no usage report](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/k6-options/reference/#no-usage-report) option setting the environment variable `K6_NO_USAGE_REPORT` or by adding the flag `--no-usage-report` when executing k6.
1012

1113
The usage report does not contain any information about what you are testing. The contents are the following:
1214

@@ -17,49 +19,11 @@ The usage report does not contain any information about what you are testing. Th
1719
- VU iterations configured (number)
1820
- The running program's operating system target (`darwin`, `freebsd`, `linux`...)
1921
- The running program's architecture target (386, amd64, arm, s390x...)
22+
- The list of JavaScript imported modules (`k6/http`, `k6/experimental/webcrypto`, ...)
23+
- The list of used outputs (`json`, `influxdb`, ...)
2024

21-
This info is sent to an HTTP server that collects statistics on k6 usage.
22-
23-
For those interested, here is the actual Go [code](https://github.com/grafana/k6/blob/master/cmd/run.go) that generates and sends the usage report:
24-
25-
{{< code >}}
26-
27-
```go
28-
// If the user hasn't opted out: report usage.
29-
30-
if !conf.NoUsageReport.Bool {
31-
go func() {
32-
u := "http://k6reports.k6.io/"
33-
mime := "application/json"
34-
var endTSeconds float64
35-
36-
if endT := engine.Executor.GetEndTime(); endT.Valid {
37-
endTSeconds = time.Duration(endT.Duration).Seconds()
38-
}
39-
40-
var stagesEndTSeconds float64
41-
if stagesEndT := lib.SumStages(engine.Executor.GetStages()); stagesEndT.Valid {
42-
stagesEndTSeconds = time.Duration(stagesEndT.Duration).Seconds()
43-
}
44-
45-
body, err := json.Marshal(map[string]interface{}{
46-
"k6_version": Version,
47-
"vus_max": engine.Executor.GetVUsMax(),
48-
"iterations": engine.Executor.GetEndIterations(),
49-
"duration": endTSeconds,
50-
"st_duration": stagesEndTSeconds,
51-
"goos": runtime.GOOS,
52-
"goarch": runtime.GOARCH,
53-
})
25+
> Only k6 built-in JavaScript modules and outputs are considered. Private modules and custom extensions are excluded.
5426
55-
if err != nil {
56-
panic(err) // This should never happen!!
57-
}
58-
if _, err := http.Post(u, mime, bytes.NewBuffer(body)); err != nil {
59-
log.WithError(err).Debug("Couldn't send usage blip")
60-
}
61-
}()
62-
}
63-
```
27+
This report is sent to an HTTPS server that collects statistics on k6 usage.
6428

65-
{{< /code >}}
29+
k6 is an open-source project and for those interested, the actual code that generates and sends the usage report can be directly reviewed [here](https://github.com/grafana/k6/blob/d031d2b65e9e28143742b4b109f383e6b103ab31/cmd/report.go).

0 commit comments

Comments
 (0)