Skip to content

Commit

Permalink
chore: revert "chore: trim eventNames sent to reporting if length exc…
Browse files Browse the repository at this point in the history
…eeds 50 characters" (#5155)
  • Loading branch information
achettyiitr authored Oct 1, 2024
1 parent 61e947c commit 17c5ad7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,5 @@ 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,6 +649,7 @@ 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 @@ -662,9 +663,8 @@ func (r *DefaultReporter) Report(ctx context.Context, metrics []*types.PUReporte
metric = transformMetricForPII(metric, getPIIColumnsToExclude())
}

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

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

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

const (
DiffStatus = "diff"

Expand Down

0 comments on commit 17c5ad7

Please sign in to comment.