-
Notifications
You must be signed in to change notification settings - Fork 163
chore: add connection metadata to telemetry #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
c5ec47e
3b9e595
fcbfcff
1319767
94af53d
b6c9790
9a28985
55cb171
d2709e0
ac8aa2d
b5964dd
d0c8c8c
565e930
1397861
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ import { ensureCurrentIpInAccessList } from "../../../common/atlas/accessListUti | |
| import type { AtlasClusterConnectionInfo } from "../../../common/connectionManager.js"; | ||
| import { getDefaultRoleFromConfig } from "../../../common/atlas/roles.js"; | ||
| import { AtlasArgs } from "../../args.js"; | ||
| import type { ConnectionMetadata } from "../../../telemetry/types.js"; | ||
| import type { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js"; | ||
|
|
||
| const addedIpAccessListMessage = | ||
| "Note: Your current IP address has been added to the Atlas project's IP access list to enable secure connection."; | ||
|
|
@@ -303,4 +305,24 @@ export class ConnectClusterTool extends AtlasToolBase { | |
|
|
||
| return { content }; | ||
| } | ||
|
|
||
| protected override resolveTelemetryMetadata( | ||
| result: CallToolResult, | ||
| args: Parameters<ToolCallback<typeof this.argsShape>> | ||
| ): ConnectionMetadata { | ||
| const parentMetadata = super.resolveTelemetryMetadata(result, ...args); | ||
| const connectionMetadata = this.getConnectionInfoMetadata(); | ||
| // Explicitly merge, preferring parentMetadata for known overlapping keys (project_id, org_id) | ||
| // since parent has more complete information from tool arguments | ||
| const { project_id, org_id, ...restConnectionMetadata } = connectionMetadata; | ||
| const finalProjectId = parentMetadata.project_id ?? project_id; | ||
| const finalOrgId = parentMetadata.org_id ?? org_id; | ||
| return { | ||
| ...parentMetadata, | ||
| ...restConnectionMetadata, | ||
| // Only include project_id and org_id if they are defined | ||
| ...(finalProjectId !== undefined && { project_id: finalProjectId }), | ||
| ...(finalOrgId !== undefined && { org_id: finalOrgId }), | ||
| }; | ||
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
planning to add host info here - starting with connection auth type as an example of something we can capture