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 RegEx in FeatureFileOrchestrator to resolve file consent type #1645

Merged

Conversation

mariusc83
Copy link
Member

@mariusc83 mariusc83 commented Sep 27, 2023

What does this PR do?

The NDK folders do not produce batching telemetry so we had to simplify the rules a bit by removing the | separator case.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@mariusc83 mariusc83 requested a review from a team as a code owner September 27, 2023 11:33
@mariusc83 mariusc83 self-assigned this Sep 27, 2023
0xnm
0xnm previously approved these changes Sep 27, 2023
jonathanmos
jonathanmos previously approved these changes Sep 27, 2023
@@ -64,7 +64,7 @@ internal class FeatureFileOrchestrator(
)

companion object {
private const val BASE_DIR_NAME_REG_EX = "([a-z]+[-|_])+"
private const val BASE_DIR_NAME_REG_EX = "([a-z]+(-|_))+"
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a list of all the available names so far? Why are we including the _ character?

Copy link
Member Author

Choose a reason for hiding this comment

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

the _ is used in the NDK folders for some reason...I see it was not aligned with the new folders name format. For now all the other features are using the - separator. That's the list so far:

logs-pending-v2
logs-v2
ndk_crash_reports_intermediary_v2
ndk_crash_reports_v2
rum-pending-v2
rum-v2
session-replay-pending-v2
session-replay-v2
tracing-pending-v2
tracing-v2

Copy link
Member

Choose a reason for hiding this comment

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

NDK feature doesn't use storage for batches, so we may exclude folders belonging to it, it is outside of the scope for file orchestrator

Copy link
Member Author

Choose a reason for hiding this comment

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

ok that's great...and the way I see it neither the uploader is using it as the ndk_crash_file is just used to write the equivalent RUM event in their (pending|granted) folder at runtime ? Can you confirm this @0xnm ...this way I could remove that extra rule from there

Copy link
Member

Choose a reason for hiding this comment

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

so it seems you can simplify that regex to ([a-z]+-)+

Copy link
Member

Choose a reason for hiding this comment

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

yes, NDK folders are out of scope of the upload pipeline

Copy link
Member Author

Choose a reason for hiding this comment

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

@xgouchet yup doing this now after the confirmation ;)

@mariusc83 mariusc83 requested review from xgouchet and 0xnm September 27, 2023 12:49
@mariusc83 mariusc83 dismissed stale reviews from jonathanmos and 0xnm via 8b5140f September 27, 2023 12:50
@mariusc83 mariusc83 force-pushed the mconstantin/fix-reg-ex-in-fetaure-file-orchestrator branch from 9ea793f to 8b5140f Compare September 27, 2023 12:50
@@ -64,7 +64,7 @@ internal class FeatureFileOrchestrator(
)

companion object {
private const val BASE_DIR_NAME_REG_EX = "([a-z]+[-|_])+"
private const val BASE_DIR_NAME_REG_EX = "([a-z]+-)+"
Copy link
Member

@0xnm 0xnm Sep 27, 2023

Choose a reason for hiding this comment

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

I'm not sure if it is simpler, but probably it just can be [a-z\-]+. Yes, it allows to have multiple - or even only -, but maybe evaluation will be simpler/faster. I checked ([a-z]+-)+v[0-9]+ and for test string session-replay-v2 it captures 2 groups (well, not a bit deal, since overall string still matches).

Anyway, not blocking for me I think.

@@ -608,13 +608,13 @@ internal class BatchMetricsDispatcherTest {
}

private fun Forge.forgeAGrantedDirName(): String {
val separator = if (aBool()) "_" else "-"
val separator = "-"
Copy link
Member

Choose a reason for hiding this comment

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

can be just as joinToString argument like joinToString(separator = "-"). Same below

Copy link
Member Author

Choose a reason for hiding this comment

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

yes I just wanted to keep that for visibility in case I need to update this later...sorry it's been so many changes here in this PR that I'd rather keep it like that.

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2023

Codecov Report

Merging #1645 (0f130fc) into develop (5b801db) will increase coverage by 0.06%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #1645      +/-   ##
===========================================
+ Coverage    83.66%   83.72%   +0.06%     
===========================================
  Files          456      456              
  Lines        15696    15696              
  Branches      2347     2347              
===========================================
+ Hits         13131    13141      +10     
+ Misses        1932     1928       -4     
+ Partials       633      627       -6     
Files Coverage Δ
...rsistence/file/advanced/FeatureFileOrchestrator.kt 100.00% <ø> (ø)

... and 20 files with indirect coverage changes

@mariusc83 mariusc83 force-pushed the mconstantin/fix-reg-ex-in-fetaure-file-orchestrator branch from 8b5140f to 0f130fc Compare September 27, 2023 13:41
@mariusc83 mariusc83 merged commit b89e6c9 into develop Sep 28, 2023
5 checks passed
@mariusc83 mariusc83 deleted the mconstantin/fix-reg-ex-in-fetaure-file-orchestrator branch September 28, 2023 07:42
@xgouchet xgouchet added this to the 2.2.0 milestone Dec 13, 2023
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.

5 participants