-
Notifications
You must be signed in to change notification settings - Fork 303
/
metrics.go
38 lines (30 loc) · 1.01 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package model
import "time"
var DefaultReportingPeriod = 5 * time.Minute
// Metrics settings generally map to exporter options
// https://pkg.go.dev/contrib.go.opencensus.io/exporter/ocagent?tab=doc#ExporterOption
type MetricsSettings struct {
Enabled bool
Address string
Insecure bool
// How often Tilt reports its metrics. Useful for testing.
// https://pkg.go.dev/go.opencensus.io/stats/view?tab=doc#SetReportingPeriod
ReportingPeriod time.Duration
// Whether anonymous metrics are allowed.
// The normal tilt prod metrics processor requires the
// user to be logged in.
AllowAnonymous bool
}
func DefaultMetricsSettings() MetricsSettings {
return MetricsSettings{
Enabled: false,
Address: "opentelemetry.tilt.dev:443",
ReportingPeriod: DefaultReportingPeriod,
}
}
// User metrics preferences
type MetricsMode string
const MetricsDefault = MetricsMode("")
const MetricsDisabled = MetricsMode("disabled")
const MetricsLocal = MetricsMode("local")
const MetricsProd = MetricsMode("prod")