Skip to content
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

update billingMetadata for failed/disconnected type of events #6254

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions vscode/src/completions/analytics-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,20 @@ function writeCompletionEvent<SubFeature extends string, Action extends string,
telemetryRecorder.recordEvent(`cody.completion.${subfeature}`, action, params)
} else {
// Add billing metadata to completion event params.
params = {
...params,
billingMetadata: {
product: 'cody',
// Only acceptance events qualify as "core" usage.
category: action === 'partiallyAccepted' || action === 'accepted' ? 'core' : 'billable',
},
}
params =
action === 'error'
? params
: {
...params,
billingMetadata: {
product: 'cody',
// Only acceptance events qualify as "core" usage.
category:
action === 'partiallyAccepted' || action === 'accepted'
? 'core'
: 'billable',
},
}

telemetryRecorder.recordEvent('cody.completion', action, params)
}
Expand Down
11 changes: 7 additions & 4 deletions vscode/src/services/AuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,13 @@ function reportAuthTelemetryEvent(authStatus: AuthStatus): void {
eventValue = 'disconnected'
}
telemetryRecorder.recordEvent('cody.auth', eventValue, {
billingMetadata: {
product: 'cody',
category: 'billable',
},
billingMetadata:
eventValue === 'connected'
? {
product: 'cody',
category: 'billable',
}
: undefined,
})
}
function toCredentialsOnlyNormalized(
Expand Down
Loading