-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(events): populate object identifiers in outgoing webhooks analytics events during retries #5067
Merged
likhinbopanna
merged 5 commits into
main
from
events-add-metadata-with-object-identifiers
Jun 24, 2024
Merged
refactor(events): populate object identifiers in outgoing webhooks analytics events during retries #5067
likhinbopanna
merged 5 commits into
main
from
events-add-metadata-with-object-identifiers
Jun 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…r converting to/from JSON values
@@ -0,0 +1 @@ | |||
ALTER TABLE events DROP COLUMN metadata; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
ALTER TABLE events DROP COLUMN metadata; | |
ALTER TABLE events DROP COLUMN IF EXISTS metadata; |
@@ -0,0 +1 @@ | |||
ALTER TABLE events ADD COLUMN metadata JSONB DEFAULT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
ALTER TABLE events ADD COLUMN metadata JSONB DEFAULT NULL; | |
ALTER TABLE events ADD COLUMN IF NOT EXISTS metadata JSONB DEFAULT NULL; |
hrithikesh026
approved these changes
Jun 21, 2024
Aprabhat19
approved these changes
Jun 21, 2024
lsampras
approved these changes
Jun 21, 2024
Narayanbhat166
approved these changes
Jun 21, 2024
pixincreate
added a commit
that referenced
this pull request
Jun 24, 2024
…ough-hyperswitch-cypress * 'main' of github.com:juspay/hyperswitch: feat(router): add support for googlepay step up flow (#2744) fix(access_token): use `merchant_connector_id` in access token (#5106) feat: added kafka events for authentication create and update (#4991) feat(ci): add vector to handle logs pipeline (#5021) feat(users): Decision manager flow changes for SSO (#4995) ci(cypress): Fix payment method id for non supported connectors (#5075) refactor(core): introduce an interface to switch between old and new connector integration implementations on the connectors (#5013) refactor(events): populate object identifiers in outgoing webhooks analytics events during retries (#5067) Refactor: [Fiserv] Remove Default Case Handling (#4767) chore(version): 2024.06.24.0 fix(router): avoid considering pre-routing results during `perform_session_token_routing` (#5076) refactor(redis): spawn one subscriber thread for handling all the published messages to different channel (#5064) feat(users): setup user authentication methods schema and apis (#4999) feat(payment_methods): Implement Process tracker workflow for Payment method Status update (#4668) chore(version): 2024.06.20.1 chore(postman): update Postman collection files fix(payment_methods): support last used for off session token payments (#5039) ci(postman): add net_amount field test cases (#3286) refactor(connector): [Mifinity]dynamic fields for mifinity (#5056) refactor(payment_method): [Klarna] store and populate payment_type for klarna_sdk Paylater in response (#4956)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Analytics
A-webhooks
Area: Webhook flows
C-refactor
Category: Refactor
M-database-changes
Metadata: This PR involves database schema changes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
As of now, the analytics events raised during outgoing webhook retries do not include object identifiers such as the payment ID, refund ID, etc., and in turn, they are not populated in ClickHouse. The object identifiers are only available in the events raised for the initial webhook delivery attempts.
This PR updates the outgoing webhooks code to include the object identifiers in the analytics events for all retries. This is being done by storing the object identifiers in a new column in the
events
table, calledmetadata
.In addition, this PR extracts out common code to implement
FromSql
andToSql
traits on types converted to/fromJSON
/JSONB
into a declarative macro.Additional Changes
This PR adds a
metadata
column to theevents
table.Motivation and Context
Ensuring that all webhook events including retries are correctly associated with the object in question (payment, refund, etc.), and that they are correctly displayed on the control center when viewing events for that resource.
How did you test it?
Configure an incorrect webhook URL in the business profile so that outgoing webhooks are retried.
Perform an action that triggers an outgoing webhook, such as creating a successful payment.
Monitor the events raised for the payment ID in Kafka and ClickHouse:
Kafka: Searching for messages under the
hyperswitch-outgoing-webhook-events
topic with the payment ID has multiple events, including retries:ClickHouse: Searching for rows by payment ID in the
outgoing_webhook_events
table returns multiple rows, all having thepayment_id
populated, and only the initial attempt having thecontent
field populated.The analytics API to obtain outgoing webhook event logs returns all of the events, and each of them contain the payment ID:
The control center should also be ideally displaying all the events in the payment details page, that does not seem to be case however in control center version
v1.30.1
.Verify similar behavior for the other webhooks with their corresponding identifiers: refunds, payouts, etc.
Checklist
cargo +nightly fmt --all
cargo clippy