feat(analytics): expose intent flow fields, error reason and /info definitions
Author: kanikabansal08Created Sep 30, 2026Updated Sep 30, 2026
Context
Parent: juspay/hyperswitch-control-center-cloud#597 (self-serve analytics on the existing ClickHouse analytics). PR: #14496
Problem
- Intent metrics cannot be split by customer vs merchant-initiated payments.
off_sessionandsetup_future_usageare sent in the Kafka intent event and stored in ClickHousepayment_intents, but the analytics API does not expose them as dimensions or filters. PaymentDimensions::ErrorReasonworks on the rawpayment_attemptstable but is missing from the payments/infolist, so clients cannot discover it./inforeturnsdesc: ""for every metric and dimension.sanitize_sql_string_literalremoves every space fromIN (…)filter values, so values such as "do not honor", "Customer request" or issuer names never match. Escaping of'and\already prevents injection; the space removal only changes the value.
Changes
off_sessionandsetup_future_usageadded toPaymentIntentDimensionsandPaymentIntentFilters, the result row and bucket identifier, and every intent metric; SQL and Postgres support forFutureUsage; listed in intent/info.ErrorReasonlisted in payments/info.- One-line
descfor every payment and payment intent metric and dimension. Intent dimensions that exist only on the sessionizer table say "Sessionized metrics only". - Spaces kept in filter values; escaping unchanged.
No Kafka, ClickHouse schema, migration or payment-flow change. All changes are additive.
Acceptance criteria
- Intent metrics group and filter by
off_session/setup_future_usage(e.g.filters: {"off_session": [true]}). - Payments
/infolistserror_reason; every metric and dimension in both/inforesponses has a non-emptydesc. - A filter value with spaces matches the stored value; a value containing
'or\stays inside the literal. - Existing requests return the same results as before.
Source: juspay/hyperswitch