: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(nodejs): personhog error context when requests fail (#61466)
Nick Best0925ab72eaee
diff --git a/nodejs/src/ingestion/personhog/grpc-retry.ts b/nodejs/src/ingestion/personhog/grpc-retry.tsindex 434b50a1c4cd..5757a10faeca 100644--- a/nodejs/src/ingestion/personhog/grpc-retry.ts+++ b/nodejs/src/ingestion/personhog/grpc-retry.ts@@ -36,6 +36,9 @@ export async function withRetry<T>(} catch (error) {lastError = errorif (!isRetryable(error) || attempt === maxRetries) {+ logger.error(`[PersonHog] gRPC call failed in ${label}`, {+ error: String(error),+ })throw error}logger.warn(`[${label}] Retryable gRPC error, retrying`, {diff --git a/nodejs/src/ingestion/personhog/personhog-group-read-repository.ts b/nodejs/src/ingestion/personhog/personhog-group-read-repository.tsindex f211d0db4809..ba930a45da86 100644--- a/nodejs/src/ingestion/personhog/personhog-group-read-repository.ts+++ b/nodejs/src/ingestion/personhog/personhog-group-read-repository.ts@@ -28,7 +28,7 @@ export class PersonHogGroupReadRepository implements GroupReadRepository {group_properties: Record<string, any>}[]> {- return withRetry('PersonHogGroupReadRepository', () =>+ return withRetry('PersonHogGroupReadRepository.fetchGroupsByKeys', () =>timedGrpc(this.clientLabel, 'fetchGroupsByKeys', () =>this.grpcClient.groups.fetchGroupsByKeys(teamIds, groupTypeIndexes, groupKeys, callerTag))@@ -39,7 +39,7 @@ export class PersonHogGroupReadRepository implements GroupReadRepository {teamIds: TeamId[],callerTag?: string): Promise<Record<string, { group_type: string; group_type_index: GroupTypeIndex }[]>> {- return withRetry('PersonHogGroupReadRepository', () =>+ return withRetry('PersonHogGroupReadRepository.fetchGroupTypesByTeamIds', () =>timedGrpc(this.clientLabel, 'fetchGroupTypesByTeamIds', () =>this.grpcClient.groups.fetchGroupTypesByTeamIds(teamIds, callerTag))diff --git a/nodejs/src/ingestion/personhog/personhog-person-read-repository.ts b/nodejs/src/ingestion/personhog/personhog-person-read-repository.tsindex a8cbbe93cb51..29f61ff99975 100644--- a/nodejs/src/ingestion/personhog/personhog-person-read-repository.ts+++ b/nodejs/src/ingestion/personhog/personhog-person-read-repository.ts@@ -19,7 +19,7 @@ export class PersonHogPersonReadRepository implements PersonReadRepository {) {}async fetchPerson(teamId: number, distinctId: string, callerTag?: string): Promise<InternalPerson | undefined> {- const results = await withRetry('PersonHogPersonReadRepository', () =>+ const results = await withRetry('PersonHogPersonReadRepository.fetchPerson', () =>timedGrpc(this.clientLabel, 'fetchPerson', () =>this.grpcClient.persons.fetchPersonsByDistinctIds([{ teamId, distinctId }], callerTag))@@ -31,7 +31,7 @@ export class PersonHogPersonReadRepository implements PersonReadRepository {teamPersons: { teamId: TeamId; distinctId: string }[],callerTag?: string): Promise<InternalPersonWithDistinctId[]> {- return withRetry('PersonHogPersonReadRepository', () =>+ return withRetry('PersonHogPersonReadRepository.fetchPersonsByDistinctIds', () =>timedGrpc(this.clientLabel, 'fetchPersonsByDistinctIds', () =>this.grpcClient.persons.fetchPersonsByDistinctIds(teamPersons, callerTag))@@ -42,7 +42,7 @@ export class PersonHogPersonReadRepository implements PersonReadRepository {teamPersons: { teamId: TeamId; personId: string }[],callerTag?: string): Promise<InternalPerson[]> {- return withRetry('PersonHogPersonReadRepository', () =>+ return withRetry('PersonHogPersonReadRepository.fetchPersonsByPersonIds', () =>timedGrpc(this.clientLabel, 'fetchPersonsByPersonIds', () =>this.grpcClient.persons.fetchPersonsByPersonIds(teamPersons, callerTag))@@ -55,7 +55,7 @@ export class PersonHogPersonReadRepository implements PersonReadRepository {options?: { limitPerPerson?: number },callerTag?: string): Promise<Record<string, string[]>> {- return withRetry('PersonHogPersonReadRepository', () =>+ return withRetry('PersonHogPersonReadRepository.fetchDistinctIdsForPersons', () =>timedGrpc(this.clientLabel, 'fetchDistinctIdsForPersons', () =>this.grpcClient.persons.getDistinctIdsForPersons(teamId,