Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 02b8318

Browse files
authored
Disable telemetry (#929)
Disables latest version checking and log upload when telemetry is disabled. It disables a lot of noisy logs in air-gapped version.
1 parent 72cab08 commit 02b8318

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

quesma/quesma/config/config_v2.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,6 @@ func (c *QuesmaNewConfiguration) TranslateToLegacyConfig() QuesmaConfiguration {
503503
if conf.Elasticsearch, err = c.getElasticsearchConfig(); err != nil {
504504
errAcc = multierror.Append(errAcc, err)
505505
}
506-
if !c.DisableTelemetry {
507-
conf.QuesmaInternalTelemetryUrl = telemetryUrl
508-
conf.Logging.RemoteLogDrainUrl = telemetryUrl
509-
}
510506
// This is perhaps a little oversimplification, **but** in case any of the FE connectors has auth disabled, we disable auth for the whole incomming traffic
511507
// After all, the "duality" of frontend connectors is still an architectural choice we tend to question
512508
for _, fConn := range c.FrontendConnectors {
@@ -520,6 +516,14 @@ func (c *QuesmaNewConfiguration) TranslateToLegacyConfig() QuesmaConfiguration {
520516
conf.Logging.Level = &DefaultLogLevel
521517
}
522518

519+
if !c.DisableTelemetry {
520+
conf.QuesmaInternalTelemetryUrl = telemetryUrl
521+
conf.Logging.RemoteLogDrainUrl = telemetryUrl
522+
} else {
523+
conf.QuesmaInternalTelemetryUrl = nil
524+
conf.Logging.RemoteLogDrainUrl = nil
525+
}
526+
523527
conf.InstallationId = c.InstallationId
524528
conf.LicenseKey = c.LicenseKey
525529

quesma/quesma/ui/dashboard.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (qmc *QuesmaManagementConsole) generateDashboardPanel() []byte {
183183
buffer.Html(`<div id="dashboard-quesma" class="component">`)
184184
buffer.Html(`<h3>Quesma</h3>`)
185185

186-
buffer = maybePrintUpgradeAvailableBanner(buffer)
186+
buffer.Write(qmc.maybePrintUpgradeAvailableBanner())
187187

188188
buffer.Html(`<div class="status">Version: `)
189189
buffer.Text(buildinfo.Version)
@@ -244,13 +244,17 @@ type latestVersionCheckResult struct {
244244

245245
// maybePrintUpgradeAvailableBanner has time cap of 500ms to check for the latest version, if it takes longer than that,
246246
// it will log an error message and don't render anything
247-
func maybePrintUpgradeAvailableBanner(buffer builder.HtmlBuffer) builder.HtmlBuffer {
247+
func (qmc *QuesmaManagementConsole) maybePrintUpgradeAvailableBanner() []byte {
248+
if qmc.cfg.Logging.RemoteLogDrainUrl == nil {
249+
return nil
250+
}
248251

249252
resultChan := make(chan latestVersionCheckResult, 1)
250253
go func() {
251254
upgradeAvailable, message := buildinfo.CheckForTheLatestVersion()
252255
resultChan <- latestVersionCheckResult{upgradeAvailable, message}
253256
}()
257+
buffer := builder.HtmlBuffer{}
254258
select {
255259
case result := <-resultChan:
256260
if result.upgradeAvailable {
@@ -261,5 +265,5 @@ func maybePrintUpgradeAvailableBanner(buffer builder.HtmlBuffer) builder.HtmlBuf
261265
case <-time.After(500 * time.Millisecond):
262266
logger.Error().Msg("Timeout while checking for the latest version.")
263267
}
264-
return buffer
268+
return buffer.Bytes()
265269
}

0 commit comments

Comments
 (0)