SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: remove userpilot and update Posthog (#9668)
Vishal Sharma1b01b6102647
diff --git a/frontend/package.json b/frontend/package.jsonindex a04a890755..66c88cf90d 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -113,7 +113,7 @@"overlayscrollbars": "^2.8.1","overlayscrollbars-react": "^0.5.6","papaparse": "5.4.1",- "posthog-js": "1.215.5",+ "posthog-js": "1.298.0","rc-tween-one": "3.0.6","react": "18.2.0","react-addons-update": "15.6.3",@@ -150,7 +150,6 @@"tsconfig-paths-webpack-plugin": "^3.5.1","typescript": "^4.0.5","uplot": "1.6.31",- "userpilot": "1.3.9","uuid": "^8.3.2","web-vitals": "^0.2.4","webpack": "5.94.0",diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsxindex b5ec3533b1..bc66fc1dfa 100644--- a/frontend/src/AppRoutes/index.tsx+++ b/frontend/src/AppRoutes/index.tsx@@ -7,7 +7,6 @@ import AppLoading from 'components/AppLoading/AppLoading';import KBarCommandPalette from 'components/KBarCommandPalette/KBarCommandPalette';import NotFound from 'components/NotFound';import Spinner from 'components/Spinner';-import UserpilotRouteTracker from 'components/UserpilotRouteTracker/UserpilotRouteTracker';import { FeatureKeys } from 'constants/features';import { LOCALSTORAGE } from 'constants/localStorage';import ROUTES from 'constants/routes';@@ -35,7 +34,6 @@ import { Suspense, useCallback, useEffect, useState } from 'react';import { Route, Router, Switch } from 'react-router-dom';import { CompatRouter } from 'react-router-dom-v5-compat';import { LicenseStatus } from 'types/api/licensesV3/getActive';-import { Userpilot } from 'userpilot';import { extractDomain } from 'utils/app';import { Home } from './pageComponents';@@ -123,18 +121,6 @@ function App(): JSX.Element {});}- Userpilot.identify(email, {- email,- name: displayName,- orgName,- tenant_id: hostNameParts[0],- data_region: hostNameParts[1],- tenant_url: hostname,- company_domain: domain,- source: 'signoz-ui',- isPaidUser: !!trialInfo?.trialConvertedToSubscription,- });-posthog?.identify(id, {email,name: displayName,@@ -317,10 +303,6 @@ function App(): JSX.Element {});}- if (process.env.USERPILOT_KEY) {- Userpilot.initialize(process.env.USERPILOT_KEY);- }-if (!isSentryInitialized) {Sentry.init({dsn: process.env.SENTRY_DSN,@@ -381,7 +363,6 @@ function App(): JSX.Element {<Router history={history}><CompatRouter><KBarCommandPaletteProvider>- <UserpilotRouteTracker /><KBarCommandPalette /><NotificationProvider><ErrorModalProvider>diff --git a/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.test.tsx b/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.test.tsxdeleted file mode 100644index 1b3436cce7..0000000000--- a/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.test.tsx+++ /dev/null@@ -1,223 +0,0 @@-import { render } from '@testing-library/react';-import { act } from 'react-dom/test-utils';-import { MemoryRouter } from 'react-router-dom';-import { Userpilot } from 'userpilot';--import UserpilotRouteTracker from './UserpilotRouteTracker';--// Mock constants-const INITIAL_PATH = '/initial';-const TIMER_DELAY = 100;--// Mock the userpilot module-jest.mock('userpilot', () => ({- Userpilot: {- reload: jest.fn(),- },-}));--// Mock location state-let mockLocation = {- pathname: INITIAL_PATH,- search: '',- hash: '',- state: null,-};--// Mock react-router-dom-jest.mock('react-router-dom', () => {- const originalModule = jest.requireActual('react-router-dom');-- return {- ...originalModule,- useLocation: jest.fn(() => mockLocation),- };-});--describe('UserpilotRouteTracker', () => {- beforeEach(() => {- jest.clearAllMocks();- // Reset timers- jest.useFakeTimers();- // Reset error mock implementation- (Userpilot.reload as jest.Mock).mockImplementation(() => {});- // Reset location to initial state- mockLocation = {- pathname: INITIAL_PATH,- search: '',- hash: '',- state: null,- };- });-- afterEach(() => {- jest.useRealTimers();- });-- it('calls Userpilot.reload on initial render', () => {- render(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );-- // Fast-forward timer to trigger the setTimeout in reloadUserpilot- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });-- expect(Userpilot.reload).toHaveBeenCalledTimes(1);- });-- it('calls Userpilot.reload when pathname changes', () => {- const { rerender } = render(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );-- // Fast-forward initial render timer- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });- jest.clearAllMocks();-- // Create a new location object with different pathname- const newLocation = {- ...mockLocation,- pathname: '/new-path',- };-- // Update the mock location with new path and trigger re-render- act(() => {- mockLocation = newLocation;- // Force a component update with the new location- rerender(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );- });-- // Fast-forward timer to allow the setTimeout to execute- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });-- expect(Userpilot.reload).toHaveBeenCalledTimes(1);- });-- it('calls Userpilot.reload when search parameters change', () => {- const { rerender } = render(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );-- // Fast-forward initial render timer- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });- jest.clearAllMocks();-- // Create a new location object with different search params- const newLocation = {- ...mockLocation,- search: '?param=value',- };-- // Update the mock location with new search and trigger re-render- // eslint-disable-next-line sonarjs/no-identical-functions- act(() => {- mockLocation = newLocation;- // Force a component update with the new location- rerender(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );- });-- // Fast-forward timer to allow the setTimeout to execute- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });-- expect(Userpilot.reload).toHaveBeenCalledTimes(1);- });-- it('handles errors in Userpilot.reload gracefully', () => {- // Mock console.error to prevent test output noise and capture calls- const consoleErrorSpy = jest- .spyOn(console, 'error')- .mockImplementation(() => {});-- // Instead of using the component, we test the error handling behavior directly- const errorMsg = 'Error message';-- // Set up a function that has the same error handling behavior as in component- const testErrorHandler = (): void => {- try {- if (typeof Userpilot !== 'undefined' && Userpilot.reload) {- Userpilot.reload();- }- } catch (error) {- console.error('[Userpilot] Error reloading on route change:', error);- }- };-- // Make Userpilot.reload throw an error- (Userpilot.reload as jest.Mock).mockImplementation(() => {- throw new Error(errorMsg);- });-- // Execute the function that should handle errors- testErrorHandler();-- // Verify error was logged- expect(consoleErrorSpy).toHaveBeenCalledWith(- '[Userpilot] Error reloading on route change:',- expect.any(Error),- );-- // Restore console mock- consoleErrorSpy.mockRestore();- });-- it('does not call Userpilot.reload when same route is rendered again', () => {- const { rerender } = render(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );-- // Fast-forward initial render timer- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });- jest.clearAllMocks();-- act(() => {- mockLocation = {- pathname: mockLocation.pathname,- search: mockLocation.search,- hash: mockLocation.hash,- state: mockLocation.state,- };- // Force a component update with the same location- rerender(- <MemoryRouter>- <UserpilotRouteTracker />- </MemoryRouter>,- );- });-- // Fast-forward timer- act(() => {- jest.advanceTimersByTime(TIMER_DELAY);- });-- // Should not call reload since path and search are the same- expect(Userpilot.reload).not.toHaveBeenCalled();- });-});diff --git a/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.tsx b/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.tsxdeleted file mode 100644index 8515bc4270..0000000000--- a/frontend/src/components/UserpilotRouteTracker/UserpilotRouteTracker.tsx+++ /dev/null@@ -1,60 +0,0 @@-import { useCallback, useEffect, useRef } from 'react';-import { useLocation } from 'react-router-dom';-import { Userpilot } from 'userpilot';--/**- * UserpilotRouteTracker - A component that tracks route changes and calls Userpilot.reload- * on actual page changes (pathname changes or significant query parameter changes).- *- * This component renders nothing and is designed to be placed once high in the component tree.- */-function UserpilotRouteTracker(): null {- const location = useLocation();- const prevPathRef = useRef<string>(location.pathname);- const prevSearchRef = useRef<string>(location.search);- const isFirstRenderRef = useRef<boolean>(true);-- // Function to reload Userpilot safely - using useCallback to avoid dependency issues- const reloadUserpilot = useCallback((): void => {- try {- if (typeof Userpilot !== 'undefined' && Userpilot.reload) {- setTimeout(() => {- Userpilot.reload();- }, 100);- }- } catch (error) {- console.error('[Userpilot] Error reloading on route change:', error);- }- }, []);-- // Handle first render- useEffect(() => {- if (isFirstRenderRef.current) {- isFirstRenderRef.current = false;- reloadUserpilot();- }- }, [reloadUserpilot]);-- // Handle route/query changes- useEffect(() => {- // Skip first render as it's handled by the effect above- if (isFirstRenderRef.current) {- return;- }-- // Check if the path has changed or if significant query params have changed- const pathChanged = location.pathname !== prevPathRef.current;- const searchChanged = location.search !== prevSearchRef.current;-- if (pathChanged || searchChanged) {- // Update refs- prevPathRef.current = location.pathname;- prevSearchRef.current = location.search;- reloadUserpilot();- }- }, [location.pathname, location.search, reloadUserpilot]);-- return null;-}--export default UserpilotRouteTracker;diff --git a/frontend/webpack.config.js b/frontend/webpack.config.jsindex ba68e0aee5..cf40e72c8e 100644--- a/frontend/webpack.config.js+++ b/frontend/webpack.config.js@@ -23,7 +23,6 @@ const plugins = [PYLON_APP_ID: process.env.PYLON_APP_ID,APPCUES_APP_ID: process.env.APPCUES_APP_ID,POSTHOG_KEY: process.env.POSTHOG_KEY,- USERPILOT_KEY: process.env.USERPILOT_KEY,SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,SENTRY_ORG: process.env.SENTRY_ORG,SENTRY_PROJECT_ID: process.env.SENTRY_PROJECT_ID,@@ -43,7 +42,6 @@ const plugins = [PYLON_IDENTITY_SECRET: process.env.PYLON_IDENTITY_SECRET,APPCUES_APP_ID: process.env.APPCUES_APP_ID,POSTHOG_KEY: process.env.POSTHOG_KEY,- USERPILOT_KEY: process.env.USERPILOT_KEY,SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,SENTRY_ORG: process.env.SENTRY_ORG,SENTRY_PROJECT_ID: process.env.SENTRY_PROJECT_ID,diff --git a/frontend/webpack.config.prod.js b/frontend/webpack.config.prod.jsindex 30a84c9c88..f854220e87 100644--- a/frontend/webpack.config.prod.js+++ b/frontend/webpack.config.prod.js@@ -28,7 +28,6 @@ const plugins = [PYLON_APP_ID: process.env.PYLON_APP_ID,APPCUES_APP_ID: process.env.APPCUES_APP_ID,POSTHOG_KEY: process.env.POSTHOG_KEY,- USERPILOT_KEY: process.env.USERPILOT_KEY,SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,SENTRY_ORG: process.env.SENTRY_ORG,SENTRY_PROJECT_ID: process.env.SENTRY_PROJECT_ID,@@ -53,7 +52,6 @@ const plugins = [PYLON_IDENTITY_SECRET: process.env.PYLON_IDENTITY_SECRET,APPCUES_APP_ID: process.env.APPCUES_APP_ID,POSTHOG_KEY: process.env.POSTHOG_KEY,- USERPILOT_KEY: process.env.USERPILOT_KEY,SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,SENTRY_ORG: process.env.SENTRY_ORG,SENTRY_PROJECT_ID: process.env.SENTRY_PROJECT_ID,diff --git a/frontend/yarn.lock b/frontend/yarn.lockindex 9bb70126de..71897be62a 100644--- a/frontend/yarn.lock+++ b/frontend/yarn.lock@@ -3385,30 +3385,6 @@strict-event-emitter "^0.2.4"web-encoding "^1.1.5"-"@ndhoule/each@^2.0.1":- version "2.0.1"- resolved "https://registry.yarnpkg.com/@ndhoule/each/-/each-2.0.1.tgz#bbed372a603e0713a3193c706a73ddebc5b426a9"- integrity sha512-wHuJw6x+rF6Q9Skgra++KccjBozCr9ymtna0FhxmV/8xT/hZ2ExGYR8SV8prg8x4AH/7mzDYErNGIVHuzHeybw==- dependencies:- "@ndhoule/keys" "^2.0.0"--"@ndhoule/includes@^2.0.1":- version "2.0.1"- resolved "https://registry.yarnpkg.com/@ndhoule/includes/-/includes-2.0.1.tgz#051ff5eb042c8fa17e7158f0a8a70172e1affaa5"- integrity sha512-Q8zN6f3yIhxgBwZ5ldLozHqJlc/fRQ5+hFFsPMFeC9SJvz0nq8vG9hoRXL1c1iaNFQd7yAZIy2igQpERoFqxqg==- dependencies:- "@ndhoule/each" "^2.0.1"--"@ndhoule/keys@^2.0.0":- version "2.0.0"- resolved "https://registry.yarnpkg.com/@ndhoule/keys/-/keys-2.0.0.tgz#3d64ae677c65a261747bf3a457c62eb292a4e0ce"- integrity sha512-vtCqKBC1Av6dsBA8xpAO+cgk051nfaI+PnmTZep2Px0vYrDvpUmLxv7z40COlWH5yCpu3gzNhepk+02yiQiZNw==--"@ndhoule/pick@^2.0.0":- version "2.0.0"- resolved "https://registry.yarnpkg.com/@ndhoule/pick/-/pick-2.0.0.tgz#e1eb1a6ca3243eef56daa095c3a1612c74a52156"- integrity sha512-xkYtpf1pRd8egwvl5tJcdGu+GBd6ZZH3S/zoIQ9txEI+pHF9oTIlxMC9G4CB3sRugAeLgu8qYJGl3tnxWq74Qw==-"@nodelib/[email protected]":version "2.1.5"resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz"@@ -3541,6 +3517,13 @@resolved "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz"integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==+"@posthog/[email protected]":+ version "1.6.0"+ resolved "https://registry.yarnpkg.com/@posthog/core/-/core-1.6.0.tgz#a5b63a30950a8dfe87d4bf335ab24005c7ce1278"+ integrity sha512-Tbh8UACwbb7jFdDC7wwXHtfNzO+4wKh3VbyMHmp2UBe6w1jliJixexTJNfkqdGZm+ht3M10mcKvGGPnoZ2zLBg==+ dependencies:+ cross-spawn "^7.0.6"+"@radix-ui/[email protected]":version "1.0.1"resolved "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.0.1.tgz#e46f9958b35d10e9f6dc71c497305c22e3e55dbd"@@ -7523,11 +7506,6 @@ compare-func@^2.0.0:array-ify "^1.0.0"dot-prop "^5.1.0"- version "0.0.3"- resolved "https://registry.yarnpkg.com/component-indexof/-/component-indexof-0.0.3.tgz#11d091312239eb8f32c8f25ae9cb002ffe8d3c24"- integrity sha512-puDQKvx/64HZXb4hBwIcvQLaLgux8o1CbWl39s41hrIIZDl1lJiD5jc22gj3RBeGK0ovxALDYpIbyjqDUUl0rw==-compressible@~2.0.16:version "2.0.18"resolved "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz"@@ -7738,7 +7716,7 @@ [email protected]:dependencies:node-fetch "2.6.7"[email protected], cross-spawn@^6.0.5, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:[email protected], cross-spawn@^6.0.5, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.6:version "7.0.5"resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.5.tgz#910aac880ff5243da96b728bc6521a5f6c2f2f82"integrity sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==@@ -11251,11 +11229,6 @@ is-wsl@^3.1.0:dependencies:is-inside-container "^1.0.0"-is@^3.1.0:- version "3.3.2"- resolved "https://registry.yarnpkg.com/is/-/is-3.3.2.tgz#dfc285f4937f08564675f2f17cc6ac6cd2113ace"- integrity sha512-a2xr4E3s1PjDS8ORcGgXpWx6V+liNs+O3JRD2mb9aeugD7rtkkZ0zgLdYgw0tWsKhsdiezGYptSiMlVazCBTuQ==-version "0.0.1"resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"@@ -13626,11 +13599,6 @@ nwsapi@^2.2.0:resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.4.tgz"integrity sha512-NHj4rzRo0tQdijE9ZqAx6kYDcoRwYwSYzCA8MY3JzfxlrvEU0jhnhJT9BhqhJs7I/dKcrDm6TyulaRqZPIhN5g==-obj-case@^0.2.0:- version "0.2.1"- resolved "https://registry.yarnpkg.com/obj-case/-/obj-case-0.2.1.tgz#13a554d04e5ca32dfd9d566451fd2b0e11007f1a"- integrity sha512-PquYBBTy+Y6Ob/O2574XHhDtHJlV1cJHMCgW+rDRc9J5hhmRelJB3k5dTK/3cVmFVtzvAKuENeuLpoyTzMzkOg==-object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:version "4.1.1"resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"@@ -14540,15 +14508,16 @@ postcss@^8.4.35:picocolors "^1.1.1"source-map-js "^1.2.1"- version "1.215.5"- resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.215.5.tgz#0512cfdb919da960b809c5f686ca147f9c2922ba"- integrity sha512-42lPur+xvkp51pHz2FQ7Y+KHdZ4eQSNIhUO03EECvc2UsmnM0FiVTrF1bcLwHZMaWfR26gOeuOAAjTUV9tinJg==+ version "1.298.0"+ resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.298.0.tgz#54730988a753220aef54af0c4e69960633917450"+ integrity sha512-Zwzsf7TO8qJ6DFLuUlQSsT/5OIOcxSBZlKOSk3satkEnwKdmnBXUuxgVXRHrvq1kj7OB2PVAPgZiQ8iHHj9DRA==dependencies:+ "@posthog/core" "1.6.0"core-js "^3.38.1"fflate "^0.4.8"preact "^10.19.3"- web-vitals "^4.2.0"+ web-vitals "^4.2.4"preact@^10.19.3:version "10.22.0"@@ -17917,17 +17886,6 @@ use-sync-external-store@^1.0.0:resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz"integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==- version "1.3.9"- resolved "https://registry.yarnpkg.com/userpilot/-/userpilot-1.3.9.tgz#6374083f3e84cbf1fc825133588b5b499054271b"- integrity sha512-V0QIuIlAJPB8s3j+qtv7BW7NKSXthlZWuowIu+IZOMGLgUbqQTaSW5m1Ct4wJviPKUNOi8kbhCXN4c4b3zcJzg==- dependencies:- "@ndhoule/includes" "^2.0.1"- "@ndhoule/pick" "^2.0.0"- component-indexof "0.0.3"- is "^3.1.0"- obj-case "^0.2.0"-util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:version "1.0.2"resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"@@ -18134,7 +18092,7 @@ web-vitals@^0.2.4:resolved "https://registry.npmjs.org/web-vitals/-/web-vitals-0.2.4.tgz"integrity sha512-6BjspCO9VriYy12z356nL6JBS0GYeEcA457YyRzD+dD6XYCQ75NKhcOHUMHentOE7OcVCIXXDvOm0jKFfQG2Gg==-web-vitals@^4.2.0:+web-vitals@^4.2.4:version "4.2.4"resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-4.2.4.tgz#1d20bc8590a37769bd0902b289550936069184b7"integrity sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==