Compare commits

...

11 Commits

Author SHA1 Message Date
abeatrix 8f03cca4ad Merge branch 'main' into bee/enableExceptionAutocapture 2025-08-27 18:27:18 -07:00
abeatrix b29e6eac32 Use env var for posthog api key 2025-08-27 17:14:55 -07:00
abeatrix dc406fca62 Refactor PostHog event filtering for better maintainability
Extract inline before_send logic into a dedicated posthogEventFilter function
and improve exception filtering to check for "cline" in error messages and
"saoudrizwan" in stack frame filenames. Add EventMessage import for type safety.
2025-08-26 09:34:43 -07:00
abeatrix bfd9c44105 Merge branch 'main' into bee/enableExceptionAutocapture 2025-08-25 10:56:55 -07:00
github-actions[bot] 05e3e2e915 v3.26.6 Release Notes (#5788)
* changeset version bump

* Updating CHANGELOG.md format

* Update CHANGELOG.md for version 3.26.6 with user-friendly descriptions

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: pashpashpash <nik@cline.bot>
2025-08-25 10:52:17 -07:00
pashpashpash 2b7147dcc0 add grok coder free model to cline provider (#5808)
* add free grok-coder-free model to cline provider

* add changeset

* fix typo
2025-08-25 10:39:21 -07:00
abeatrix 2cbe059e6b clean up 2025-08-21 14:33:21 -07:00
abeatrix d75ebebcea Merge branch 'main' into bee/enableExceptionAutocapture 2025-08-21 14:17:02 -07:00
abeatrix 546946ce5b Apply changes based on suggestions from the Posthog's team 2025-08-19 11:30:59 -07:00
abeatrix 20acd04c99 Update PostHog exception filtering logic
Move null return inside conditional block to properly filter exceptions
based on extension regex matching instead of always returning null.
2025-08-18 15:07:36 -07:00
abeatrix 3400a956c8 Update posthog-node to v5.7.0 and add exception filtering
- Upgrade posthog-node from v4.8.1 to v5.7.0
- Add before_send filter to only capture exceptions from extension.js
- Enable exception autocapture with source filtering
2025-08-18 15:03:34 -07:00
4 changed files with 52 additions and 9 deletions
+12 -4
View File
@@ -66,7 +66,7 @@
"p-timeout": "^6.1.4",
"p-wait-for": "^5.0.2",
"pdf-parse": "^1.1.1",
"posthog-node": "^4.8.1",
"posthog-node": "^5.7.0",
"puppeteer-chromium-resolver": "^23.0.0",
"puppeteer-core": "^23.4.0",
"reconnecting-eventsource": "^1.6.4",
@@ -3685,6 +3685,12 @@
"node": ">=18"
}
},
"node_modules/@posthog/core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@posthog/core/-/core-1.0.0.tgz",
"integrity": "sha512-gquQld+duT9DdzLIFoHZkUMW0DZOTSLCtSjuuC/zKFz65Qecbz9p37DHBJMkw0dCuB8Mgh2GtH8Ag3PznJrP3g==",
"license": "MIT"
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"license": "BSD-3-Clause"
@@ -12387,13 +12393,15 @@
}
},
"node_modules/posthog-node": {
"version": "4.8.1",
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-5.7.0.tgz",
"integrity": "sha512-6J1AIZWtbr2lEbZOO2AzO/h1FPJjUZM4KWcdaL2UQw7FY8J7VNaH3NiaRockASFmglpID7zEY25gV/YwCtuXjg==",
"license": "MIT",
"dependencies": {
"axios": "^1.7.4"
"@posthog/core": "1.0.0"
},
"engines": {
"node": ">=15.0.0"
"node": ">=20"
}
},
"node_modules/prebuild-install": {
+1 -1
View File
@@ -479,7 +479,7 @@
"p-timeout": "^6.1.4",
"p-wait-for": "^5.0.2",
"pdf-parse": "^1.1.1",
"posthog-node": "^4.8.1",
"posthog-node": "^5.7.0",
"puppeteer-chromium-resolver": "^23.0.0",
"puppeteer-core": "^23.4.0",
"reconnecting-eventsource": "^1.6.4",
+37 -2
View File
@@ -1,4 +1,4 @@
import { PostHog } from "posthog-node"
import { EventMessage, PostHog } from "posthog-node"
import { v4 as uuidv4 } from "uuid"
import * as vscode from "vscode"
import { posthogConfig } from "../../shared/services/config/posthog-config"
@@ -16,6 +16,39 @@ interface TelemetrySettings {
level?: "all" | "off" | "error" | "crash"
}
/**
* Filters PostHog events before they are sent.
* For exceptions, we only capture those from the Cline extension.
*/
function posthogEventFilter(event: EventMessage | null) {
// Only capture exceptions from the Cline extension
if (!event || event?.event !== "$exception") {
return event
}
const exceptionList = event.properties?.["$exception_list"]
if (!exceptionList?.length) {
return null
}
// Check if any exception is from Cline
for (let i = 0; i < exceptionList.length; i++) {
const stacktrace = exceptionList[i].stacktrace
// Fast check: error message contains "cline"
if (stacktrace?.value?.toLowerCase().includes("cline")) {
return event
}
// Check stack frames for Cline extension path
const frames = stacktrace?.frames
if (frames?.length) {
for (let j = 0; j < frames.length; j++) {
if (frames[j]?.filename?.includes("saoudrizwan")) {
return event
}
}
}
}
return null
}
export class PostHogClientProvider {
private static _instance: PostHogClientProvider | null = null
@@ -40,8 +73,10 @@ export class PostHogClientProvider {
private constructor(public distinctId = ENV_ID) {
// Initialize PostHog client
this.client = new PostHog(posthogConfig.apiKey, {
this.client = new PostHog(posthogConfig.apiKey || "no-op", {
host: posthogConfig.host,
before_send: (event) => posthogEventFilter(event),
enableExceptionAutocapture: true,
})
vscode.env.onDidChangeTelemetryEnabled((isTelemetryEnabled) => {
+2 -2
View File
@@ -1,13 +1,13 @@
// Public PostHog key (safe for open source)
const posthogProdConfig = {
apiKey: "phc_qfOAGxZw2TL5O8p9KYd9ak3bPBFzfjC8fy5L6jNWY7K",
apiKey: process?.env?.POSTHOG_PROD_API_KEY,
host: "https://data.cline.bot",
uiHost: "https://us.posthog.com",
}
// Public PostHog key for Development Environment project
const posthogDevEnvConfig = {
apiKey: "phc_uY24EJXNBcc9kwO1K8TJUl5hPQntGM6LL1Mtrz0CBD4",
apiKey: process?.env?.POSTHOG_DEV_API_KEY,
host: "https://data.cline.bot",
uiHost: "https://us.i.posthog.com",
}