Add is_reconnection field to mcp_session_started event#137
Open
korenaren wants to merge 1 commit intoansible:mainfrom
Open
Add is_reconnection field to mcp_session_started event#137korenaren wants to merge 1 commit intoansible:mainfrom
korenaren wants to merge 1 commit intoansible:mainfrom
Conversation
Track whether a session is a reconnection by checking if the same user_unique_id had a session within a 1-hour window. This lets Amplitude filter out reconnection noise from the 10:1 session-to-tool ratio (AAP-67154). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
goneri
reviewed
Mar 6, 2026
| const lastSeen = this.recentUsers.get(userUniqueId); | ||
| const isReconnection = | ||
| lastSeen !== undefined && now - lastSeen < this.RECONNECTION_WINDOW; | ||
| this.recentUsers.set(userUniqueId, now); |
Contributor
There was a problem hiding this comment.
Depending on the toolset, pne singe user can be connected multiple times. In the situation where the user connect to several toolsets, isReconnect will be true for all but the first connection.
Also, we can have the situation where a user is using two different MCP clients at the same time, eg VSCode and Claude Code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_reconnectionboolean field tomcp_session_startedtelemetry eventsuser_unique_idat the AnalyticsService level with a 1-hour reconnection windowis_reconnection: true; otherwisefalseFixes AAP-67154 — the 10:1 ratio of
mcp_session_startedtomcp_tool_calledevents is caused by reconnection churn and toolset multiplier effects. This field lets Amplitude filter out reconnection noise without changing session timeout or routing behavior.Test plan
npx vitest run)🤖 Generated with Claude Code