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

Refactor webhooks package #7040

Merged
merged 9 commits into from Apr 19, 2024
Merged

Refactor webhooks package #7040

merged 9 commits into from Apr 19, 2024

Conversation

adriansmares
Copy link
Contributor

@adriansmares adriansmares commented Apr 18, 2024

Summary

References https://github.com/TheThingsIndustries/lorawan-stack/issues/4163
References https://github.com/TheThingsIndustries/lorawan-stack/pull/4183

This PR backports the changes related to webhook durability in order to lower the reviewable diff in enterprise.

Changes

  • Reserve API fields to be used by webhook queueing.
  • Decompose the web package.
    • It was a pretty huge monolith. We've added many features over time in this package, while also attaching them quite heavily to the webhooks struct and so forth.
    • webhooks.go got split a bit, specifically functionality which wasn't really part of the webhooks object was split into smaller components in order to allow reusability and more focused testing.
    • The sinks have been torn out of web and got their own dedicated package.
    • The context utilities have been extracted into an internal package and got compressed into a single context.WithValue in order to lower the number of allocations a bit. Just chaining context.WithValue 3 times when we always do it in the same order and with the same structure is just wasteful.
  • Clarify the semantics on who generates a failure / a success when it comes to events and metrics with respect to webhooks.

Testing

This is strictly a refactoring without new functionality changes. Most of the code is just strategically moved around in order to decouple it. No manual testing is required, and the existing unit tests should suffice.

Regressions

N/A.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Testing: The steps/process to test this feature are clearly explained including testing for regressions.
  • Infrastructure: If infrastructural changes (e.g., new RPC, configuration) are needed, a separate issue is created in the infrastructural repositories.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@adriansmares adriansmares added this to the v3.30.1 milestone Apr 18, 2024
@adriansmares adriansmares self-assigned this Apr 18, 2024
@github-actions github-actions bot added c/application server This is related to the Application Server ui/web This is related to a web interface compat/config This could affect Configuration compatibility labels Apr 18, 2024
@adriansmares adriansmares marked this pull request as ready for review April 18, 2024 16:19
@adriansmares adriansmares requested review from a team as code owners April 18, 2024 16:19
@adriansmares adriansmares merged commit 95552a3 into v3.30 Apr 19, 2024
15 of 16 checks passed
@adriansmares adriansmares deleted the feature/4163-rework-webhooks branch April 19, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/application server This is related to the Application Server compat/config This could affect Configuration compatibility ui/web This is related to a web interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants