feat(observability): add typed connector request/response fields - #2036
Open
AmitsinghTanwar007 wants to merge 5 commits into
Open
feat(observability): add typed connector request/response fields#2036AmitsinghTanwar007 wants to merge 5 commits into
AmitsinghTanwar007 wants to merge 5 commits into
Conversation
…ss all flows Add `typed_connector_request` and `typed_connector_response` fields alongside existing `raw_connector_*` fields to enable structured, connector-agnostic observability data separate from the raw wire-format payloads. - raw fields: literal HTTP request/response bytes (what went over the wire) - typed fields: masked serialization of the domain-typed Rust structs Changes span proto definitions, domain types, flow data structs, gRPC response generators, connector macros, and the connector integration trait.
Auto-applied by CI: - cargo +nightly fmt --all - make -C sdk generate (if applicable) - make docs (if applicable) This commit was automatically generated by GitHub Actions.
Add typed_connector_response: None and typed_connector_request: None to all PaymentFlowData initializations in razorpay and adyen test files.
Add tracing::warn! logs when a connector does not provide typed_connector_request or typed_connector_response. This surfaces non-macro connectors (razorpay, razorpayv2, itaubank) and hybrid connector flows (cybersource, paypal, redsys, worldpayvantiv manual impls) that haven't implemented typed observability yet. Warnings fire at runtime so they show up in logs/dashboards, making it easy to track which connectors still need typed support without breaking existing flows.
Auto-applied by CI: - cargo +nightly fmt --all - make -C sdk generate (if applicable) - make docs (if applicable) This commit was automatically generated by GitHub Actions.
| } | ||
| } | ||
|
|
||
| pub fn generate_mandate_revoke_response( |
Contributor
There was a problem hiding this comment.
why was these functions added in this file instead of type.rs
not related to this pr though, but how did we missed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
typed_connector_requestandtyped_connector_responsefields across the entire connector service stack to provide structured, domain-typed observability data separate from raw wire-format payloads.Problem
Currently, only
raw_connector_request/raw_connector_responseexist — these carry the literal HTTP bytes sent/received. For debugging and analytics, we also need the typed representation (the Rust domain struct, masked and serialized) so consumers can reason about connector data in a connector-agnostic way without parsing raw JSON/XML from different providers.What changed
Proto definitions (
payment.proto,frm.proto):typed_connector_requestandtyped_connector_responseoptional fields to all response messages (Authorize, Get, Void, Capture, Refund, CreateOrder, SetupRecurring, MandateRevoke, FRM pre/post risk check, etc.)Domain types (
connector_types.rs,frm_types.rs,surcharge_types.rs,payouts_types.rs,merchant_authentication_flow_data.rs):typed_connector_request/typed_connector_responsefields to all flow data structs (PaymentFlowData,RefundFlowData,DisputeFlowData,FrmFlowData,SurchargeFlowData,VerifyWebhookSourceFlowData,RefreshPaymentMethodFlowData,PayoutFlowData)RawConnectorRequestResponsetrait withget/set_typed_connector_requestandget/set_typed_connector_responsemethodsConnector integration trait (
connector_integration_v2.rs):get_typed_connector_request()default method returningNonebuild_request_v2()viaset_typed_connector_request()on the request builderRequest infrastructure (
request.rs):typed_connector_requestfield toRequestandRequestBuilderset_typed_connector_request()builder methodConnector macros (
macros.rs):serialize_typed_connector_payload()utility — masked serialization of typed structsexpand_fn_get_typed_connector_request!macro — generatesget_typed_connector_request()for each flowexpand_fn_handle_response!to capture and settyped_connector_responseon the flow datamacro_connector_implementation!variantsConnector-specific (
bamboraapac/transformers.rs):Serializederive to request structs that were missing it (required for typed serialization)Service layer (
service.rs):typed_connector_requeston flow data from the request object after connector callgRPC response generators (
types.rs,frm/types.rs,payments.rs):generate_*_response()functions now extract and pass typed fields to proto responsesServer layer (
events.rs):typed_connector_request/response: NonetoVerifyWebhookSourceFlowDataconstructionKey design principle: raw ≠ typed
Test plan
cargo checkpasses across all cratesNoneby default for connectors not using the macro system🤖 Generated with Claude Code