Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changing eventNames longer than configured max length to ":max-length-exceeded:" before sending to reporting #4244

Merged
merged 6 commits into from
Jan 3, 2024
Merged
4 changes: 3 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,6 @@ PgNotifier:
retriggerInterval: 2s
retriggerCount: 500
trackBatchInterval: 2s
maxAttempt: 3
maxAttempt: 3
Reporting:
eventNameMaxLength: 0
5 changes: 5 additions & 0 deletions enterprise/reporting/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@
}
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 @@ -589,6 +590,10 @@
metric = transformMetricForPII(metric, getPIIColumnsToExclude())
}

if eventNameMaxLength > 0 && len(metric.StatusDetail.EventName) > eventNameMaxLength {
metric.StatusDetail.EventName = types.MaxLengthExceeded
}

Check warning on line 595 in enterprise/reporting/reporting.go

View check run for this annotation

Codecov / codecov/patch

enterprise/reporting/reporting.go#L594-L595

Added lines #L594 - L595 were not covered by tests

_, err = stmt.Exec(
workspaceID, r.namespace, r.instanceID,
metric.ConnectionDetails.SourceDefinitionId,
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:"

var (
DiffStatus = "diff"

Expand Down
Loading