Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling the telemetry call to support hearbeat #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func Start(serviceName string, licenseKeyChan <-chan string) {
telemetryDisabled := os.Getenv(ENV_TELEMETRY_DISABLED)
log.Debug().Str(ENV_TELEMETRY_DISABLED, telemetryDisabled).Msg("Environment variable:")

if telemetryDisabled == "true" {
return
}
// if telemetryDisabled == "true" {
// return
// }

telemetryIntervalSecondsEnv := os.Getenv(ENV_TELEMETRY_INTERVAL_SECONDS)
log.Debug().Str(ENV_TELEMETRY_INTERVAL_SECONDS, telemetryIntervalSecondsEnv).Msg("Environment variable:")
Expand All @@ -62,7 +62,15 @@ func Start(serviceName string, licenseKeyChan <-chan string) {
if err != nil {
log.Warn().Err(err).Msg("Telemetry")
} else {
log.Debug().Interface("stats", stats).Msg("Telemetry")
log.Debug().Interface("stats", stats).Msg("Telemetry")
if telemetryDisabled == "true" {
err = emitMetrics(nil, serviceName, license)
} else {
err = emitMetrics(stats, serviceName, license)
}
if err != nil {
log.Warn().Err(err).Msg("Telemetry")
}
}
case newLicense := <-licenseKeyChan: // license updated
license = newLicense
Expand Down Expand Up @@ -93,7 +101,7 @@ func Run(startTime time.Time, serviceName string, license string) (stats *Stats,
Hostname: strings.TrimSpace(hostname),
}

err = emitMetrics(stats, serviceName, license)
// err = emitMetrics(stats, serviceName, license)
return
}

Expand Down