:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(billing): stop pinging a user and show triage details on partner billing alerts (#122703)
Daniel Snitkovskiy78b53d8a1900
diff --git a/terraform/us/project-2/team-billing/partner-billing-alerts/alerts.tf b/terraform/us/project-2/team-billing/partner-billing-alerts/alerts.tfindex fec2112f281b..6ec9958e7198 100644--- a/terraform/us/project-2/team-billing/partner-billing-alerts/alerts.tf+++ b/terraform/us/project-2/team-billing/partner-billing-alerts/alerts.tf@@ -8,7 +8,8 @@## Billing reports these problems with capture_message or capture_exception.# It sets partner_billing_alert and alert_kind on each event, and payer_id,-# organization_id, organization_ids, customer_count, reason or mismatch when+# payer_ids, organization_id, organization_ids, customer_count,+# oldest_link_started_at, with_stripe_customer_count, reason or mismatch when# it knows them.## For more information, see:@@ -16,7 +17,8 @@# =============================================================================locals {- mentions = join(" ", [for id in var.billing_alert_mention_slack_user_ids : "<@${id}>"])+ # Each mention carries its own trailing space, so an empty list leaves no stray space before the text.+ mentions = join("", [for id in var.billing_alert_mention_slack_user_ids : "<@${id}> "])# Anyone holding project 2's public key can send an event that passes the filter below.# Escaping every event value stops such an event from adding links or mentions to the post.@@ -24,7 +26,7 @@ locals {# Slack rejects a section over 3,000 characters, so the exception text is cut short.message = "substring(${format(local.escape, "event.properties.$exception_values[1]")}, 1, 2700)"- details = "substring(${format(local.escape, "f'Kind: {event.properties.alert_kind}{notEmpty(event.properties.reason) ? f' | Reason: {event.properties.reason}' : ''}{notEmpty(event.properties.mismatch) ? f' | Mismatch: {event.properties.mismatch}' : ''}{event.properties.payer_id != null ? f' | Payer: {event.properties.payer_id}' : ''}{notEmpty(event.properties.organization_id) ? f' | Organization: {event.properties.organization_id}' : ''}{event.properties.customer_count != null ? f' | Customers: {event.properties.customer_count}' : ''}{notEmpty(event.properties.organization_ids) ? concat(' | Organizations: ', substring(arrayStringConcat(event.properties.organization_ids, ', '), 1, 2500)) : ''}'")}, 1, 3000)"+ details = "substring(${format(local.escape, "f'Kind: {event.properties.alert_kind}{notEmpty(event.properties.reason) ? f' | Reason: {event.properties.reason}' : ''}{notEmpty(event.properties.mismatch) ? f' | Mismatch: {event.properties.mismatch}' : ''}{event.properties.payer_id != null ? f' | Payer: {event.properties.payer_id}' : ''}{event.properties.payer_id == null and notEmpty(event.properties.payer_ids) ? concat(' | Payers: ', arrayStringConcat(event.properties.payer_ids, ', ')) : ''}{notEmpty(event.properties.organization_id) ? f' | Organization: {event.properties.organization_id}' : ''}{event.properties.customer_count != null ? f' | Customers: {event.properties.customer_count}' : ''}{notEmpty(event.properties.oldest_link_started_at) ? f' | Waiting since: {event.properties.oldest_link_started_at}' : ''}{(event.properties.with_stripe_customer_count ?? 0) > 0 ? f' | With Stripe customer: {event.properties.with_stripe_customer_count}' : ''}{notEmpty(event.properties.organization_ids) ? concat(' | Organizations: ', substring(arrayStringConcat(event.properties.organization_ids, ', '), 1, 2500)) : ''}'")}, 1, 3000)"issue_url = "{project.url}/error_tracking/{encodeURLComponent(toString(event.properties.$exception_issue_id ?? ''))}"}@@ -38,14 +40,14 @@ resource "posthog_hog_function" "partner_billing_alert" {inputs_json = jsonencode({# Slack shows this fallback text in notifications and can't set verbatim on it, so it carries no event values."text" = {- "value" = "${local.mentions} Partner billing alert"+ "value" = "${local.mentions}Partner billing alert""templating" = "hog"}"blocks" = {"value" = [{"text" = {- "text" = "${local.mentions} {${local.message}}"+ "text" = "${local.mentions}{${local.message}}""type" = "mrkdwn""verbatim" = true}diff --git a/terraform/us/project-2/team-billing/partner-billing-alerts/terragrunt.hcl b/terraform/us/project-2/team-billing/partner-billing-alerts/terragrunt.hclindex acd4d5bd9476..9e2c6e2225b0 100644--- a/terraform/us/project-2/team-billing/partner-billing-alerts/terragrunt.hcl+++ b/terraform/us/project-2/team-billing/partner-billing-alerts/terragrunt.hcl@@ -25,5 +25,7 @@ generate "variables_team" {contents = file("${get_terragrunt_dir()}/../variables_team.tf.tpl")}-# Merge team-level inputs-inputs = local.team_config.inputs+# Merge team-level inputs. Partner billing alerts post to the channel without mentioning anyone.+inputs = merge(local.team_config.inputs, {+ billing_alert_mention_slack_user_ids = []+})