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

Conversation

vamsikrishnakandi
Copy link
Contributor

@vamsikrishnakandi vamsikrishnakandi commented Dec 18, 2023

Description

To reduce events with junk eventNames, adding a restriction on length of eventName. Added a configuration, if a valid max length is given, it replaces eventName (if it is longer than max length) to :max-length-exceeded:. How to show this in UI will be handled in web-app.

Default for the config is set to zero, which will not change anything.

More details in linear ticket and attached notion doc in it.

Completes OBS-126

Linear Ticket

https://linear.app/rudderstack/issue/OBS-126/validate-eventname-in-reports

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Copy link
Contributor

coderabbitai bot commented Dec 18, 2023

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file
    • @coderabbitai modularize this function
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai gather interesting statistics about this repository and render them in a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (1ff6f90) 73.81% compared to head (4bab9bf) 73.90%.
Report is 2 commits behind head on master.

Files Patch % Lines
enterprise/reporting/reporting.go 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4244      +/-   ##
==========================================
+ Coverage   73.81%   73.90%   +0.08%     
==========================================
  Files         388      388              
  Lines       54835    54839       +4     
==========================================
+ Hits        40478    40527      +49     
+ Misses      12036    11991      -45     
  Partials     2321     2321              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -589,6 +589,10 @@ func (r *DefaultReporter) Report(ctx context.Context, metrics []*types.PUReporte
metric = transformMetricForPII(metric, getPIIColumnsToExclude())
}

if len(metric.StatusDetail.EventName) > config.GetInt("Reporting.eventNameMaxLength", 100) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we trim down event names instead to the first 100 characters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cardinality can be a serious issue even with event names having less than 100 characters though, e.g. a uuid is 36 characters and ksuid is 28 characters.
Why are we coupling it with the length of characters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial thought is to trim them but when we looked at the data, 99.55% of eventNames longer than 100 characters are stringified JSONs or URLs. And rest of them can also be avoided with good instrumentation. So, we decided to go with this as this will also help with cardinality.

@vamsikrishnakandi vamsikrishnakandi changed the title fix: changing eventName longer than 100 characters to INVALID_EVENT_NAME fix: changing eventName longer than 100 characters to ":max-length-exceeded:" Dec 27, 2023
@vamsikrishnakandi vamsikrishnakandi changed the title fix: changing eventName longer than 100 characters to ":max-length-exceeded:" fix: changing eventNames longer than configured max length to ":max-length-exceeded:" before sending to reporting Dec 27, 2023
@cisse21 cisse21 merged commit 719396f into master Jan 3, 2024
47 checks passed
@cisse21 cisse21 deleted the fix.largeEventName branch January 3, 2024 14:32
This was referenced Jan 15, 2024
This was referenced Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants