feat(billing): highlight matched conditional multipliers in logs (#6561)

* feat(billing): highlight matched conditional multipliers in usage logs

* fix(billing): make request rule tracing stable and type-safe
This commit is contained in:
Seefs
2026-08-10 12:50:27 +08:00
committed by GitHub
parent d49160f0e5
commit 4cf9107f04
12 changed files with 400 additions and 110 deletions
+8 -1
View File
@@ -265,12 +265,19 @@ func TestBuildTestLogOtherInjectsTieredInfo(t *testing.T) {
},
}
requestRules := []billingexpr.RequestRuleTrace{{
Cond: `param("service_tier") == "fast"`,
Multiplier: 2,
Matched: true,
}}
other := buildTestLogOther(ctx, info, priceData, usage, &billingexpr.TieredResult{
MatchedTier: "base",
MatchedTier: "base",
RequestRules: requestRules,
})
require.Equal(t, "tiered_expr", other["billing_mode"])
require.Equal(t, "base", other["matched_tier"])
require.Equal(t, requestRules, other["request_rules"])
require.NotEmpty(t, other["expr_b64"])
}