Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
docs(analytics): add Prism connector_events scripts and sync connector_events columns (#13699)
gopikrishna0003922e68ce345
diff --git a/crates/analytics/docs/clickhouse/scripts/connector_events.sql b/crates/analytics/docs/clickhouse/scripts/connector_events.sqlindex 4f62a2c879..c165df2dff 100644--- a/crates/analytics/docs/clickhouse/scripts/connector_events.sql+++ b/crates/analytics/docs/clickhouse/scripts/connector_events.sql@@ -14,7 +14,9 @@ CREATE TABLE connector_events_queue`method` LowCardinality(String),`dispute_id` Nullable(String),`refund_id` Nullable(String),- `payout_id` Nullable(String)+ `payout_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)))ENGINE = KafkaSETTINGS kafka_broker_list = 'kafka0:29092', kafka_topic_list = 'hyperswitch-outgoing-connector-events', kafka_group_name = 'hyper', kafka_format = 'JSONEachRow', kafka_handle_error_mode = 'stream';@@ -57,6 +59,8 @@ CREATE TABLE connector_events (`dispute_id` Nullable(String),`refund_id` Nullable(String),`payout_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1@@ -87,6 +91,8 @@ CREATE TABLE connector_events_audit (`method` LowCardinality(String),`dispute_id` Nullable(String),`refund_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1@@ -109,6 +115,8 @@ CREATE TABLE connector_events_payout_audit (`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),`latency` UInt128,`method` LowCardinality(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1@@ -132,7 +140,9 @@ CREATE MATERIALIZED VIEW connector_events_audit_mv TO connector_events_audit (`latency` UInt128,`method` LowCardinality(String),`refund_id` Nullable(String),- `dispute_id` Nullable(String)+ `dispute_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String))) ASSELECTmerchant_id,@@ -150,7 +160,9 @@ SELECTlatency,method,refund_id,- dispute_id+ dispute_id,+ destination,+ execution_modeFROMconnector_events_queueWHERE@@ -171,7 +183,9 @@ CREATE MATERIALIZED VIEW connector_events_payout_audit_mv TO connector_events_pa`created_at` DateTime64(3),`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),`latency` UInt128,- `method` LowCardinality(String)+ `method` LowCardinality(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String))) ASSELECTmerchant_id,@@ -187,7 +201,9 @@ SELECTcreated_at,now64() AS inserted_at,latency,- method+ method,+ destination,+ execution_modeFROMconnector_events_queueWHERE@@ -211,7 +227,9 @@ CREATE MATERIALIZED VIEW connector_events_mv TO connector_events (`method` LowCardinality(String),`refund_id` Nullable(String),`dispute_id` Nullable(String),- `payout_id` Nullable(String)+ `payout_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String))) ASSELECTmerchant_id,@@ -230,7 +248,9 @@ SELECTmethod,refund_id,dispute_id,- payout_id+ payout_id,+ destination,+ execution_modeFROMconnector_events_queueWHEREdiff --git a/crates/analytics/docs/clickhouse/scripts/prism_connector_events.sql b/crates/analytics/docs/clickhouse/scripts/prism_connector_events.sqlnew file mode 100644index 0000000000..321c2376f2--- /dev/null+++ b/crates/analytics/docs/clickhouse/scripts/prism_connector_events.sql@@ -0,0 +1,204 @@+-- Prism (Unified Connector Service) connector events.+--+-- Normalized, payment/payout-scoped connector events read by the analytics API+-- (ConnectorEventSource::Prism -> prism_connector_events_audit /+-- prism_connector_events_payout_audit).+--+-- Adjust kafka_broker_list / kafka_topic_list / kafka_group_name to match your+-- deployment before running these scripts.++CREATE TABLE prism_connector_events_queue+(+ `tenant_id` String,+ `merchant_id` String,+ `payment_id` Nullable(String),+ `connector_name` LowCardinality(String),+ `request_id` String,+ `url` Nullable(String),+ `flow` LowCardinality(String),+ `request` String,+ `masked_response` Nullable(String),+ `error` Nullable(String),+ `status_code` UInt32,+ `created_at` DateTime64(3),+ `latency` UInt128,+ `method` LowCardinality(String),+ `refund_id` Nullable(String),+ `dispute_id` Nullable(String),+ `payout_id` Nullable(String),+ `service_name` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),+ `destination` LowCardinality(Nullable(String))+)+ENGINE = Kafka+SETTINGS kafka_broker_list = 'kafka0:29092', kafka_topic_list = 'prism-outgoing-connector-events', kafka_group_name = 'hyper', kafka_format = 'JSONEachRow', kafka_handle_error_mode = 'stream';++CREATE MATERIALIZED VIEW prism_connector_events_parse_errors (+ `topic` String,+ `partition` Int64,+ `offset` Int64,+ `raw` String,+ `error` String+) ENGINE = MergeTree+ORDER BY+ (topic, partition, offset) SETTINGS index_granularity = 8192 AS+SELECT+ _topic AS topic,+ _partition AS partition,+ _offset AS offset,+ _raw_message AS raw,+ _error AS error+FROM+ prism_connector_events_queue+WHERE+ length(_error) > 0;++CREATE TABLE prism_connector_events_audit (+ `merchant_id` String,+ `payment_id` String,+ `connector_name` LowCardinality(String),+ `request_id` String,+ `url` Nullable(String),+ `flow` LowCardinality(String),+ `request` String,+ `response` Nullable(String),+ `masked_response` Nullable(String),+ `error` Nullable(String),+ `status_code` UInt32,+ `created_at` DateTime64(3),+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),+ `latency` UInt128,+ `method` LowCardinality(String),+ `refund_id` Nullable(String),+ `dispute_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),+ INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,+ INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,+ INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1+) ENGINE = MergeTree PARTITION BY merchant_id+ORDER BY+ (merchant_id, payment_id) SETTINGS index_granularity = 8192;++CREATE TABLE prism_connector_events_payout_audit (+ `merchant_id` String,+ `payout_id` String,+ `connector_name` LowCardinality(String),+ `request_id` String,+ `url` Nullable(String),+ `flow` LowCardinality(String),+ `request` String,+ `response` Nullable(String),+ `masked_response` Nullable(String),+ `error` Nullable(String),+ `status_code` UInt32,+ `created_at` DateTime64(3),+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),+ `latency` UInt128,+ `method` LowCardinality(String),+ `refund_id` Nullable(String),+ `dispute_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String)),+ INDEX flowIndex flow TYPE bloom_filter GRANULARITY 1,+ INDEX connectorIndex connector_name TYPE bloom_filter GRANULARITY 1,+ INDEX statusIndex status_code TYPE bloom_filter GRANULARITY 1+) ENGINE = MergeTree PARTITION BY merchant_id+ORDER BY+ (merchant_id, payout_id) SETTINGS index_granularity = 8192;++CREATE MATERIALIZED VIEW prism_connector_events_audit_mv TO prism_connector_events_audit (+ `merchant_id` String,+ `payment_id` Nullable(String),+ `connector_name` LowCardinality(String),+ `request_id` String,+ `url` Nullable(String),+ `flow` LowCardinality(String),+ `request` String,+ `response` Nullable(String),+ `masked_response` Nullable(String),+ `error` Nullable(String),+ `status_code` UInt32,+ `created_at` DateTime64(3),+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),+ `latency` UInt128,+ `method` LowCardinality(String),+ `refund_id` Nullable(String),+ `dispute_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String))+) AS+SELECT+ merchant_id,+ assumeNotNull(payment_id) AS payment_id,+ connector_name,+ request_id,+ url,+ flow,+ request,+ masked_response AS response,+ masked_response,+ error,+ status_code,+ created_at,+ now64() AS inserted_at,+ latency,+ method,+ refund_id,+ dispute_id,+ destination,+ execution_mode+FROM+ prism_connector_events_queue+WHERE+ (length(_error) = 0)+ AND (tenant_id = 'public')+ AND notEmpty(ifNull(payment_id, ''));++CREATE MATERIALIZED VIEW prism_connector_events_payout_audit_mv TO prism_connector_events_payout_audit (+ `merchant_id` String,+ `payout_id` Nullable(String),+ `connector_name` LowCardinality(String),+ `request_id` String,+ `url` Nullable(String),+ `flow` LowCardinality(String),+ `request` String,+ `response` Nullable(String),+ `masked_response` Nullable(String),+ `error` Nullable(String),+ `status_code` UInt32,+ `created_at` DateTime64(3),+ `inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),+ `latency` UInt128,+ `method` LowCardinality(String),+ `refund_id` Nullable(String),+ `dispute_id` Nullable(String),+ `destination` LowCardinality(Nullable(String)),+ `execution_mode` LowCardinality(Nullable(String))+) AS+SELECT+ merchant_id,+ assumeNotNull(payout_id) AS payout_id,+ connector_name,+ request_id,+ url,+ flow,+ request,+ masked_response AS response,+ masked_response,+ error,+ status_code,+ created_at,+ now64() AS inserted_at,+ latency,+ method,+ refund_id,+ dispute_id,+ destination,+ execution_mode+FROM+ prism_connector_events_queue+WHERE+ (length(_error) = 0)+ AND (tenant_id = 'public')+ AND notEmpty(ifNull(payout_id, ''));