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 (#5171)
  • Loading branch information
vamsikrishnakandi authored Oct 4, 2024
1 parent bf45d23 commit 87283c4
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 @@ -649,7 +649,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 @@ -663,8 +662,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
runeEventName := []rune(metric.StatusDetail.EventName)
if len(runeEventName) > 50 {
metric.StatusDetail.EventName = fmt.Sprintf("%s...%s", string(runeEventName[:40]), string(runeEventName[len(runeEventName)-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 87283c4

Please sign in to comment.