Skip to content

Commit

Permalink
chore: trim eventNames sent to reporting if length exceeds 50 charact…
Browse files Browse the repository at this point in the history
…ers (#5138)
  • Loading branch information
vamsikrishnakandi authored Sep 26, 2024
1 parent f835aa7 commit 33b5f63
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,3 @@ PgNotifier:
retriggerCount: 500
trackBatchInterval: 2s
maxAttempt: 3
Reporting:
eventNameMaxLength: 0
6 changes: 3 additions & 3 deletions enterprise/reporting/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ func (r *DefaultReporter) Report(ctx context.Context, metrics []*types.PUReporte
}
defer func() { _ = stmt.Close() }()

eventNameMaxLength := config.GetInt("Reporting.eventNameMaxLength", 0)
reportedAt := time.Now().UTC().Unix() / 60
for _, metric := range metrics {
workspaceID := r.configSubscriber.WorkspaceIDFromSource(metric.ConnectionDetails.SourceID)
Expand All @@ -621,8 +620,9 @@ func (r *DefaultReporter) Report(ctx context.Context, metrics []*types.PUReporte
metric = transformMetricForPII(metric, getPIIColumnsToExclude())
}

if eventNameMaxLength > 0 && len(metric.StatusDetail.EventName) > eventNameMaxLength {
metric.StatusDetail.EventName = types.MaxLengthExceeded
eventName := metric.StatusDetail.EventName
if len(eventName) > 50 {
metric.StatusDetail.EventName = fmt.Sprintf("%s...%s", eventName[:40], eventName[len(eventName)-10:])
}

_, err = stmt.Exec(
Expand Down
2 changes: 0 additions & 2 deletions utils/types/reporting_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const (
DefaultReplayEnabled = false
)

const MaxLengthExceeded = ":max-length-exceeded:"

const (
DiffStatus = "diff"

Expand Down

0 comments on commit 33b5f63

Please sign in to comment.