: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(error-tracking): close remaining usage-instrumentation gaps (#75472)
Hugues Pouillotfa63bbe269b7
diff --git a/products/error_tracking/backend/facade/api.py b/products/error_tracking/backend/facade/api.pyindex 821269297cf6..45538b9c961a 100644--- a/products/error_tracking/backend/facade/api.py+++ b/products/error_tracking/backend/facade/api.py@@ -585,6 +585,7 @@ def create_external_reference(issue_id: UUID,integration_id: int,config: dict[str, Any],+ distinct_id: int | str,) -> contracts.ErrorTrackingExternalReference:reference = logic.create_external_reference(team_id=team_id,@@ -595,6 +596,7 @@ def create_external_reference(posthoganalytics.capture("error_tracking_external_issue_created",+ distinct_id=distinct_id,groups=groups(reference.issue.team.organization, reference.issue.team),properties={"issue_id": reference.issue_id,diff --git a/products/error_tracking/backend/presentation/views/external_references.py b/products/error_tracking/backend/presentation/views/external_references.pyindex b5f252601a77..cd40e483bc4d 100644--- a/products/error_tracking/backend/presentation/views/external_references.py+++ b/products/error_tracking/backend/presentation/views/external_references.py@@ -114,6 +114,7 @@ class ErrorTrackingExternalReferenceViewSet(TeamAndOrgViewSetMixin, ForbidDestroissue_id=issue_id,integration_id=serializer.validated_data["integration_id"],config=serializer.validated_data["config"],+ distinct_id=request.user.pk,)except ExternalReferenceValidationError as error:logger.warning("Failed to create external reference", exc_info=error)diff --git a/products/error_tracking/backend/presentation/views/symbol_sets.py b/products/error_tracking/backend/presentation/views/symbol_sets.pyindex aaa05f7add87..89490a20c6ab 100644--- a/products/error_tracking/backend/presentation/views/symbol_sets.py+++ b/products/error_tracking/backend/presentation/views/symbol_sets.py@@ -290,6 +290,8 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewdef bulk_start_upload(self, request: Request, **kwargs) -> Response:if request.user.pk:posthoganalytics.identify_context(str(request.user.pk))+ else:+ posthoganalytics.identify_context(str(self.team.uuid))upload_serializer = ErrorTrackingSymbolSetBulkStartUploadSerializer(data=request.data)upload_serializer.is_valid(raise_exception=True)@@ -324,6 +326,8 @@ class ErrorTrackingSymbolSetViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewdef bulk_finish_upload(self, request: Request, **kwargs) -> Response:if request.user.pk:posthoganalytics.identify_context(str(request.user.pk))+ else:+ posthoganalytics.identify_context(str(self.team.uuid))content_hashes = request.data.get("content_hashes", {})if content_hashes is None:return Response({"detail": "content_hashes are required"}, status=status.HTTP_400_BAD_REQUEST)diff --git a/products/error_tracking/backend/test/test_facade_api.py b/products/error_tracking/backend/test/test_facade_api.pyindex b6d11dc35fa5..5c481f718e19 100644--- a/products/error_tracking/backend/test/test_facade_api.py+++ b/products/error_tracking/backend/test/test_facade_api.py@@ -79,6 +79,7 @@ class TestErrorTrackingFacadeAPI(BaseTest):issue_id=issue.id,integration_id=integration.id,config={"team_id": "other-team-id", "title": "Checkout TypeError", "description": ""},+ distinct_id=self.user.id,)assert str(context.exception) == (@@ -108,6 +109,7 @@ class TestErrorTrackingFacadeAPI(BaseTest):issue_id=issue.id,integration_id=integration.id,config={"team_id": "linear-team-id", "title": "Checkout TypeError", "description": ""},+ distinct_id=self.user.id,)attachment_url = mock_create_issue.call_args.args[0]@@ -134,6 +136,7 @@ class TestErrorTrackingFacadeAPI(BaseTest):issue_id=issue.id,integration_id=integration.id,config={"team_id": "linear-team-id", "title": "No fingerprints yet", "description": ""},+ distinct_id=self.user.id,)attachment_url = mock_create_issue.call_args.args[0]diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsxindex e84a095e5551..c18abd51cb7b 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx@@ -302,6 +302,7 @@ const RightHandColumn = ({const LeftHandColumn = ({ isMobile }: { isMobile: boolean }): JSX.Element => {const { category } = useValues(errorTrackingIssueSceneConfigurationLogic)const { setCategory } = useActions(errorTrackingIssueSceneConfigurationLogic)+ const { issueId } = useValues(errorTrackingIssueSceneLogic)const ref = useRef<HTMLDivElement>(null)const resizerLogicProps: ResizerLogicProps = {@@ -329,7 +330,10 @@ const LeftHandColumn = ({ isMobile }: { isMobile: boolean }): JSX.Element => {><TabsPrimitivevalue={category}- onValueChange={(value) => setCategory(value as ErrorTrackingIssueSceneCategory)}+ onValueChange={(value) => {+ setCategory(value as ErrorTrackingIssueSceneCategory)+ posthog.capture('error_tracking_issue_tab_viewed', { issue_id: issueId, tab: value })+ }}className="flex flex-col flex-1 min-h-0"><div>diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/SourceMapsRecommendationCard.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/SourceMapsRecommendationCard.tsxindex bbff4484f5da..e0f93a6173dd 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/SourceMapsRecommendationCard.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/SourceMapsRecommendationCard.tsx@@ -1,4 +1,5 @@import { useActions } from 'kea'+import posthog from 'posthog-js'import { IconMagicWand } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'@@ -41,7 +42,16 @@ export function SourceMapsRecommendationCard({</div></div><div className="flex justify-center gap-2 mt-2">- <LemonButton type="tertiary" to={SOURCE_MAPS_DOCS_URL} targetBlank>+ <LemonButton+ type="tertiary"+ to={SOURCE_MAPS_DOCS_URL}+ targetBlank+ onClick={() => {+ posthog.capture('error_tracking_source_maps_docs_clicked', {+ source: 'recommendation_card',+ })+ }}+ >Read docs</LemonButton><LemonButton type="secondary" icon={<IconMagicWand />} onClick={() => openModal('recommendations')}>