Skip to content

feat: add OpenTelemetry logging for PostHog and fix client-side errors#658

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-posthog-exceptions
Jan 7, 2026
Merged

feat: add OpenTelemetry logging for PostHog and fix client-side errors#658
bokelley merged 1 commit into
mainfrom
bokelley/fix-posthog-exceptions

Conversation

@bokelley

@bokelley bokelley commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add OpenTelemetry logging integration for PostHog Logs feature
  • Fix client-side JavaScript errors shown in PostHog Error Tracking

Changes

OpenTelemetry Logging

  • New server/src/utils/otel-logs.ts module with OTLP HTTP exporter
  • Integrates with Pino logger via setLogHook()
  • Configurable min log level via OTEL_MIN_LOG_LEVEL env var (default: 30 = info)
  • Configurable service name via OTEL_SERVICE_NAME env var
  • Reads version from package.json for accurate version tracking
  • Batch processing for performance (512 logs per batch, 5s flush interval)

Client-Side Error Fixes

  • admin-prospects.html: Fix quickInvoice() referencing non-existent .invoice-step elements
  • dashboard.html: Add optional chaining for DashboardNav.showLeadershipNav to handle cached JS files

Performance Optimization

  • Add early return in logger hook when no hooks are set to avoid unnecessary argument parsing

Test plan

  • TypeScript compiles without errors
  • All unit tests pass
  • Tested invoice modal in admin prospects page (no JS errors)
  • Tested dashboard page (no JS errors)
  • Verified OpenTelemetry initialization in Docker logs

🤖 Generated with Claude Code

- Add OpenTelemetry logging integration for PostHog Logs feature
  - New otel-logs.ts module with OTLP HTTP exporter
  - Integrates with Pino logger via setLogHook()
  - Configurable min log level via OTEL_MIN_LOG_LEVEL env var
  - Configurable service name via OTEL_SERVICE_NAME env var
  - Reads version from package.json for accurate version tracking

- Fix client-side JavaScript errors shown in PostHog Error Tracking:
  - admin-prospects.html: Fix quickInvoice() referencing non-existent
    invoice-step elements
  - dashboard.html: Add optional chaining for DashboardNav.showLeadershipNav
    to handle cached JS files

- Performance optimization: Add early return in logger hook when no hooks
  are set to avoid unnecessary argument parsing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit 80462b3 into main Jan 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant