Skip to content

Commit

Permalink
fix(logging): remove userId from identify and track COMPASS-7607 (#1814)
Browse files Browse the repository at this point in the history
  • Loading branch information
paula-stacho authored Feb 9, 2024
1 parent aa68f99 commit 2f855d6
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions packages/logging/src/setup-logger-and-telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,9 @@ export function setupLoggerAndTelemetry(
session_id,
};

const getTelemetryUserIdentity = () => {
if (telemetryAnonymousId) {
return {
anonymousId: telemetryAnonymousId,
};
}

return { userId };
};
const getTelemetryUserIdentity = () => ({
anonymousId: telemetryAnonymousId ?? userId,
});

// We emit different analytics events for loading files and evaluating scripts
// depending on whether we're already in the REPL or not yet. We store the
Expand Down Expand Up @@ -219,17 +213,13 @@ export function setupLoggerAndTelemetry(
}) {
if (updatedTelemetryUserIdentity.anonymousId) {
telemetryAnonymousId = updatedTelemetryUserIdentity.anonymousId;
analytics.identify({
anonymousId: updatedTelemetryUserIdentity.anonymousId,
traits: userTraits,
});
} else {
userId = updatedTelemetryUserIdentity.userId;
analytics.identify({
userId: updatedTelemetryUserIdentity.userId,
traits: userTraits,
});
}
analytics.identify({
...getTelemetryUserIdentity(),
traits: userTraits,
});
log.info('MONGOSH', mongoLogId(1_000_000_005), 'config', 'User updated');
}
);
Expand Down

0 comments on commit 2f855d6

Please sign in to comment.