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

ref(metrics-extraction): Split span and transaction metric extraction #2191

Merged
merged 10 commits into from
Jun 9, 2023

Conversation

iker-barriocanal
Copy link
Contributor

We've been plugging span extraction in relay-server/src/metrics_extraction/transactions/mod.rs. As the module's scope and responsibilities increase, splitting span and transaction responsibilities into two different modules helps to better understand the code and make more targeted tests, for example.

Note: this PR doesn't contain any functional changes, only a refactor moving code around.

Summary of changes, in the relay-server crate:

  • Create module metrics_extraction/performance, with two submodules inside: spans and transactions.
  • Delete former metrics_extraction/transactions/mod.rs. The contents are split into the above-mentioned spans and transactions modules.
  • Shared functions between metrics_extraction/performance/spans and metrics_extraction/performance/transactions have been moved to metrics_extraction/performance/utils.rs. I'm not opinionated on the name of this file and am open to changing it.
  • A single test snapshot has been moved, without any changes besides the path rename.
  • Other minor import updates to reflect the new paths.

This PR is a first step to achieving a better responsibility split. More PRs will follow to improve this, such as splitting tests. I'm not including these in the current PR to minimize the number of changes and reduce risk.

#skip-changelog

@iker-barriocanal iker-barriocanal self-assigned this Jun 6, 2023
@iker-barriocanal iker-barriocanal requested a review from a team June 6, 2023 15:33
Copy link
Contributor

@olksdr olksdr left a comment

Choose a reason for hiding this comment

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

Could we remove such deep-nested module structure?

More PRs will follow to improve this, such as splitting tests. I'm not including these in the current PR to minimize the number of changes and reduce risk.

You are already moving code around, what the risk would that be to also move the tests into appropriate modules?

Copy link
Contributor

Choose a reason for hiding this comment

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

What the reason to create so deep module structure?
Why don't just use transactions and spans modules in the root of metrics_extractions which makes perfect sense to me, and we do not create those very long module paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created it to have shared functions that sessions don't need to access, but I agree it's too much complexity. Addressed in 0389e09.

relay-server/src/actors/processor.rs Outdated Show resolved Hide resolved
@iker-barriocanal
Copy link
Contributor Author

You are already moving code around, what the risk would that be to also move the tests into appropriate modules?

In this case, it's not about moving tests, but about splitting the test that currently verifies both transaction and span metric extraction. Addressing this means splitting the test, and I want to avoid adding that in this PR because it's harder to identify missing cases (good luck finding that in the diff). Not strongly opinionated though, so I'm open to also addressing that in this PR. I think this approach reduces some risk. What do you think, does this sound reasonable?

@iker-barriocanal iker-barriocanal requested a review from olksdr June 7, 2023 12:40
Copy link
Contributor

@olksdr olksdr left a comment

Choose a reason for hiding this comment

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

lgtm!

If taking caring of the tests is easier to do in the followup, i'm also ok with that.

Thanks for taking care of this!

@iker-barriocanal iker-barriocanal merged commit a013cca into master Jun 9, 2023
@iker-barriocanal iker-barriocanal deleted the iker/ref/span-metrics-dir branch June 9, 2023 07:19
jan-auer added a commit that referenced this pull request Jun 14, 2023
* master: (32 commits)
  feat(txname): Mark all URL transactions as sanitized (#2210)
  fix(profiles): Enforce profile quotas on metrics buckets (#2212)
  revert(spans): Move span metrics back to transactions namespace (#2206)
  instr(metrics): Add values to invalid metric errors (#2201)
  ref(spans): Move span metrics to spans namespace (#2205)
  chore(protocol): Add missing py/changelog entry for lock property (#2203)
  build(py): Move pytest.ini to tests directory (#2204)
  ref: Use serde collect_str to avoid allocations (#2149)
  chore(gocd): Auto approve deploy relay-pop on check success (#2200)
  test(document-pii): Fix flaky test (#2198)
  feat(spans): Extract transaction `user` into span's databag (#2197)
  feat(spans): Extract `release` tag from the transaction to the span (#2189)
  ref(metrics-extraction): Split span and transaction metric extraction (#2191)
  ref(crons): Support GET in the check-in endpoint (#2192)
  ref(spans): Introduce opinionated casing in span metrics (#2193)
  chore(py): Bump `requests` lib version (#2194)
  doc: document pii fields (#1972)
  feat: Added cron specific endpoint (#2153)
  feat(profiling): Extract app identifier from app context (#2172)
  feat(ci): Add CI-check for pop-deploys  (#2184)
  ...
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.

2 participants