@debugg-ai/debugg-ai-mcp
Version:
Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.
33 lines (32 loc) • 858 B
JavaScript
/**
* PostHog telemetry provider.
* Enabled when POSTHOG_API_KEY is set in the environment.
*/
import { PostHog } from 'posthog-node';
export class PostHogProvider {
client;
constructor(apiKey, options) {
this.client = new PostHog(apiKey, {
host: options?.host ?? 'https://us.i.posthog.com',
flushAt: 20,
flushInterval: 10000,
});
}
capture(event) {
this.client.capture({
distinctId: event.distinctId,
event: event.event,
properties: event.properties,
timestamp: event.timestamp,
});
}
identify(distinctId, properties) {
this.client.identify({ distinctId, properties });
}
async flush() {
await this.client.flush();
}
async shutdown() {
await this.client.shutdown();
}
}