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

Channels-1094 refactored #2325

Merged
merged 175 commits into from
Oct 8, 2024
Merged

Channels-1094 refactored #2325

merged 175 commits into from
Oct 8, 2024

Conversation

pmunin
Copy link
Member

@pmunin pmunin commented Aug 21, 2024

Must be deployed together with Integrations PR. Please see deployment and testing information there.

Refactoring changes of #2024

Implementation of Dedup RFC

Testing

image
Test results

With Logging OFF - introducing Caching reduces dups from ~3k down to 184 (~94%)
With Logging ON - Caching reduces dups from 4.5k down to 2.3k (~49%)

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [Segmenters] Tested in the staging environment

cogwizzle added 30 commits May 3, 2024 10:19
engageDestinationCache. This is because this cache is no longer just
intended to be used for DataFeed cache, but is now intended to be used
as a more generic cache for the Engage Destination.

const DEFAULT_RETRY_ATTEMPTS = 2

export async function retry<T>(
Copy link
Member

Choose a reason for hiding this comment

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

This looks like you copied it from actions-core. Please resolve the import at the top and avoid duplicating code entirely

export async function retry<T>(

Copy link
Member Author

Choose a reason for hiding this comment

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

This is exactly what the comment above says:

/**
 * import { retry } from '@segment/actions-core/retry'
 * ^ This import is not working, gives a runtime error: retry_1.retry is not a function during jest tests,
 * so the following code is a copy of the original code from: @segment/actions-core/retry.
 * Once jest config is fixed to use the correct import, the following code should be removed.
 */

This is for owners of the repo to resolve in a separate PR. has nothing to do with current story.

Copy link
Member

@nick-Ag nick-Ag left a comment

Choose a reason for hiding this comment

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

Read thru all the code, thank you for addressing comments so far.
I do think for the getOrRetry.ts file, the broken import: // import { retry } from '@segment/actions-core/retry' // TODO: fix this import. Currently it gives a runtime error: retry_1.retry is not a function (see below) needs to be fixed before merging.

If you can't find a way to get that working then please write up a ticket on the stratconn board that describes how to reproduce the issue you're seeing so that we can be aware of it. We shouldn't leave TODOs in the codebase without a solid way to followup on them. Please don't leave items for our team to fix without notifying us of the issue

@pmunin pmunin requested a review from nick-Ag October 3, 2024 21:15
@pmunin
Copy link
Member Author

pmunin commented Oct 3, 2024

@nick-Ag fixed it (it was easier to fix than I expected), plz review

try {
const msgs = [msg, ...(metadata ? [JSON.stringify(metadata)] : [])]
const [firstMsg, ...rest] = msgs
this.loggerClient?.info(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to leave these logs around permanently? If they're to facilitate testing, can we commit to removing them once the changes are validated in production?

Copy link
Member Author

@pmunin pmunin Oct 7, 2024

Choose a reason for hiding this comment

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

yes, we need it. this is old logic - logInfo is feature-flagged and by default OFF in Production. We occasionally turn it on for certain workspaces for troubleshooting scenarios. The change in this PR is to wrap it with try-catch, to reduce risks of logging impacting duplicate rate (we see during tests that with logInfo enabled dup rate is higher for some reason)

@joe-ayoub-segment
Copy link
Contributor

hi @brennan there's some core changes in here. Do you want me to deploy this on Tuesday, or would you prefer that it's done by someone in the US during US working hours so that it can be monitored more closely?

@brennan
Copy link
Contributor

brennan commented Oct 7, 2024

@joe-ayoub-segment Please do not merge/deploy this PR as part of the regularly scheduled deploy on October 8. The on-call will deploy this separately in the late morning/early afternoon. Thank you.

@nick-Ag nick-Ag merged commit 9098b20 into main Oct 8, 2024
14 checks passed
@nick-Ag nick-Ag deleted the channels-1094-refactoring branch October 8, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants