Skip to content

Commit 2218063

Browse files
committed
Add AI request ID to feedback telemetry events
Includes a unique AI request identifier in feedback telemetry to enable improved traceability and correlation of feedback to specific AI requests. Updates documentation and relevant interfaces to reflect the new field.
1 parent 5a0b823 commit 2218063

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

docs/telemetry-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
146146
```typescript
147147
{
148+
'ai.request.id': string,
148149
// The AI feature that feedback was submitted for
149150
'feature': string,
150151
// Type of feedback provided

package.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14133,29 +14133,19 @@
1413314133
},
1413414134
{
1413514135
"command": "gitlens.ai.feedback.positive",
14136-
"when": "resourceScheme == gitlens-markdown && gitlens:markdown:feedback:available && activeCustomEditorId == vscode.markdown.preview.editor",
14136+
"when": "resourceScheme == gitlens-markdown && config.telemetry.enabled && activeCustomEditorId == vscode.markdown.preview.editor",
1413714137
"group": "navigation@1"
1413814138
},
1413914139
{
1414014140
"command": "gitlens.ai.feedback.negative",
14141-
"when": "resourceScheme == gitlens-markdown && gitlens:markdown:feedback:available && activeCustomEditorId == vscode.markdown.preview.editor",
14141+
"when": "resourceScheme == gitlens-markdown && config.telemetry.enabled && activeCustomEditorId == vscode.markdown.preview.editor",
1414214142
"group": "navigation@2"
1414314143
},
1414414144
{
1414514145
"command": "gitlens.regenerateMarkdownDocument",
1414614146
"when": "resourceScheme == gitlens-markdown && activeCustomEditorId == vscode.markdown.preview.editor",
1414714147
"group": "navigation@3"
1414814148
},
14149-
{
14150-
"command": "gitlens.ai.feedback.positive",
14151-
"when": "resourceScheme == gitlens-markdown && config.telemetry.enabled && activeCustomEditorId == vscode.markdown.preview.editor",
14152-
"group": "navigation@1"
14153-
},
14154-
{
14155-
"command": "gitlens.ai.feedback.negative",
14156-
"when": "resourceScheme == gitlens-markdown && config.telemetry.enabled && activeCustomEditorId == vscode.markdown.preview.editor",
14157-
"group": "navigation@2"
14158-
},
1415914149
{
1416014150
"command": "gitlens.openPatch",
1416114151
"when": "false && editorLangId == diff"

src/commands/aiFeedback.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface AIFeedbackContext {
2727
resetsOn: Date;
2828
};
2929
};
30+
aiRequestId: string | undefined;
3031
outputLength: number;
3132
}
3233

@@ -203,6 +204,7 @@ function sendFeedbackEvent(
203204
'usage.limits.used': context.usage?.limits?.used,
204205
'usage.limits.limit': context.usage?.limits?.limit,
205206
'usage.limits.resetsOn': context.usage?.limits?.resetsOn?.toISOString(),
207+
'ai.request.id': context.aiRequestId,
206208
'output.length': context.outputLength,
207209
};
208210

src/commands/explainBase.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export abstract class ExplainCommandBase extends GlCommandBase {
6969
providerName: result.model.provider.name,
7070
},
7171
usage: result.usage,
72+
aiRequestId: result.id,
7273
outputLength: result.content?.length,
7374
};
7475

src/commands/generateRebase.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ export async function generateRebase(
359359
providerName: result.model.provider.name,
360360
},
361361
usage: result.usage,
362+
aiRequestId: result.id,
362363
outputLength: result.content?.length,
363364
};
364365
const telemetryEnabled = container.telemetry.enabled;

src/constants.telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ export interface AIFeedbackEvent {
425425
'usage.limits.used'?: number;
426426
'usage.limits.limit'?: number;
427427
'usage.limits.resetsOn'?: string;
428+
'ai.request.id'?: string;
428429

429430
'output.length'?: number;
430431
}

0 commit comments

Comments
 (0)