add telemetry for context providers
This commit is contained in:
parent
79668ebb00
commit
0dca48ccf9
2 changed files with 13 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { BaseContextProvider } from "../";
|
||||
import { ContextProviderName } from "../../";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
|
||||
import ClipboardContextProvider from "./ClipboardContextProvider";
|
||||
import CodebaseContextProvider from "./CodebaseContextProvider";
|
||||
|
|
@ -75,5 +76,12 @@ export const Providers: (typeof BaseContextProvider)[] = [
|
|||
export function contextProviderClassFromName(
|
||||
name: ContextProviderName,
|
||||
): typeof BaseContextProvider | undefined {
|
||||
return Providers.find((cls) => cls.description.title === name);
|
||||
const provider = Providers.find((cls) => cls.description.title === name);
|
||||
|
||||
void Telemetry.capture("context_provider_load", {
|
||||
providerName: name,
|
||||
found: !!provider, // also capture those which user expected to be present
|
||||
});
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1105,6 +1105,10 @@ export class Core {
|
|||
itemId: uuidv4(),
|
||||
};
|
||||
|
||||
void Telemetry.capture("context_provider_get_context_items", {
|
||||
name: provider.description.title,
|
||||
});
|
||||
|
||||
const items = await provider.getContextItems(query, {
|
||||
config,
|
||||
llm,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue