Skip to content

chore: replace error tracking in plugin server #31654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

daibhin
Copy link
Contributor

@daibhin daibhin commented Apr 28, 2025

Important

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

Replace Sentry with PostHog equivalents

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR replaces Sentry error tracking with PostHog's own error tracking system throughout the plugin server codebase, removing all Sentry dependencies and configurations.

Key changes:

  • Removed Sentry packages (@sentry/node, @sentry/profiling-node, etc.) and upgraded posthog-node from 4.5.2 to 4.14.0
  • Replaced initSentry() with initSuperProperties() for error tracking initialization
  • Removed lingering transaction.finish() call in each-batch-webhooks.ts that could cause runtime errors
  • Renamed parameters like sendTimeoutGuardToSentry to sendException across multiple files for consistency
  • Removed Sentry breadcrumb event listeners from Kafka consumers, potentially impacting debug visibility

The changes maintain core error tracking functionality while consolidating to PostHog's system, though some Sentry features like profiling integration will need alternative solutions.

22 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 429 to 433
if (error?.isRetriable === false) {
const sentryEventId = captureException(error)
captureException(error)
const headers: MessageHeader[] = message.headers ?? []
headers.push({ ['sentry-event-id']: sentryEventId })
headers.push({ ['event-id']: event.uuid })
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider adding error context (e.g. event UUID) to captureException for better debugging

import { PostHog } from 'posthog-node'
import { SeverityLevel } from 'posthog-node/src/extensions/error-tracking/types'

import { defaultConfig } from '../config/config'
import { Team } from '../types'

const fs = require('fs')
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Use ES6 import syntax for consistency with other imports

// Docker containers should have a commit.txt file in the base directory with the git
// commit hash used to generate them. `plugin-server` runs from a child directory, so we
// need to look up one level.
superProperties['release'] = fs.readFileSync('../commit.txt', 'utf8')
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using path.join() to handle path separators correctly across platforms

Suggested change
superProperties['release'] = fs.readFileSync('../commit.txt', 'utf8')
superProperties['release'] = fs.readFileSync(path.join(__dirname, '..', 'commit.txt'), 'utf8')

Copy link
Contributor

github-actions bot commented Apr 28, 2025

Size Change: -30 B (0%)

Total Size: 13.6 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 13.6 MB -30 B (0%)

compressed-size-action

@daibhin daibhin requested a review from a team April 28, 2025 16:06
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