sentry-vir 4.3.0 → 4.3.1
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractErrorMessage } from '@augment-vir/common';
|
|
2
2
|
import { convertEventDetailsToSentryContext, } from '../event-context/event-context.js';
|
|
3
3
|
import { EventSeverityEnum } from '../event-context/event-severity.js';
|
|
4
|
-
import { extractExtraAttachmentsFromSymbol, extractExtraEventThrottleThreshold, } from '../event-context/extra-event-context.js';
|
|
4
|
+
import { extractExtraAttachmentsFromSymbol, extractExtraEventThrottleThreshold, extractExtraTagsFromSymbol, } from '../event-context/extra-event-context.js';
|
|
5
5
|
import { LoggingState, logToConsoleWithoutSentry } from '../processing/log-to-console.js';
|
|
6
6
|
import { skipBeforeSendThrottleContextKey } from '../processing/throttling.js';
|
|
7
7
|
import { addPrematureEvent } from './premature-events.js';
|
|
@@ -41,8 +41,20 @@ function internalHandleError(error, eventOptions, options) {
|
|
|
41
41
|
const perCallThrottleThreshold = perCallThresholdCandidates.length
|
|
42
42
|
? Math.min(...perCallThresholdCandidates)
|
|
43
43
|
: undefined;
|
|
44
|
+
const symbolTags = extractExtraTagsFromSymbol(error);
|
|
45
|
+
const combinedTags = symbolTags == undefined && eventOptions?.tags == undefined
|
|
46
|
+
? undefined
|
|
47
|
+
: {
|
|
48
|
+
...symbolTags,
|
|
49
|
+
...eventOptions?.tags,
|
|
50
|
+
};
|
|
44
51
|
if (checkActiveThrottle({
|
|
45
52
|
message: extractErrorMessage(error),
|
|
53
|
+
...(combinedTags
|
|
54
|
+
? {
|
|
55
|
+
tags: combinedTags,
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
46
58
|
}, {
|
|
47
59
|
originalException: error,
|
|
48
60
|
}, perCallThrottleThreshold)) {
|
|
@@ -23,7 +23,7 @@ export declare const sendLog: {
|
|
|
23
23
|
*
|
|
24
24
|
* @category Internal
|
|
25
25
|
*/
|
|
26
|
-
export declare function throttleEventWithLogging(event: Pick<TransactionEvent | ErrorEvent, 'message'>, hint: Readonly<Pick<EventHint, 'originalException'>> | undefined, options: Readonly<PartialWithUndefined<ThrottleOptions>>): boolean;
|
|
26
|
+
export declare function throttleEventWithLogging(event: Pick<TransactionEvent | ErrorEvent, 'message' | 'tags'>, hint: Readonly<Pick<EventHint, 'originalException'>> | undefined, options: Readonly<PartialWithUndefined<ThrottleOptions>>): boolean;
|
|
27
27
|
/**
|
|
28
28
|
* Synchronous pre-capture throttle check used by `sendLog` and `handleError`. Returns `true` when
|
|
29
29
|
* the event should be dropped. Returns `false` (i.e. "send it") when no active throttle options
|
|
@@ -31,6 +31,6 @@ export declare function throttleEventWithLogging(event: Pick<TransactionEvent |
|
|
|
31
31
|
*
|
|
32
32
|
* @category Internal
|
|
33
33
|
*/
|
|
34
|
-
export declare function checkActiveThrottle(event: Pick<TransactionEvent | ErrorEvent, 'message'>, hint: Readonly<Pick<EventHint, 'originalException'>> | undefined, perCallThreshold: number | undefined): boolean;
|
|
34
|
+
export declare function checkActiveThrottle(event: Pick<TransactionEvent | ErrorEvent, 'message' | 'tags'>, hint: Readonly<Pick<EventHint, 'originalException'>> | undefined, perCallThreshold: number | undefined): boolean;
|
|
35
35
|
declare function sendLogToSentry(logInfo: SendLogInfo, eventDetails: EventDetails, options: ContextOptions, perCallThrottleThreshold: number | undefined): string | undefined;
|
|
36
36
|
export {};
|
package/dist/logging/send-log.js
CHANGED
|
@@ -28,14 +28,16 @@ export function throttleEventWithLogging(event, hint, options) {
|
|
|
28
28
|
const result = shouldThrottleEvent(event, hint, options);
|
|
29
29
|
const disableLog = options.disableThrottleLog ?? defaultThrottleOptions.disableThrottleLog;
|
|
30
30
|
if (!disableLog && result.errorKey != undefined) {
|
|
31
|
+
const inheritedTags = {
|
|
32
|
+
...event.tags,
|
|
33
|
+
suppressedErrorKey: result.errorKey,
|
|
34
|
+
};
|
|
31
35
|
if (result.transition.kind === 'started') {
|
|
32
36
|
sendLog.warning(`Throttling started: ${result.errorKey}`, {
|
|
33
37
|
context: {
|
|
34
38
|
suppressedErrorKey: result.errorKey,
|
|
35
39
|
},
|
|
36
|
-
tags:
|
|
37
|
-
suppressedErrorKey: result.errorKey,
|
|
38
|
-
},
|
|
40
|
+
tags: inheritedTags,
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
else if (result.transition.kind === 'ended') {
|
|
@@ -44,9 +46,7 @@ export function throttleEventWithLogging(event, hint, options) {
|
|
|
44
46
|
suppressedErrorKey: result.errorKey,
|
|
45
47
|
suppressedCount: result.transition.suppressedCount,
|
|
46
48
|
},
|
|
47
|
-
tags:
|
|
48
|
-
suppressedErrorKey: result.errorKey,
|
|
49
|
-
},
|
|
49
|
+
tags: inheritedTags,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -111,6 +111,11 @@ function sendLogToSentry(logInfo, eventDetails, options, perCallThrottleThreshol
|
|
|
111
111
|
: extractOriginalMessage(resolvedLogInfo, undefined);
|
|
112
112
|
if (checkActiveThrottle({
|
|
113
113
|
message: throttleMessage,
|
|
114
|
+
...(eventDetails.tags
|
|
115
|
+
? {
|
|
116
|
+
tags: eventDetails.tags,
|
|
117
|
+
}
|
|
118
|
+
: {}),
|
|
114
119
|
}, undefined, perCallThrottleThreshold)) {
|
|
115
120
|
return undefined;
|
|
116
121
|
}
|