Skip to content

Commit 866d1d8

Browse files
authored
Telemetry: add RequestId and ConversationId to toolCallDetails and response.success events (#310281)
add requestId and conversationId to relevant events
1 parent ca3b9bf commit 866d1d8

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
175175

176176
const baseTelemetry = TelemetryData.createAndMarkAsIssued({
177177
...telemetryProperties,
178+
...(conversationId ? { conversationId } : {}),
178179
headerRequestId: ourRequestId,
179180
baseModel: chatEndpoint.model,
180181
uiKind: ChatLocation.toString(location)

extensions/copilot/src/extension/prompt/node/chatMLFetcherTelemetry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export class ChatMLFetcherTelemetrySender {
112112
"model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
113113
"modelInvoked": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Actual model invoked for the response" },
114114
"apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
115+
"conversationId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Id for the current chat conversation." },
115116
"requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
116117
"gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
117118
"associatedRequestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Another request ID that this request is associated with (eg, the originating request of a summarization request)." },
@@ -151,6 +152,7 @@ export class ChatMLFetcherTelemetrySender {
151152
filterReason: chatCompletion.filterReason,
152153
source: baseTelemetry?.properties.messageSource ?? 'unknown',
153154
initiatorType: userInitiatedRequest ? 'user' : 'agent',
155+
conversationId: baseTelemetry?.properties.conversationId,
154156
model: chatEndpointInfo?.model,
155157
modelInvoked: chatCompletion.model,
156158
apiType: chatEndpointInfo?.apiType,

extensions/copilot/src/extension/prompt/node/chatParticipantTelemetry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ export abstract class ChatTelemetry<C extends IDocumentContext | undefined = IDo
506506
const toolCallProperties = {
507507
intentId: this._intent.id,
508508
conversationId: this._conversation.sessionId,
509+
requestId: this.telemetryMessageId,
509510
responseType,
510511
toolCounts: JSON.stringify(toolCounts),
511512
model: this._endpoint.model
@@ -532,6 +533,7 @@ export abstract class ChatTelemetry<C extends IDocumentContext | undefined = IDo
532533
"comment": "Records information about tool calls during a request.",
533534
"intentId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Id for the invoked intent." },
534535
"conversationId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Id for the current chat conversation." },
536+
"requestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Id for the current turn request." },
535537
"numRequests": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The total number of requests made" },
536538
"turnIndex": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true, "comment": "The conversation turn index" },
537539
"toolCounts": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": false, "comment": "The number of times each tool was used" },

0 commit comments

Comments
 (0)