Skip to content

feat(logs): expose severity_text on the log_attributes HogQL table - #70635

Merged
frankh merged 1 commit into
masterfrom
posthog-code/log-attributes-severity-hogql-field
Jul 14, 2026
Merged

feat(logs): expose severity_text on the log_attributes HogQL table#70635
frankh merged 1 commit into
masterfrom
posthog-code/log-attributes-severity-hogql-field

Conversation

@frankh

@frankh frankh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Problem

The logs facet-filtering work needs severity_text to be queryable on the log_attributes HogQL table. The physical column lives on log_attributes3, which log_attributes_distributed points at after the cutover migration. This PR adds the field to the HogQL schema so it can be selected and faceted.

Changes

  • Add severity_text to LogAttributesTable.fields in posthog/hogql/database/schema/logs.py.

Important

Stacked on #70496 (the migration that repoints log_attributes_distributed at log_attributes3). This PR must merge after that one - until the distributed table is backed by log_attributes3, severity_text does not exist on the underlying table and a query selecting it would error. GitHub will retarget this PR to master automatically once the base merges.

How did you test this code?

Automated only (I'm an agent - no manual query against a live cluster):

  • Verified in a Django shell (on the stacked base) that severity_text resolves on LogAttributesTable and to_printed_clickhouse() still prints log_attributes_distributed.
  • ruff check / ruff format --check clean.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Frank asked me (Claude, via PostHog Code) to split the HogQL severity_text field out of the migration PR into its own PR, so the migration PR stays migration-only per the ClickHouse migration-only-PR convention. I rewrote the migration branch to drop the field and stacked this PR on top of it.


Created with PostHog Code

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Playwright — all passed

All tests passed.

View test results →

ClickHouse migration SQL — none

No ClickHouse migrations in the latest push.

@trunk-io

trunk-io Bot commented Jul 14, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@frankh
frankh force-pushed the posthog-code/switch-log-attributes3-distributed branch from 09d654b to d24f2c6 Compare July 14, 2026 09:19
@frankh
frankh force-pushed the posthog-code/log-attributes-severity-hogql-field branch from f0a924e to 152e6c0 Compare July 14, 2026 09:22
Base automatically changed from posthog-code/switch-log-attributes3-distributed to master July 14, 2026 12:07
Make severity_text queryable on the log_attributes table. The column is
backed by log_attributes3, which log_attributes_distributed points at in
the cloud logs cluster once the cutover migration lands.

Generated-By: PostHog Code
Task-Id: 67487c28-0690-457e-81e7-6069460f2124
@frankh
frankh force-pushed the posthog-code/log-attributes-severity-hogql-field branch from 152e6c0 to 8542ed4 Compare July 14, 2026 12:41
@frankh
frankh marked this pull request as ready for review July 14, 2026 13:38
@frankh frankh added the stamphog Request AI approval (no full review) label Jul 14, 2026
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 14, 2026 13:39
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(logs): expose severity_text on the ..." | Re-trigger Greptile

Comment thread posthog/hogql/database/schema/logs.py
@stamphog

stamphog Bot commented Jul 14, 2026

Copy link
Copy Markdown

Note

🤖 stamphog reviewed 8542ed4ba883a2dae4a32f1880183a39f42a1435 — verdict: ESCALATE

Greptile raised an unresolved, substantive concern: if this merges/deploys before the stacked migration PR that repoints log_attributes_distributed to log_attributes3, selecting severity_text will fail at query time against the still-log_attributes2-backed table. That's a real production-breakage risk tied to merge/deploy ordering, not addressed in the diff or thread.

  • Author wrote 0% of the modified lines and has 13 merged PRs in these paths (familiarity MODERATE).
  • greptile-apps[bot] reviewed the current head.
  • Unresolved Greptile comment on posthog/hogql/database/schema/logs.py flags that severity_text could be exposed on the HogQL schema before the underlying ClickHouse migration lands, causing query failures if merge order/deploy order isn't strictly enforced.
  • Author frankh is not on the owning team (@PostHog/team-data-tools) and has 0% prior-line familiarity, removing the ownership-based assurance path for this stacked, dependency-order-sensitive change.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 5L, 1F substantive — within ceiling
tier T1-agent / T1a-trivial (5L, 1F, single-area, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ 2e092b3 · reviewed head 8542ed4

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Jul 14, 2026
@frankh frankh added the stamphog Request AI approval (no full review) label Jul 14, 2026
@frankh
frankh requested a review from jonmcwest July 14, 2026 13:46

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small schema addition with the raised deploy-ordering concern addressed by the author and resolved, plus a current-head human approval from @jonmcwest.

  • Author wrote 0% of the modified lines and has 13 merged PRs in these paths (familiarity MODERATE).
  • greptile-apps[bot], jonmcwest reviewed the current head.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 5L, 1F substantive — within ceiling
tier T1-agent / T1a-trivial (5L, 1F, single-area, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ c10f860 · reviewed head 8542ed4

@frankh
frankh enabled auto-merge (squash) July 14, 2026 13:51
@frankh
frankh merged commit 1bdfc6c into master Jul 14, 2026
509 of 554 checks passed
@frankh
frankh deleted the posthog-code/log-attributes-severity-hogql-field branch July 14, 2026 14:31
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-14 15:01 UTC Run
prod-us ✅ Deployed 2026-07-14 15:13 UTC Run
prod-eu ✅ Deployed 2026-07-14 15:14 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants