posthog-node 5.46.0 → 5.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/error-tracking/index.d.ts.map +1 -1
- package/dist/extensions/error-tracking/index.js +2 -0
- package/dist/extensions/error-tracking/index.mjs +7 -5
- package/dist/extensions/sentry-integration.d.ts.map +1 -1
- package/dist/extensions/sentry-integration.js +5 -2
- package/dist/extensions/sentry-integration.mjs +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +2 -2
- package/src/extensions/error-tracking/index.ts +5 -0
- package/src/extensions/sentry-integration.ts +6 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/error-tracking/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,4BAA4B,CAAS;IAC7C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;IAwBlF,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO;WAIxC,iBAAiB,CAC5B,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,EACjD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,iBAAiB,CAAC,SAAS,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAClD,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/error-tracking/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,4BAA4B,CAAS;IAC7C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;IAwBlF,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO;WAIxC,iBAAiB,CAC5B,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,EACjD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,iBAAiB,CAAC,SAAS,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAClD,OAAO,CAAC,YAAY,CAAC;IAwBxB,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,WAAW;YAwBL,YAAY;IAM1B,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,IAAI;CAGjB"}
|
|
@@ -50,6 +50,8 @@ class ErrorTracking {
|
|
|
50
50
|
};
|
|
51
51
|
const exceptionProperties = builder.buildFromUnknown(error, hint);
|
|
52
52
|
exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
|
|
53
|
+
const injectedReleaseId = core_namespaceObject.ErrorTracking.getInjectedReleaseId();
|
|
54
|
+
if (injectedReleaseId) properties.$release_id = injectedReleaseId;
|
|
53
55
|
return {
|
|
54
56
|
event: '$exception',
|
|
55
57
|
distinctId: distinctId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addUncaughtExceptionListener, addUnhandledRejectionListener } from "./autocapture.mjs";
|
|
2
|
-
import { BucketedRateLimiter, isObject, resolveExceptionRateLimiterConfig } from "@posthog/core";
|
|
2
|
+
import { BucketedRateLimiter, ErrorTracking, isObject, resolveExceptionRateLimiterConfig } from "@posthog/core";
|
|
3
3
|
const SHUTDOWN_TIMEOUT = 2000;
|
|
4
|
-
class
|
|
4
|
+
class error_tracking_ErrorTracking {
|
|
5
5
|
constructor(client, options, _logger){
|
|
6
6
|
this.client = client;
|
|
7
7
|
this._exceptionAutocaptureEnabled = options.enableExceptionAutocapture || false;
|
|
@@ -22,6 +22,8 @@ class ErrorTracking {
|
|
|
22
22
|
};
|
|
23
23
|
const exceptionProperties = builder.buildFromUnknown(error, hint);
|
|
24
24
|
exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
|
|
25
|
+
const injectedReleaseId = ErrorTracking.getInjectedReleaseId();
|
|
26
|
+
if (injectedReleaseId) properties.$release_id = injectedReleaseId;
|
|
25
27
|
return {
|
|
26
28
|
event: '$exception',
|
|
27
29
|
distinctId: distinctId,
|
|
@@ -40,8 +42,8 @@ class ErrorTracking {
|
|
|
40
42
|
}
|
|
41
43
|
onException(exception, hint) {
|
|
42
44
|
this.client.addPendingPromise((async ()=>{
|
|
43
|
-
if (!
|
|
44
|
-
const eventMessage = await
|
|
45
|
+
if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(exception)) {
|
|
46
|
+
const eventMessage = await error_tracking_ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
|
|
45
47
|
const exceptionProperties = eventMessage.properties;
|
|
46
48
|
const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? 'Exception';
|
|
47
49
|
const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
|
|
@@ -64,4 +66,4 @@ class ErrorTracking {
|
|
|
64
66
|
this._rateLimiter.stop();
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
export {
|
|
69
|
+
export { error_tracking_ErrorTracking as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-integration.d.ts","sourceRoot":"","sources":["../../src/extensions/sentry-integration.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAiBrD,KAAK,YAAY,GAAG,GAAG,CAAA;AACvB,KAAK,qBAAqB,GAAG,GAAG,CAAA;AAEhC,KAAK,UAAU,GAAG,GAAG,CAAA;AAGrB,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAAA;CAChD;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,GAAG,IAAI,CAAA;CACrH;AAWD,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAA;IAC3D,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC,CA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MAAM,EACN,iBAA6B,EAC7B,uBAA8B,GAC/B,GAAE,wBAA6B,GAC/B,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,CAgFvC;AAGD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,wBAAwB,GACjC,kBAAkB,CAQpB;AAGD;;;;;GAKG;AACH,qBAAa,wBAAyB,YAAW,uBAAuB;IACtE,SAAgB,IAAI,kBAAO;IAE3B,gBAAuB,cAAc,yBAAwB;IAEtD,SAAS,EAAE,CAChB,uBAAuB,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,EAClE,aAAa,EAAE,MAAM,UAAU,KAC5B,IAAI,CAAA;gBAGP,QAAQ,EAAE,oBAAoB,EAC9B,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,EAC3D,uBAAuB,CAAC,EAAE,OAAO;CAoBpC"}
|
|
@@ -24,10 +24,11 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
sentryIntegration: ()=>sentryIntegration,
|
|
27
28
|
PostHogSentryIntegration: ()=>PostHogSentryIntegration,
|
|
28
|
-
createEventProcessor: ()=>createEventProcessor
|
|
29
|
-
sentryIntegration: ()=>sentryIntegration
|
|
29
|
+
createEventProcessor: ()=>createEventProcessor
|
|
30
30
|
});
|
|
31
|
+
const core_namespaceObject = require("@posthog/core");
|
|
31
32
|
const NAME = 'posthog-node';
|
|
32
33
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
33
34
|
'error'
|
|
@@ -64,6 +65,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
|
|
|
64
65
|
$sentry_exception_type: exceptions[0]?.type,
|
|
65
66
|
$sentry_tags: event.tags
|
|
66
67
|
};
|
|
68
|
+
const injectedReleaseId = core_namespaceObject.ErrorTracking.getInjectedReleaseId();
|
|
69
|
+
if (injectedReleaseId) properties.$release_id = injectedReleaseId;
|
|
67
70
|
if (organization && projectId) properties['$sentry_url'] = (prefix || 'https://sentry.io/organizations/') + organization + '/issues/?project=' + projectId + '&query=' + event.event_id;
|
|
68
71
|
if (sendExceptionsToPostHog) _posthog.capture({
|
|
69
72
|
event: '$exception',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ErrorTracking } from "@posthog/core";
|
|
1
2
|
const NAME = 'posthog-node';
|
|
2
3
|
function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
|
|
3
4
|
'error'
|
|
@@ -34,6 +35,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
|
|
|
34
35
|
$sentry_exception_type: exceptions[0]?.type,
|
|
35
36
|
$sentry_tags: event.tags
|
|
36
37
|
};
|
|
38
|
+
const injectedReleaseId = ErrorTracking.getInjectedReleaseId();
|
|
39
|
+
if (injectedReleaseId) properties.$release_id = injectedReleaseId;
|
|
37
40
|
if (organization && projectId) properties['$sentry_url'] = (prefix || 'https://sentry.io/organizations/') + organization + '/issues/?project=' + projectId + '&query=' + event.event_id;
|
|
38
41
|
if (sendExceptionsToPostHog) _posthog.capture({
|
|
39
42
|
event: '$exception',
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.47.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
version: ()=>version
|
|
28
28
|
});
|
|
29
|
-
const version = '5.
|
|
29
|
+
const version = '5.47.0';
|
|
30
30
|
exports.version = __webpack_exports__.version;
|
|
31
31
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
32
32
|
"version"
|
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '5.
|
|
1
|
+
const version = '5.47.0';
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-node",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.47.0",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"module": "dist/entrypoints/index.node.mjs",
|
|
29
29
|
"types": "dist/entrypoints/index.node.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@posthog/core": "^1.
|
|
31
|
+
"@posthog/core": "^1.46.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@edge-runtime/jest-environment": "^4.0.0",
|
|
@@ -54,6 +54,11 @@ export default class ErrorTracking {
|
|
|
54
54
|
const exceptionProperties = builder.buildFromUnknown(error, hint)
|
|
55
55
|
exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list)
|
|
56
56
|
|
|
57
|
+
const injectedReleaseId = CoreErrorTracking.getInjectedReleaseId()
|
|
58
|
+
if (injectedReleaseId) {
|
|
59
|
+
properties.$release_id = injectedReleaseId
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
return {
|
|
58
63
|
event: '$exception',
|
|
59
64
|
// Leave distinctId resolution to prepareEventMessage which checks request context
|
|
@@ -138,6 +138,7 @@ export function createEventProcessor(
|
|
|
138
138
|
$exception_type: any
|
|
139
139
|
$exception_list: any
|
|
140
140
|
$exception_level: CoreErrorTracking.SeverityLevel
|
|
141
|
+
$release_id?: string
|
|
141
142
|
} = {
|
|
142
143
|
// PostHog Exception Properties,
|
|
143
144
|
$exception_message: exceptions[0]?.value || event.message,
|
|
@@ -152,6 +153,11 @@ export function createEventProcessor(
|
|
|
152
153
|
$sentry_tags: event.tags,
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
const injectedReleaseId = CoreErrorTracking.getInjectedReleaseId()
|
|
157
|
+
if (injectedReleaseId) {
|
|
158
|
+
properties.$release_id = injectedReleaseId
|
|
159
|
+
}
|
|
160
|
+
|
|
155
161
|
if (organization && projectId) {
|
|
156
162
|
properties['$sentry_url'] =
|
|
157
163
|
(prefix || 'https://sentry.io/organizations/') +
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.47.0'
|