mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add cross-origin reporting for telemetry in the dashboard (#13612)
* feat: add cross-origin reporting for telemetry in the dashboard * Respect the telemetry flag * Fix embedded metadata * Fix compilation error * Fix linting
This commit is contained in:
@@ -93,6 +93,7 @@ type Reporter interface {
|
||||
// database. For example, if a new user is added, a snapshot can
|
||||
// contain just that user entry.
|
||||
Report(snapshot *Snapshot)
|
||||
Enabled() bool
|
||||
Close()
|
||||
}
|
||||
|
||||
@@ -109,6 +110,10 @@ type remoteReporter struct {
|
||||
shutdownAt *time.Time
|
||||
}
|
||||
|
||||
func (*remoteReporter) Enabled() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *remoteReporter) Report(snapshot *Snapshot) {
|
||||
go r.reportSync(snapshot)
|
||||
}
|
||||
@@ -948,4 +953,5 @@ type ExternalProvisioner struct {
|
||||
type noopReporter struct{}
|
||||
|
||||
func (*noopReporter) Report(_ *Snapshot) {}
|
||||
func (*noopReporter) Enabled() bool { return false }
|
||||
func (*noopReporter) Close() {}
|
||||
|
||||
Reference in New Issue
Block a user