Skip to content

Commit c707aea

Browse files
authored
chore: clean up logs to trace double-encoded HLL value issue (#6310)
Reverts #6044
1 parent a2e753d commit c707aea

File tree

3 files changed

+7
-37
lines changed

3 files changed

+7
-37
lines changed

enterprise/reporting/flusher/aggregator/tracked_users_inapp.go

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,21 @@ import (
1212

1313
"github.com/rudderlabs/rudder-go-kit/config"
1414
"github.com/rudderlabs/rudder-go-kit/jsonrs"
15-
"github.com/rudderlabs/rudder-go-kit/logger"
1615
"github.com/rudderlabs/rudder-go-kit/stats"
1716
)
1817

1918
const tableName = `tracked_users_reports`
2019

21-
const problematicHLLValue = "5c78313139303766"
22-
2320
type TrackedUsersInAppAggregator struct {
24-
db *sql.DB
25-
stats stats.Stats
26-
logger logger.Logger
21+
db *sql.DB
22+
stats stats.Stats
2723

2824
reportsCounter stats.Measurement
2925
aggReportsCounter stats.Measurement
3026
}
3127

32-
func NewTrackedUsersInAppAggregator(db *sql.DB, s stats.Stats, conf *config.Config, module string, logger logger.Logger) *TrackedUsersInAppAggregator {
33-
t := TrackedUsersInAppAggregator{db: db, stats: s, logger: logger}
28+
func NewTrackedUsersInAppAggregator(db *sql.DB, s stats.Stats, conf *config.Config, module string) *TrackedUsersInAppAggregator {
29+
t := TrackedUsersInAppAggregator{db: db, stats: s}
3430
tags := stats.Tags{
3531
"instance": conf.GetString("INSTANCE_ID", "1"),
3632
"table": tableName,
@@ -59,14 +55,6 @@ func (a *TrackedUsersInAppAggregator) Aggregate(ctx context.Context, start, end
5955
if err != nil {
6056
return nil, fmt.Errorf("cannot scan row %w", err)
6157
}
62-
63-
if r.UserIDHLLHex == problematicHLLValue || r.AnonymousIDHLLHex == problematicHLLValue || r.IdentifiedAnonymousIDHLLHex == problematicHLLValue {
64-
a.logger.Errorn("found problematic hll value from database",
65-
logger.NewStringField("workspace_id", r.WorkspaceID),
66-
logger.NewStringField("source_id", r.SourceID),
67-
)
68-
}
69-
7058
r.UserIDHLL, err = a.decodeHLL(r.UserIDHLLHex)
7159
if err != nil {
7260
return nil, fmt.Errorf("cannot decode hll %w", err)
@@ -97,7 +85,7 @@ func (a *TrackedUsersInAppAggregator) Aggregate(ctx context.Context, start, end
9785
return nil, fmt.Errorf("rows errors %w", err)
9886
}
9987

100-
jsonReports, err = marshalReports(aggReportsMap, a.logger)
88+
jsonReports, err = marshalReports(aggReportsMap)
10189
if err != nil {
10290
return nil, fmt.Errorf("error marshalling reports %w", err)
10391
}
@@ -120,21 +108,13 @@ func (a *TrackedUsersInAppAggregator) decodeHLL(encoded string) (*hll.Hll, error
120108
return &hll, nil
121109
}
122110

123-
func marshalReports(aggReportsMap map[string]*TrackedUsersReport, log logger.Logger) ([]json.RawMessage, error) {
111+
func marshalReports(aggReportsMap map[string]*TrackedUsersReport) ([]json.RawMessage, error) {
124112
jsonReports := make([]json.RawMessage, 0, len(aggReportsMap))
125113
for _, v := range aggReportsMap {
126114
data, err := jsonrs.Marshal(v)
127115
if err != nil {
128116
return nil, err
129117
}
130-
131-
if v.UserIDHLLHex == problematicHLLValue || v.AnonymousIDHLLHex == problematicHLLValue || v.IdentifiedAnonymousIDHLLHex == problematicHLLValue {
132-
log.Errorn("found problematic hll value in marshalled data",
133-
logger.NewStringField("workspace_id", v.WorkspaceID),
134-
logger.NewStringField("source_id", v.SourceID),
135-
)
136-
}
137-
138118
jsonReports = append(jsonReports, data)
139119
}
140120
return jsonReports, nil

enterprise/reporting/flusher/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func CreateRunner(ctx context.Context, table string, log logger.Logger, stats st
5656
parsedURL.Path = path.Join(parsedURL.Path, "trackedUser")
5757
reportingURL := parsedURL.String()
5858

59-
a := aggregator.NewTrackedUsersInAppAggregator(db, stats, conf, module, log)
59+
a := aggregator.NewTrackedUsersInAppAggregator(db, stats, conf, module)
6060
f, err := NewFlusher(db, log, stats, conf, table, reportingURL, commonClient, a, module)
6161
if err != nil {
6262
return nil, fmt.Errorf("error creating flusher %w", err)

enterprise/trackedusers/users_reporter.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ const (
3838
trackUsersTable = "tracked_users_reports"
3939

4040
eventTypeAlias = "alias"
41-
42-
problematicHLLValue = "5c78313139303766"
4341
)
4442

4543
type UsersReport struct {
@@ -225,14 +223,6 @@ func (u *UniqueUsersReporter) ReportUsers(ctx context.Context, reports []*UsersR
225223
if err != nil {
226224
return fmt.Errorf("converting identified anon id hll to string: %w", err)
227225
}
228-
229-
if userIDHllString == problematicHLLValue || anonIDHllString == problematicHLLValue || identifiedAnnIDHllString == problematicHLLValue {
230-
u.log.Errorn("found problematic hll value before storing to database",
231-
logger.NewStringField("workspace_id", report.WorkspaceID),
232-
logger.NewStringField("source_id", report.SourceID),
233-
)
234-
}
235-
236226
_, err = stmt.Exec(report.WorkspaceID,
237227
u.instanceID,
238228
report.SourceID,

0 commit comments

Comments
 (0)