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

chore: add handling for alias events in tracked users report #4899

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

mihir20
Copy link
Contributor

@mihir20 mihir20 commented Jul 16, 2024

Description

We will add previousID that we received in the identifiedAnonID bucket so that it will be substracted from the total count. e.g

e.g. we receive events
		{type:track, anonymousID: anon1}
		{type:track, userID: user1}
		{type:track, userID: user2}
		{type:identify, userID: user1, anonymousID: anon1}
		{type:alias, previousId: user2, userID: user1}
		
		userHLL: {user1, user2}, 
		anonHLL: {anon1}, 
		identifiedAnonHLL: {user1-anon1, user2}
		
		cardinality: len(userHLL)+len(anonHLL)-len(identifiedAnonHLL): 2+1-2 = 1

https://www.rudderstack.com/docs/event-spec/standard-events/alias/

ref: https://rudderlabs.slack.com/archives/C075KC5G81G/p1720670222299599

Linear Ticket

https://linear.app/rudderstack/issue/PIPE-1305/add-handling-for-alias-events-in-mtu

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 Jul 16, 2024

Important

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.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mihir20 mihir20 changed the title chore: Add handling for alias events in MTU chore: add handling for alias events in MTU Jul 16, 2024
@mihir20 mihir20 changed the title chore: add handling for alias events in MTU chore: add handling for alias events in tracked users report Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.48%. Comparing base (95f402d) to head (343e150).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4899      +/-   ##
==========================================
+ Coverage   74.39%   74.48%   +0.09%     
==========================================
  Files         428      428              
  Lines       49763    49768       +5     
==========================================
+ Hits        37019    37070      +51     
+ Misses      10301    10258      -43     
+ Partials     2443     2440       -3     

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

@mihir20 mihir20 requested review from lvrach and ktgowtham July 16, 2024 08:41
enterprise/trackedusers/users_reporter.go Outdated Show resolved Hide resolved
@mihir20 mihir20 force-pushed the mihir/pipe-1305 branch 3 times, most recently from e6f08dc to 4aed384 Compare July 22, 2024 10:54
@mihir20 mihir20 requested a review from ktgowtham July 22, 2024 10:59
// userHLL: {user1, user2}, anonHLL: {anon1}, identifiedAnonHLL: {user1-anon1, user2}
// cardinality: len(userHLL)+len(anonHLL)-len(identifiedAnonHLL): 2+1-2 = 1
if eventType == eventTypeAlias {
previousID := gjson.GetBytes(job.EventPayload, "batch.0.previousId").String()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we only looking at the first entry in batch and not all entries ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each batch will have only have 1 event. Even if on gateway we receive a batch request we break that down and we create a new entry for each event in a batch. and each entry will be like {"batch":[{event...}]}

@mihir20 mihir20 merged commit 663cdd3 into master Jul 24, 2024
53 checks passed
@mihir20 mihir20 deleted the mihir/pipe-1305 branch July 24, 2024 06:27
@mihir20 mihir20 mentioned this pull request Aug 2, 2024
1 task
This was referenced Aug 5, 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.

3 participants