Skip to content

Commit 6e04869

Browse files
committed
Merge branch 'main' into warren/revisit-log-parsing-logic
2 parents 479ee8f + 5ddd5dd commit 6e04869

37 files changed

+83
-74
lines changed

packages/browser/.eslintrc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@
1010
"sourceType": "module",
1111
"ecmaVersion": 2020
1212
},
13-
"plugins": ["@typescript-eslint", "jest"],
13+
"plugins": ["@typescript-eslint", "jest", "prettier", "simple-import-sort"],
1414
"extends": [
1515
"eslint:recommended",
1616
"plugin:@typescript-eslint/recommended",
1717
"plugin:jest/recommended",
18-
"prettier"
18+
"plugin:prettier/recommended"
1919
],
2020
"rules": {
21-
// The following rule is enabled only to supplement the inline suppression
22-
// examples, and because it is not a recommended rule, you should either
23-
// disable it, or understand what it enforces.
24-
// https://typescript-eslint.io/rules/explicit-function-return-type/
25-
"@typescript-eslint/explicit-function-return-type": "warn"
21+
"@typescript-eslint/explicit-function-return-type": "warn",
22+
"prettier/prettier": "error",
23+
"simple-import-sort/exports": "error",
24+
"simple-import-sort/imports": "error"
2625
}
2726
}

packages/browser/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import type { RumOtelWebConfig } from '@hyperdx/otel-web';
12
import Rum from '@hyperdx/otel-web';
23
import SessionRecorder from '@hyperdx/otel-web-session-recorder';
34
import opentelemetry, { Attributes } from '@opentelemetry/api';
45

56
import { resolveAsyncGlobal } from './utils';
67

7-
import type { RumOtelWebConfig } from '@hyperdx/otel-web';
8-
98
type ErrorBoundaryComponent = any; // TODO: Define ErrorBoundary type
109

1110
type Instrumentations = RumOtelWebConfig['instrumentations'];

packages/instrumentation-exception/.eslintrc.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@
1010
"sourceType": "module",
1111
"ecmaVersion": 2020
1212
},
13-
"plugins": ["@typescript-eslint", "jest"],
13+
"plugins": ["@typescript-eslint", "jest", "prettier", "simple-import-sort"],
1414
"extends": [
1515
"eslint:recommended",
1616
"plugin:@typescript-eslint/recommended",
1717
"plugin:jest/recommended",
18-
"prettier"
18+
"plugin:prettier/recommended"
1919
],
2020
"rules": {
21-
// The following rule is enabled only to supplement the inline suppression
22-
// examples, and because it is not a recommended rule, you should either
23-
// disable it, or understand what it enforces.
24-
// https://typescript-eslint.io/rules/explicit-function-return-type/
2521
"@typescript-eslint/ban-ts-comment": "warn",
2622
"@typescript-eslint/explicit-function-return-type": "warn",
27-
"@typescript-eslint/no-this-alias": "warn"
23+
"@typescript-eslint/no-this-alias": "warn",
24+
"prettier/prettier": "error",
25+
"simple-import-sort/exports": "error",
26+
"simple-import-sort/imports": "error"
2827
}
2928
}

packages/instrumentation-exception/src/browser/eventbuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ function eventFromPlainObject(
8383
type: isEvent(exception)
8484
? exception.constructor.name
8585
: isUnhandledRejection
86-
? 'UnhandledRejection'
87-
: 'Error',
86+
? 'UnhandledRejection'
87+
: 'Error',
8888
value: getNonErrorObjectExceptionValue(exception, {
8989
isUnhandledRejection,
9090
}),

packages/instrumentation-exception/src/browser/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { captureException, withScope } from '@sentry/core';
22
import type { Mechanism, WrappedFunction } from '@sentry/types';
33
import {
4-
GLOBAL_OBJ,
54
addExceptionMechanism,
65
addExceptionTypeValue,
76
addNonEnumerableProperty,
87
getOriginalFunction,
8+
GLOBAL_OBJ,
99
markFunctionWrapped,
1010
} from '@sentry/utils';
1111

packages/instrumentation-exception/src/browser/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import type { ClientOptions, Event, EventHint } from '@sentry/types';
1+
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
2+
import { Attributes, diag, Span, trace, Tracer } from '@opentelemetry/api';
23
import {
34
dedupeIntegration,
45
functionToStringIntegration,
56
inboundFiltersIntegration,
67
prepareEvent,
78
} from '@sentry/core';
8-
import { Attributes, Span, Tracer, diag, trace } from '@opentelemetry/api';
9-
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
9+
import type { ClientOptions, Event, EventHint } from '@sentry/types';
1010

11+
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
12+
import { eventFromUnknownInput } from './eventbuilder';
1113
import { browserApiErrorsIntegration } from './integrations/browserapierrors';
1214
import { contextLinesIntegration } from './integrations/contextlines';
13-
import { defaultStackParser } from './stack-parsers';
14-
import { eventFromUnknownInput } from './eventbuilder';
1515
import { globalHandlersIntegration } from './integrations/globalhandlers';
1616
import { httpContextIntegration } from './integrations/httpcontext';
1717
import { hyperdxIntegration } from './integrations/hyperdx';
1818
import { linkedErrorsIntegration } from './integrations/linkederrors';
19-
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
19+
import { defaultStackParser } from './stack-parsers';
2020

2121
// TODO: does it make sense to have a default tracer here?
2222
const defaultTracer = trace.getTracer(PKG_NAME, PKG_VERSION);

packages/instrumentation-exception/src/browser/instrumentations/HyperDXErrorInstrumentation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import * as shimmer from 'shimmer';
21
import { Span } from '@opentelemetry/api';
32
import {
43
InstrumentationBase,
54
InstrumentationConfig,
65
} from '@opentelemetry/instrumentation';
6+
import * as shimmer from 'shimmer';
77

88
import { recordException } from '../';
9-
import { limitLen, getElementXPath } from './utils';
9+
import { getElementXPath, limitLen } from './utils';
1010

1111
// FIXME take timestamps from events?
1212

@@ -109,8 +109,8 @@ export class HyperDXErrorInstrumentation extends InstrumentationBase {
109109
useful(err.name)
110110
? err.name
111111
: err.constructor && err.constructor.name
112-
? err.constructor.name
113-
: 'Error',
112+
? err.constructor.name
113+
: 'Error',
114114
);
115115
span.setAttribute('error.message', limitLen(msg, MESSAGE_LIMIT));
116116
addStackIfUseful(span, err);

packages/instrumentation-exception/src/browser/integrations/contextlines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { defineIntegration } from '@sentry/core';
22
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
33
import {
4-
GLOBAL_OBJ,
54
addContextToFrame,
5+
GLOBAL_OBJ,
66
stripUrlQueryAndFragment,
77
} from '@sentry/utils';
88

packages/instrumentation-exception/src/browser/integrations/globalhandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { captureEvent, defineIntegration, getClient } from '@sentry/core';
21
import { diag } from '@opentelemetry/api';
2+
import { captureEvent, defineIntegration, getClient } from '@sentry/core';
33
import type {
44
Client,
55
Event,
@@ -8,12 +8,12 @@ import type {
88
StackParser,
99
} from '@sentry/types';
1010
import {
11-
UNKNOWN_FUNCTION,
1211
addGlobalErrorInstrumentationHandler,
1312
addGlobalUnhandledRejectionInstrumentationHandler,
1413
getLocationHref,
1514
isPrimitive,
1615
isString,
16+
UNKNOWN_FUNCTION,
1717
} from '@sentry/utils';
1818

1919
import { eventFromUnknownInput } from '../eventbuilder';

packages/instrumentation-exception/src/browser/integrations/httpcontext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineIntegration } from '@sentry/core';
2+
23
import { WINDOW } from '../helpers';
34

45
/**

packages/instrumentation-exception/src/browser/integrations/hyperdx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
21
import { defineIntegration } from '@sentry/core';
2+
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
33

44
const INTEGRATION_NAME = 'HyperDX';
55

packages/instrumentation-exception/src/browser/integrations/linkederrors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineIntegration } from '@sentry/core';
22
import type { IntegrationFn } from '@sentry/types';
33
import { applyAggregateErrorsToEvent } from '@sentry/utils';
4+
45
import { exceptionFromError } from '../eventbuilder';
56

67
interface LinkedErrorsOptions {

packages/instrumentation-exception/src/browser/stack-parsers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import type {
2828
StackLineParser,
2929
StackLineParserFn,
3030
} from '@sentry/types';
31-
import { UNKNOWN_FUNCTION, createStackParser } from '@sentry/utils';
31+
import { createStackParser, UNKNOWN_FUNCTION } from '@sentry/utils';
3232

3333
const OPERA10_PRIORITY = 10;
3434
const OPERA11_PRIORITY = 20;

packages/instrumentation-exception/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export { recordException } from './node';
21
export * from './instrumentation';
2+
export { recordException } from './node';
33
export * from './types';
44

55
// error handlers

packages/instrumentation-exception/src/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { diag, trace, TracerProvider } from '@opentelemetry/api';
12
import { InstrumentationBase } from '@opentelemetry/instrumentation';
2-
import { TracerProvider, diag, trace } from '@opentelemetry/api';
33

4-
import { ExceptionInstrumentationConfig } from './types';
54
import { name as PKG_NAME, version as PKG_VERSION } from '../package.json';
65
import { onUncaughtExceptionIntegration } from './node/integrations/onuncaughtexception';
76
import { onUnhandledRejectionIntegration } from './node/integrations/onunhandledrejection';
7+
import { ExceptionInstrumentationConfig } from './types';
88

99
/** Exception instrumentation for OpenTelemetry */
1010
export class ExceptionInstrumentation extends InstrumentationBase {

packages/instrumentation-exception/src/node/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1+
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
2+
import { Attributes, diag, Span, trace, Tracer } from '@opentelemetry/api';
3+
import { inboundFiltersIntegration, prepareEvent } from '@sentry/core';
14
import type {
25
Client,
36
ClientOptions,
47
Event,
58
EventHint,
69
Integration,
710
} from '@sentry/types';
8-
import { inboundFiltersIntegration, prepareEvent } from '@sentry/core';
9-
import { Attributes, Span, Tracer, diag, trace } from '@opentelemetry/api';
1011
import { eventFromUnknownInput } from '@sentry/utils';
11-
import { getEventProcessor } from '@hyperdx/instrumentation-sentry-node';
1212

13+
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
14+
import { nodeContextIntegration } from './integrations/context';
1315
import { contextLinesIntegration } from './integrations/contextlines';
14-
import { defaultStackParser } from './sdk/api';
1516
import { hyperdxIntegration } from './integrations/hyperdx';
16-
import { isCjs } from './utils/commonjs';
1717
import { localVariablesIntegration } from './integrations/local-variables';
1818
import { modulesIntegration } from './integrations/modules';
19-
import { nodeContextIntegration } from './integrations/context';
20-
import { name as PKG_NAME, version as PKG_VERSION } from '../../package.json';
19+
import { defaultStackParser } from './sdk/api';
20+
import { isCjs } from './utils/commonjs';
2121

2222
// TODO: does it make sense to have a default tracer here?
2323
const defaultTracer = trace.getTracer(PKG_NAME, PKG_VERSION);

packages/instrumentation-exception/src/node/integrations/context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable max-lines */
22
import { execFile } from 'node:child_process';
3-
import { readFile, readdir } from 'node:fs';
3+
import { readdir, readFile } from 'node:fs';
44
import * as os from 'node:os';
55
import { join } from 'node:path';
66
import { promisify } from 'node:util';
7+
78
import { defineIntegration } from '@sentry/core';
89
import type {
910
AppContext,

packages/instrumentation-exception/src/node/integrations/contextlines.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { promises } from 'node:fs';
2+
23
import { defineIntegration } from '@sentry/core';
34
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
4-
import { LRUMap, addContextToFrame } from '@sentry/utils';
5+
import { addContextToFrame, LRUMap } from '@sentry/utils';
56

67
const FILE_CONTENT_CACHE = new LRUMap<string, string[] | null>(100);
78
const DEFAULT_LINES_OF_CONTEXT = 7;

packages/instrumentation-exception/src/node/integrations/hyperdx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Event, IntegrationFn } from '@sentry/types';
21
import { defineIntegration } from '@sentry/core';
2+
import type { Event, IntegrationFn } from '@sentry/types';
33

44
import { getSentryRelease } from '../sdk/api';
55

packages/instrumentation-exception/src/node/integrations/local-variables/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Debugger } from 'node:inspector';
2+
23
import type { StackFrame, StackParser } from '@sentry/types';
34

45
export type Variables = Record<string, unknown>;

packages/instrumentation-exception/src/node/integrations/local-variables/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Integration } from '@sentry/types';
2+
23
import { NODE_VERSION } from '../../nodeVersion';
34
import type { LocalVariablesIntegrationOptions } from './common';
45
import { localVariablesAsyncIntegration } from './local-variables-async';

packages/instrumentation-exception/src/node/integrations/local-variables/local-variables-async.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Worker } from 'node:worker_threads';
2+
23
import { defineIntegration } from '@sentry/core';
34
import type { Event, Exception, IntegrationFn } from '@sentry/types';
4-
import { LRUMap, logger } from '@sentry/utils';
5+
import { logger, LRUMap } from '@sentry/utils';
56

67
import type {
78
FrameVariables,

packages/instrumentation-exception/src/node/integrations/local-variables/local-variables-sync.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ import type {
44
Runtime,
55
Session,
66
} from 'node:inspector';
7+
78
import { defineIntegration } from '@sentry/core';
89
import type {
910
Event,
1011
Exception,
1112
IntegrationFn,
1213
StackParser,
1314
} from '@sentry/types';
14-
import { LRUMap, logger } from '@sentry/utils';
15+
import { logger, LRUMap } from '@sentry/utils';
1516

1617
import { NODE_MAJOR } from '../../nodeVersion';
18+
import { defaultStackParser } from '../../sdk/api';
1719
import type {
1820
FrameVariables,
1921
LocalVariablesIntegrationOptions,
@@ -27,7 +29,6 @@ import {
2729
hashFrames,
2830
hashFromStack,
2931
} from './common';
30-
import { defaultStackParser } from '../../sdk/api';
3132

3233
type OnPauseEvent = InspectorNotification<Debugger.PausedEventDataType>;
3334
export interface DebugSession {

packages/instrumentation-exception/src/node/integrations/local-variables/worker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { Debugger, InspectorNotification, Runtime } from 'node:inspector';
22
import { Session } from 'node:inspector/promises';
33
import { parentPort, workerData } from 'node:worker_threads';
4+
45
import type { StackParser } from '@sentry/types';
56
import { createStackParser, nodeStackLineParser } from '@sentry/utils';
7+
68
import { createGetModuleFromFilename } from '../../utils/module';
79
import type {
810
LocalVariablesWorkerArgs,

packages/instrumentation-exception/src/node/integrations/modules.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { existsSync, readFileSync } from 'node:fs';
22
import { dirname, join } from 'node:path';
3+
34
import { defineIntegration } from '@sentry/core';
45
import type { IntegrationFn } from '@sentry/types';
56

packages/instrumentation-exception/src/node/integrations/onuncaughtexception.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { defineIntegration } from '@sentry/core';
21
import { diag } from '@opentelemetry/api';
2+
import { defineIntegration } from '@sentry/core';
33

4-
import { logAndExitProcess } from '../utils/errorhandling';
54
import { recordException } from '..';
5+
import { logAndExitProcess } from '../utils/errorhandling';
66

77
type OnFatalErrorHandler = typeof logAndExitProcess;
88

packages/instrumentation-exception/src/node/integrations/onunhandledrejection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { diag } from '@opentelemetry/api';
2+
import { defineIntegration } from '@sentry/core';
13
import type { IntegrationFn } from '@sentry/types';
24
import { consoleSandbox } from '@sentry/utils';
3-
import { defineIntegration } from '@sentry/core';
4-
import { diag } from '@opentelemetry/api';
55

6-
import { logAndExitProcess } from '../utils/errorhandling';
76
import { recordException } from '..';
7+
import { logAndExitProcess } from '../utils/errorhandling';
88

99
export type UnhandledRejectionMode = 'none' | 'warn' | 'strict';
1010

packages/instrumentation-exception/src/node/sdk/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import type { StackParser } from '@sentry/types';
44
import {
5-
GLOBAL_OBJ,
65
createStackParser,
6+
GLOBAL_OBJ,
77
nodeStackLineParser,
88
} from '@sentry/utils';
9+
910
import { createGetModuleFromFilename } from '../utils/module';
1011

1112
/**

packages/instrumentation-exception/src/node/utils/errorhandling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { consoleSandbox } from '@sentry/utils';
21
import { diag } from '@opentelemetry/api';
2+
import { consoleSandbox } from '@sentry/utils';
33

44
const DEFAULT_SHUTDOWN_TIMEOUT = 2000;
55

0 commit comments

Comments
 (0)