BuildStats builds the report without cluster seed data
()
| 83 | |
| 84 | // BuildStats builds the report without cluster seed data |
| 85 | func BuildStats() Report { |
| 86 | var ( |
| 87 | targetName string |
| 88 | editionName string |
| 89 | ) |
| 90 | if target := expvar.Get(statsPrefix + targetKey); target != nil { |
| 91 | if target, ok := target.(*expvar.String); ok { |
| 92 | targetName = target.Value() |
| 93 | } |
| 94 | } |
| 95 | if edition := expvar.Get(statsPrefix + editionKey); edition != nil { |
| 96 | if edition, ok := edition.(*expvar.String); ok { |
| 97 | editionName = edition.Value() |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | return Report{ |
| 102 | PrometheusVersion: build.GetVersion(), |
| 103 | IntervalPeriod: reportInterval.Seconds(), |
| 104 | Os: runtime.GOOS, |
| 105 | Arch: runtime.GOARCH, |
| 106 | Target: targetName, |
| 107 | Edition: editionName, |
| 108 | Metrics: buildMetrics(), |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // buildMetrics builds the metrics part of the report to be sent to the stats server |
| 113 | func buildMetrics() map[string]interface{} { |