Skip to content

Commit 12faedb

Browse files
committed
send settings counts as part of app:counts
1 parent ddd9742 commit 12faedb

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

cmd/server/main-server.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ func updateTelemetryCounts(lastCounts telemetrydata.TEventProps) telemetrydata.T
145145
props.CountSSHConn = conncontroller.GetNumSSHHasConnected()
146146
props.CountWSLConn = wslconn.GetNumWSLHasConnected()
147147
props.CountViews, _ = wstore.DBGetBlockViewCounts(ctx)
148+
149+
fullConfig := wconfig.GetWatcher().GetFullConfig()
150+
customWidgets := fullConfig.CountCustomWidgets()
151+
customAIPresets := fullConfig.CountCustomAIPresets()
152+
customSettings := wconfig.CountCustomSettings()
153+
154+
props.UserSet = &telemetrydata.TEventUserProps{
155+
SettingsCustomWidgets: customWidgets,
156+
SettingsCustomAIPresets: customAIPresets,
157+
SettingsCustomSettings: customSettings,
158+
}
159+
148160
if utilfn.CompareAsMarshaledJson(props, lastCounts) {
149161
return lastCounts
150162
}

pkg/telemetry/telemetry.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ func updateActivityTEvent(ctx context.Context, tevent *telemetrydata.TEvent) err
137137
// compute to hour boundary, and round up to next hour
138138
eventTs = eventTs.Truncate(time.Hour).Add(time.Hour)
139139

140-
fullConfig := wconfig.GetWatcher().GetFullConfig()
141-
customWidgets := fullConfig.CountCustomWidgets()
142-
customAIPresets := fullConfig.CountCustomAIPresets()
143-
customSettings := wconfig.CountCustomSettings()
144-
145140
return wstore.WithTx(ctx, func(tx *wstore.TxWrap) error {
146141
// find event that matches this timestamp with event name "app:activity"
147142
var hasRow bool
@@ -158,13 +153,6 @@ func updateActivityTEvent(ctx context.Context, tevent *telemetrydata.TEvent) err
158153
}
159154
mergeActivity(&curActivity, tevent.Props)
160155

161-
if curActivity.UserSet == nil {
162-
curActivity.UserSet = &telemetrydata.TEventUserProps{}
163-
}
164-
curActivity.UserSet.SettingsCustomWidgets = customWidgets
165-
curActivity.UserSet.SettingsCustomAIPresets = customAIPresets
166-
curActivity.UserSet.SettingsCustomSettings = customSettings
167-
168156
if hasRow {
169157
query := `UPDATE db_tevent SET props = ? WHERE uuid = ?`
170158
tx.Exec(query, dbutil.QuickJson(curActivity), uuidStr)

0 commit comments

Comments
 (0)