Skip to content

: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.

chore(billing): sentence-case usage type labels (#56192)

Pawel Cebula9aaf41fcf06c
diff --git a/ee/hogai/tools/read_billing_tool/test/test_nodes.py b/ee/hogai/tools/read_billing_tool/test/test_nodes.py
index bd523b6d8675..f478d1e90584 100644
--- a/ee/hogai/tools/read_billing_tool/test/test_nodes.py
+++ b/ee/hogai/tools/read_billing_tool/test/test_nodes.py
@@ -118,7 +118,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
spend_history = [
SpendHistoryItem(
id=1,
- label="Mobile Recordings",
+ label="Mobile recordings",
dates=["2023-01-01", "2023-01-02"],
data=[10.50, 20.00],
breakdown_type=None,
@@ -132,7 +132,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
self.assertIn("| Events | 1.50 | 2.50 |", usage_table)
spend_table = self.tool._format_history_table(spend_history)
- self.assertIn("| Mobile Recordings | 10.50 | 20.00 |", spend_table)
+ self.assertIn("| Mobile recordings | 10.50 | 20.00 |", spend_table)
def test_get_top_events_by_usage(self):
mock_results = [("pageview", 1000), ("$autocapture", 500)]
@@ -196,7 +196,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
docs_url="https://posthog.com/docs/product-analytics",
addons=[
MaxAddonInfo(
- name="Group Analytics",
+ name="Group analytics",
type="addon",
description="Analyze by groups",
current_usage=1000.0,
@@ -208,7 +208,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
docs_url="https://posthog.com/docs/group-analytics",
),
MaxAddonInfo(
- name="Data Pipelines",
+ name="Data pipelines",
type="addon",
description="Export data to destinations",
current_usage=2000.0,
@@ -266,9 +266,9 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
# Check addons are nested within products
self.assertIn("#### Add-ons for Product Analytics", formatted_string)
- self.assertIn("##### Group Analytics", formatted_string)
+ self.assertIn("##### Group analytics", formatted_string)
self.assertIn("Current usage: 1000 of 5000 limit", formatted_string)
- self.assertIn("##### Data Pipelines", formatted_string)
+ self.assertIn("##### Data pipelines", formatted_string)
# Check Session Replay exists but has no addons section
self.assertIn("### Session Replay", formatted_string)
@@ -352,7 +352,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
# Check data is properly grouped
self.assertIn("| Events | 1,000.00 | 2,000.00 |", table)
self.assertIn("| Recordings | 100.00 | 200.00 |", table)
- self.assertIn("| Feature Flag Requests | 50.00 | 100.00 |", table)
+ self.assertIn("| Feature flag requests | 50.00 | 100.00 |", table)
async def test_format_billing_context_edge_cases(self):
"""Test edge cases and potential security issues"""
@@ -518,7 +518,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
usage_history = [
UsageHistoryItem(
id=1,
- label="84444::Data Pipelines",
+ label="84444::Data pipelines",
dates=["2025-02-01", "2025-02-02", "2025-02-03"],
data=[8036.0, 10286.0, 8174.0],
breakdown_type=BillingUsageResponseBreakdownType.MULTIPLE,
@@ -568,16 +568,16 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
# Events: 50000+25000=75000, 75000+30000=105000, 60000+28000=88000
self.assertIn("| Events | 75,000.00 | 105,000.00 | 88,000.00 |", table)
- # Feature Flag Requests should appear in aggregated (only non-team data)
- self.assertIn("| Feature Flag Requests | 1,000.00 | 1,500.00 | 1,200.00 |", table)
+ # Feature flag requests should appear in aggregated (only non-team data)
+ self.assertIn("| Feature flag requests | 1,000.00 | 1,500.00 | 1,200.00 |", table)
- # Data Pipelines should show aggregated total (only from team 84444)
- self.assertIn("| Data Pipelines (deprecated) | 8,036.00 | 10,286.00 | 8,174.00 |", table)
+ # Data pipelines should show aggregated total (only from team 84444)
+ self.assertIn("| Data pipelines (deprecated) | 8,036.00 | 10,286.00 | 8,174.00 |", table)
# Check that team-specific tables show clean labels
- # Team 84444 should show "Data Pipelines (deprecated)" and "Events", not raw labels
+ # Team 84444 should show "Data pipelines (deprecated)" and "Events", not raw labels
team_84444_section = table.split("### Project 84444")[1].split("### Project 12345")[0]
- self.assertIn("| Data Pipelines (deprecated) |", team_84444_section)
+ self.assertIn("| Data pipelines (deprecated) |", team_84444_section)
self.assertIn("| Events |", team_84444_section)
self.assertNotIn("| 84444::", team_84444_section) # Should not show raw labels
@@ -611,7 +611,7 @@ class TestBillingNode(ClickhouseTestMixin, NonAtomicBaseTest):
self.assertIn("| Recordings | 50.00 | 75.00 |", table)
# Should handle unknown types gracefully (formatted from label)
- self.assertIn("| Custom Product 12345 | 100.00 | 200.00 |", table)
+ self.assertIn("| Custom product 12345 | 100.00 | 200.00 |", table)
def test_create_aggregated_items_functionality(self):
"""Test the aggregation logic specifically"""
diff --git a/ee/hogai/tools/read_billing_tool/tool.py b/ee/hogai/tools/read_billing_tool/tool.py
index f52944013935..4ea73ae9470d 100644
--- a/ee/hogai/tools/read_billing_tool/tool.py
+++ b/ee/hogai/tools/read_billing_tool/tool.py
@@ -19,23 +19,23 @@ from .prompts import BILLING_CONTEXT_PROMPT, BILLING_CONTEXT_UNAVAILABLE_PROMPT
# sync with frontend/src/scenes/billing/constants.ts
USAGE_TYPES = [
{"label": "Events", "value": "event_count_in_period"},
- {"label": "Identified Events", "value": "enhanced_persons_event_count_in_period"},
- {"label": "Group Analytics", "value": "group_analytics"},
+ {"label": "Identified events", "value": "enhanced_persons_event_count_in_period"},
+ {"label": "Group analytics", "value": "group_analytics"},
{"label": "Recordings", "value": "recording_count_in_period"},
- {"label": "Mobile Recordings", "value": "mobile_recording_count_in_period"},
- {"label": "Feature Flag Requests", "value": "billable_feature_flag_requests_count_in_period"},
+ {"label": "Mobile recordings", "value": "mobile_recording_count_in_period"},
+ {"label": "Feature flag requests", "value": "billable_feature_flag_requests_count_in_period"},
{"label": "Exceptions", "value": "exceptions_captured_in_period"},
- {"label": "Survey Responses", "value": "survey_responses_count_in_period"},
- {"label": "LLM Events", "value": "ai_event_count_in_period"},
- {"label": "Synced Rows", "value": "rows_synced_in_period"},
- {"label": "Free Synced Rows", "value": "free_historical_rows_synced_in_period"},
- {"label": "Data Pipelines (deprecated)", "value": "data_pipelines"},
- {"label": "Destinations Trigger Events", "value": "cdp_billable_invocations_in_period"},
- {"label": "Rows Exported", "value": "rows_exported_in_period"},
+ {"label": "Survey responses", "value": "survey_responses_count_in_period"},
+ {"label": "AI events", "value": "ai_event_count_in_period"},
+ {"label": "Synced rows", "value": "rows_synced_in_period"},
+ {"label": "Free synced rows", "value": "free_historical_rows_synced_in_period"},
+ {"label": "Data pipelines (deprecated)", "value": "data_pipelines"},
+ {"label": "Destinations trigger events", "value": "cdp_billable_invocations_in_period"},
+ {"label": "Rows exported", "value": "rows_exported_in_period"},
{"label": "PostHog AI", "value": "ai_credits_used_in_period"},
- {"label": "Workflow Emails", "value": "workflow_emails_sent_in_period"},
- {"label": "Workflow Destinations", "value": "workflow_billable_invocations_in_period"},
- {"label": "Logs Ingested (MB)", "value": "logs_mb_in_period"},
+ {"label": "Workflow emails", "value": "workflow_emails_sent_in_period"},
+ {"label": "Workflow destinations", "value": "workflow_billable_invocations_in_period"},
+ {"label": "Logs ingested (MB)", "value": "logs_mb_in_period"},
]
@@ -323,7 +323,7 @@ class ReadBillingTool(MaxSubtool):
return usage_type["label"]
# Fall back to formatting the product_type
- return product_type.replace("_", " ").title()
+ return product_type.replace("_", " ").capitalize()
def _format_single_team_table(self, items: list[UsageHistoryItem] | list[SpendHistoryItem], title: str) -> str:
"""Format a single table for a team or overall data."""
diff --git a/frontend/src/scenes/billing/constants.ts b/frontend/src/scenes/billing/constants.ts
index 71d210bc52dc..6141399a0a36 100644
--- a/frontend/src/scenes/billing/constants.ts
+++ b/frontend/src/scenes/billing/constants.ts
@@ -1,23 +1,23 @@
// sync with ee/hogai/tools/read_billing_tool/tool.py
export const USAGE_TYPES = [
{ label: 'Events', value: 'event_count_in_period' },
- { label: 'Identified Events', value: 'enhanced_persons_event_count_in_period' },
- { label: 'Group Analytics', value: 'group_analytics' },
+ { label: 'Identified events', value: 'enhanced_persons_event_count_in_period' },
+ { label: 'Group analytics', value: 'group_analytics' },
{ label: 'Recordings', value: 'recording_count_in_period' },
- { label: 'Mobile Recordings', value: 'mobile_recording_count_in_period' },
- { label: 'Feature Flag Requests', value: 'billable_feature_flag_requests_count_in_period' },
+ { label: 'Mobile recordings', value: 'mobile_recording_count_in_period' },
+ { label: 'Feature flag requests', value: 'billable_feature_flag_requests_count_in_period' },
{ label: 'Exceptions', value: 'exceptions_captured_in_period' },
- { label: 'Survey Responses', value: 'survey_responses_count_in_period' },
- { label: 'LLM Events', value: 'ai_event_count_in_period' },
- { label: 'Synced Rows', value: 'rows_synced_in_period' },
- { label: 'Free Synced Rows', value: 'free_historical_rows_synced_in_period' },
- { label: 'Data Pipelines (deprecated)', value: 'data_pipelines' },
- { label: 'Destinations Trigger Events', value: 'cdp_billable_invocations_in_period' },
- { label: 'Rows Exported', value: 'rows_exported_in_period' },
+ { label: 'Survey responses', value: 'survey_responses_count_in_period' },
+ { label: 'AI events', value: 'ai_event_count_in_period' },
+ { label: 'Synced rows', value: 'rows_synced_in_period' },
+ { label: 'Free synced rows', value: 'free_historical_rows_synced_in_period' },
+ { label: 'Data pipelines (deprecated)', value: 'data_pipelines' },
+ { label: 'Destinations trigger events', value: 'cdp_billable_invocations_in_period' },
+ { label: 'Rows exported', value: 'rows_exported_in_period' },
{ label: 'PostHog AI', value: 'ai_credits_used_in_period' },
- { label: 'Workflow Emails', value: 'workflow_emails_sent_in_period' },
- { label: 'Workflow Destinations', value: 'workflow_billable_invocations_in_period' },
- { label: 'Logs Ingested (MB)', value: 'logs_mb_in_period' },
+ { label: 'Workflow emails', value: 'workflow_emails_sent_in_period' },
+ { label: 'Workflow destinations', value: 'workflow_billable_invocations_in_period' },
+ { label: 'Logs ingested (MB)', value: 'logs_mb_in_period' },
] as const
export type UsageTypeOption = (typeof USAGE_TYPES)[number]