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.

fix(logs): verify hobby log ingestion (#82259)

Paul D'Ambra02c2d51c2fe1
diff --git a/.github/workflows/ci-hobby.yml b/.github/workflows/ci-hobby.yml
index 0efccb93f5fb..fd4351236f50 100644
--- a/.github/workflows/ci-hobby.yml
+++ b/.github/workflows/ci-hobby.yml
@@ -330,7 +330,7 @@ jobs:
RUN_ATTEMPT: ${{ github.run_attempt }}
- name: Smoke test event ingestion
if: env.TEST_EXIT_CODE == '0' && env.PREVIEW_MODE == 'false'
- timeout-minutes: 5
+ timeout-minutes: 10
run: uv run bin/hobby-ci.py smoke-test-ingestion
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITAL_OCEAN_HOBBY_TOKEN }}
diff --git a/bin/hobby-ci-setup-user.py b/bin/hobby-ci-setup-user.py
index 54e8d281f416..065375c063a0 100644
--- a/bin/hobby-ci-setup-user.py
+++ b/bin/hobby-ci-setup-user.py
@@ -36,6 +36,6 @@ PersonalAPIKey.objects.create(
label="ci-smoke-test",
secure_value=hash_key_value(raw_key),
mask_value=mask_key_value(raw_key),
- scopes=["query:read"],
+ scopes=["query:read", "logs:read"],
)
print(f"{team.api_token}|||{raw_key}") # noqa: T201
diff --git a/bin/hobby-ci.py b/bin/hobby-ci.py
index c9afca08f008..0aa05feb47f5 100644
--- a/bin/hobby-ci.py
+++ b/bin/hobby-ci.py
@@ -480,6 +480,7 @@ runcmd:
headers = {"Authorization": f"Bearer {personal_api_key}"}
deadline = time.time() + timeout_seconds
attempt = 0
+ event_found = False
while time.time() < deadline:
attempt += 1
try:
@@ -493,7 +494,8 @@ runcmd:
results = events_resp.json().get("results", [])
if len(results) > 0:
print(f"✅ Event found after {attempt} poll(s)", flush=True)
- return True, "Event ingested successfully"
+ event_found = True
+ break
print(f" Poll {attempt}: no events yet", flush=True)
else:
print(f" Poll {attempt}: HTTP {events_resp.status_code}", flush=True)
@@ -501,7 +503,74 @@ runcmd:
print(f" Poll {attempt}: {type(e).__name__}", flush=True)
time.sleep(poll_interval)
- return False, f"Event did not appear within {timeout_seconds}s ({attempt} polls)"
+ if not event_found:
+ return False, f"Event did not appear within {timeout_seconds}s ({attempt} polls)"
+
+ log_body = f"hobby_ci_log_smoke_test_{time.time_ns()}"
+ log_date_from = datetime.datetime.now(datetime.UTC).isoformat()
+ print("📤 Sending test log...", flush=True)
+ try:
+ capture_resp = requests.post(
+ f"{base_url}/i/v1/logs", # nosemgrep: python.lang.security.audit.insecure-transport.requests.request-with-http.request-with-http
+ params={"token": project_api_token},
+ json={
+ "resourceLogs": [
+ {
+ "resource": {"attributes": [{"key": "service.name", "value": {"stringValue": "hobby-ci"}}]},
+ "scopeLogs": [
+ {
+ "scope": {"name": "hobby-ci"},
+ "logRecords": [
+ {
+ "timeUnixNano": str(time.time_ns()),
+ "severityText": "INFO",
+ "severityNumber": 9,
+ "body": {"stringValue": log_body},
+ }
+ ],
+ }
+ ],
+ }
+ ]
+ },
+ timeout=30,
+ )
+ except requests.RequestException as e:
+ return False, f"Log capture request failed: {e}"
+ if capture_resp.status_code != 200:
+ return False, f"Log capture failed: HTTP {capture_resp.status_code} - {capture_resp.text[:200]}"
+
+ print(f"⏳ Polling for log (timeout {timeout_seconds}s)...", flush=True)
+ deadline = time.time() + timeout_seconds
+ attempt = 0
+ while time.time() < deadline:
+ attempt += 1
+ try:
+ logs_resp = requests.post(
+ f"{base_url}/api/projects/@current/logs/query", # nosemgrep: python.lang.security.audit.insecure-transport.requests.request-with-http.request-with-http
+ json={
+ "query": {
+ "dateRange": {"date_from": log_date_from},
+ "searchTerm": log_body,
+ "limit": 1,
+ }
+ },
+ headers=headers,
+ timeout=10,
+ )
+ if logs_resp.status_code == 200:
+ results = logs_resp.json().get("results", [])
+ if results:
+ print(f"✅ Log found after {attempt} poll(s)", flush=True)
+ return True, "Event and log ingested successfully"
+ print(f" Poll {attempt}: no logs yet", flush=True)
+ else:
+ print(f" Poll {attempt}: HTTP {logs_resp.status_code}", flush=True)
+ except Exception as e:
+ print(f" Poll {attempt}: {type(e).__name__}", flush=True)
+ time.sleep(poll_interval)
+
+ return False, f"Log did not appear within {timeout_seconds}s ({attempt} polls)"
@staticmethod
def find_existing_droplet_for_pr(token, pr_number):
diff --git a/docker-compose.hobby.yml b/docker-compose.hobby.yml
index d9f79dcffc7a..c0616e868e53 100644
--- a/docker-compose.hobby.yml
+++ b/docker-compose.hobby.yml
@@ -207,6 +207,8 @@ services:
OBJECT_STORAGE_ENABLED: true
CDP_REDIS_HOST: redis7
CDP_REDIS_PORT: 6379
+ LOGS_REDIS_TLS: 'false'
+ TRACES_REDIS_TLS: 'false'
# Every CDP process dual-writes to Valkey and refuses to start without a host.
CDP_VALKEY_HOST: valkey
CDP_VALKEY_PORT: 6379
@@ -303,6 +305,8 @@ services:
service: ingestion-logs
image: ${REGISTRY_URL}-node:${POSTHOG_NODE_TAG:-latest}
logging: *default-logging
+ environment:
+ LOGS_REDIS_TLS: 'false'
depends_on:
- db
- redis7
@@ -314,6 +318,8 @@ services:
service: ingestion-traces
image: ${REGISTRY_URL}-node:${POSTHOG_NODE_TAG:-latest}
logging: *default-logging
+ environment:
+ TRACES_REDIS_TLS: 'false'
depends_on:
- db
- redis7
@@ -499,6 +505,14 @@ services:
service: capture
logging: *default-logging
+ capture-logs:
+ build:
+ context: ./posthog/rust
+ extends:
+ file: docker-compose.base.yml
+ service: capture-logs
+ logging: *default-logging
+
replay-capture:
build:
context: ./posthog/rust
@@ -709,6 +723,9 @@ services:
db:
condition: service_healthy
+networks:
+ otel_network:
+
volumes:
zookeeper-data:
zookeeper-datalog:
diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scss
index 94a9074323d5..0ef684d66980 100644
--- a/frontend/src/styles/base.scss
+++ b/frontend/src/styles/base.scss
@@ -1388,6 +1388,7 @@
margin-bottom: 0.5rem !important;
font-family: var(--font-sans);
font-size: 1rem;
+ pointer-events: auto;
cursor: unset;
border: 1px solid var(--secondary-3000-button-border);
border-radius: var(--radius);
@@ -1397,6 +1398,7 @@
.Toastify__toast-container {
padding: 0;
+ pointer-events: none;
}
.Toastify__toast-body {
diff --git a/playwright/e2e/signup.spec.ts b/playwright/e2e/signup.spec.ts
index 2a6491d04186..066bfb837c82 100644
--- a/playwright/e2e/signup.spec.ts
+++ b/playwright/e2e/signup.spec.ts
@@ -1,3 +1,4 @@
+import { randomString } from '@playwright-utils'
import type { APIRequestContext, Page } from '@playwright/test'
import { expect, test } from '../utils/workspace-test-base'
@@ -67,7 +68,7 @@ test.describe('Signup', () => {
await route.continue()
})
- const email = `new_user-${Math.floor(Math.random() * 10000)}@posthog.com`
+ const email = `${randomString('new_user')}@posthog.com`
await startSignupFlow(page, email, VALID_PASSWORD)
await page.locator('[data-attr=signup-name]').fill('Alice Bob')
await expect(page.locator('[data-attr=signup-name]')).toHaveValue('Alice Bob')
@@ -88,7 +89,7 @@ test.describe('Signup', () => {
test('Can submit the signup form multiple times if there is a generic email set', async ({ page }) => {
let signupRequestBody: string | null = null
- const email = `new_user-generic_error_test_${Math.floor(Math.random() * 10000)}@posthog.com`
+ const email = `${randomString('new_user-generic_error_test')}@posthog.com`
await page.route('/api/signup/', async (route) => {
signupRequestBody = route.request().postData()
@@ -122,7 +123,7 @@ test.describe('Signup', () => {
await submitEmailAndExpectExistingAccount(page, email)
// Update email to generic email and retry
- const newEmail = `new_user-${Math.floor(Math.random() * 10000)}@posthog.com`
+ const newEmail = `${randomString('new_user')}@posthog.com`
await startSignupFlow(page, newEmail, VALID_PASSWORD)
await page.locator('[data-attr=signup-name]').fill('Alice Bob')
await expect(page.locator('[data-attr=signup-name]')).toHaveValue('Alice Bob')
@@ -196,7 +197,7 @@ test.describe('Signup', () => {
// Start signup with next parameter
await page.goto('/signup?next=/custom_path')
- const email = `new_user-${Math.floor(Math.random() * 10000)}@posthog.com`
+ const email = `${randomString('new_user')}@posthog.com`
await startSignupFlow(page, email, VALID_PASSWORD)
await page.locator('[data-attr=signup-name]').fill('Alice Bob')
await expect(page.locator('[data-attr=signup-name]')).toHaveValue('Alice Bob')