Skip to content

Commit cf84c54

Browse files
committed
Some cleanup
1 parent 7865a2c commit cf84c54

File tree

13 files changed

+61
-51
lines changed

13 files changed

+61
-51
lines changed

packages/node-core/src/otel/instrument.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function generateInstrumentOnce<
2525
*/
2626
export function generateInstrumentOnce<Options>(
2727
name: string,
28+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2829
creatorOrClass: (new (...args: any[]) => Instrumentation) | ((options?: Options) => Instrumentation),
2930
optionsCallback?: (options: Options) => unknown,
3031
): ((options: Options) => Instrumentation) & { id: string } {

packages/node-core/src/proxy/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
3030
/* eslint-disable @typescript-eslint/no-unused-vars */
31+
// eslint-disable-next-line import/no-duplicates
3132
import type * as http from 'node:http';
33+
// eslint-disable-next-line import/no-duplicates
3234
import type { OutgoingHttpHeaders } from 'node:http';
3335
import * as net from 'node:net';
3436
import * as tls from 'node:tls';

packages/node-core/test/helpers/mockSdkInit.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import { context, propagation, ProxyTracerProvider, trace } from '@opentelemetry/api';
22
import { Resource } from '@opentelemetry/resources';
33
import { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';
4-
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, SEMRESATTRS_SERVICE_NAMESPACE } from '@opentelemetry/semantic-conventions';
5-
import { createTransport, getClient, getCurrentScope, getGlobalScope, getIsolationScope, logger, resolvedSyncPromise, SDK_VERSION } from '@sentry/core';
4+
import {
5+
ATTR_SERVICE_NAME,
6+
ATTR_SERVICE_VERSION,
7+
SEMRESATTRS_SERVICE_NAMESPACE,
8+
} from '@opentelemetry/semantic-conventions';
9+
import {
10+
createTransport,
11+
getClient,
12+
getCurrentScope,
13+
getGlobalScope,
14+
getIsolationScope,
15+
logger,
16+
resolvedSyncPromise,
17+
SDK_VERSION,
18+
} from '@sentry/core';
619
import { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry';
720
import type { NodeClient } from '../../src';
821
import { SentryContextManager, validateOpenTelemetrySetup } from '../../src';
@@ -98,7 +111,6 @@ export function mockSdkInit(options?: Partial<NodeClientOptions>) {
98111
return client;
99112
}
100113

101-
102114
export function cleanupOtel(_provider?: BasicTracerProvider): void {
103115
const provider = getProvider(_provider);
104116

packages/node-core/test/integration/breadcrumbs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,4 @@ describe('Integration | breadcrumbs', () => {
355355
},
356356
);
357357
});
358-
});
358+
});

packages/node-core/test/integration/scope.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('Integration | Scope', () => {
1616
const beforeSend = vi.fn(() => null);
1717
const beforeSendTransaction = vi.fn(() => null);
1818

19-
const client = tracingEnabled
19+
const client = tracingEnabled
2020
? mockSdkInit({ tracesSampleRate: 1, beforeSend, beforeSendTransaction })
2121
: mockSdkInit({ beforeSend, beforeSendTransaction });
2222

@@ -135,7 +135,7 @@ describe('Integration | Scope', () => {
135135
const beforeSend = vi.fn(() => null);
136136
const beforeSendTransaction = vi.fn(() => null);
137137

138-
const client = tracingEnabled
138+
const client = tracingEnabled
139139
? mockSdkInit({ tracesSampleRate: 1, beforeSend, beforeSendTransaction })
140140
: mockSdkInit({ beforeSend, beforeSendTransaction });
141141

@@ -583,4 +583,4 @@ describe('Integration | Scope', () => {
583583
);
584584
});
585585
});
586-
});
586+
});

packages/node-core/test/sdk/api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ describe('withActiveSpan()', () => {
101101
expect.anything(),
102102
);
103103
});
104-
});
104+
});

packages/node-core/test/sdk/init.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Integration } from '@sentry/core';
22
import { logger } from '@sentry/core';
33
import * as SentryOpentelemetry from '@sentry/opentelemetry';
4-
import { type Mock, type MockInstance, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4+
import { type Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
55
import { getClient } from '../../src/';
66
import { init, validateOpenTelemetrySetup } from '../../src/sdk';
77
import { NodeClient } from '../../src/sdk/client';
@@ -85,10 +85,8 @@ describe('init()', () => {
8585
expect(mockDefaultIntegrations[1]?.setupOnce as Mock).toHaveBeenCalledTimes(0);
8686
expect(newIntegration.setupOnce as Mock).toHaveBeenCalledTimes(1);
8787
});
88-
8988
});
9089

91-
9290
it('returns initialized client', () => {
9391
const client = init({ dsn: PUBLIC_DSN, skipOpenTelemetrySetup: true });
9492

packages/node/src/index.ts

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,6 @@ import { logger } from '@sentry/node-core';
33
export { httpIntegration } from './integrations/http';
44
export { nativeNodeFetchIntegration } from './integrations/node-fetch';
55
export { fsIntegration } from './integrations/fs';
6-
7-
export {
8-
nodeContextIntegration,
9-
contextLinesIntegration,
10-
localVariablesIntegration,
11-
modulesIntegration,
12-
onUncaughtExceptionIntegration,
13-
onUnhandledRejectionIntegration,
14-
anrIntegration,
15-
disableAnrDetectionForCallback,
16-
spotlightIntegration,
17-
childProcessIntegration,
18-
createSentryWinstonTransport,
19-
SentryContextManager,
20-
generateInstrumentOnce,
21-
instrumentWhenWrapped,
22-
INSTRUMENTED,
23-
getSentryRelease,
24-
defaultStackParser,
25-
createGetModuleFromFilename,
26-
makeNodeTransport,
27-
NodeClient,
28-
cron,
29-
NODE_VERSION,
30-
validateOpenTelemetrySetup,
31-
addOriginToSpan,
32-
getRequestUrl,
33-
isCjs,
34-
ensureIsWrapped,
35-
createMissingInstrumentationContext,
36-
envToBool,
37-
} from '@sentry/node-core';
38-
396
export { expressIntegration, expressErrorHandler, setupExpressErrorHandler } from './integrations/tracing/express';
407
export { fastifyIntegration, setupFastifyErrorHandler } from './integrations/tracing/fastify';
418
export { graphqlIntegration } from './integrations/tracing/graphql';
@@ -173,4 +140,36 @@ export type {
173140
FeatureFlagsIntegration,
174141
} from '@sentry/core';
175142

143+
export {
144+
nodeContextIntegration,
145+
contextLinesIntegration,
146+
localVariablesIntegration,
147+
modulesIntegration,
148+
onUncaughtExceptionIntegration,
149+
onUnhandledRejectionIntegration,
150+
anrIntegration,
151+
disableAnrDetectionForCallback,
152+
spotlightIntegration,
153+
childProcessIntegration,
154+
createSentryWinstonTransport,
155+
SentryContextManager,
156+
generateInstrumentOnce,
157+
instrumentWhenWrapped,
158+
INSTRUMENTED,
159+
getSentryRelease,
160+
defaultStackParser,
161+
createGetModuleFromFilename,
162+
makeNodeTransport,
163+
NodeClient,
164+
cron,
165+
NODE_VERSION,
166+
validateOpenTelemetrySetup,
167+
addOriginToSpan,
168+
getRequestUrl,
169+
isCjs,
170+
ensureIsWrapped,
171+
createMissingInstrumentationContext,
172+
envToBool,
173+
} from '@sentry/node-core';
174+
176175
export { logger };

packages/node/src/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ import { init } from './sdk';
66
*
77
* > SENTRY_DSN=https://[email protected]/0 SENTRY_TRACES_SAMPLE_RATE=1.0 node --import=@sentry/node/init app.mjs
88
*/
9-
init();
9+
init();

packages/node/test/integrations/tracing/graphql.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';
22
import { type MockInstance, beforeEach, describe, expect, it, vi } from 'vitest';
3-
import { graphqlIntegration, instrumentGraphql } from '../../../src/integrations/tracing/graphql';
43
import { INSTRUMENTED } from '../../../src/index';
4+
import { graphqlIntegration, instrumentGraphql } from '../../../src/integrations/tracing/graphql';
55

66
vi.mock('@opentelemetry/instrumentation-graphql');
77

packages/node/test/integrations/tracing/koa.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';
22
import { type MockInstance, beforeEach, describe, expect, it, vi } from 'vitest';
3-
import { instrumentKoa, koaIntegration } from '../../../src/integrations/tracing/koa';
43
import { INSTRUMENTED } from '../../../src/index';
4+
import { instrumentKoa, koaIntegration } from '../../../src/integrations/tracing/koa';
55

66
vi.mock('@opentelemetry/instrumentation-koa');
77

packages/node/test/integrations/tracing/mongo.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
22
import { type MockInstance, beforeEach, describe, expect, it, vi } from 'vitest';
3+
import { INSTRUMENTED } from '../../../src/index';
34
import {
45
_defaultDbStatementSerializer,
56
instrumentMongo,
67
mongoIntegration,
78
} from '../../../src/integrations/tracing/mongo';
8-
import { INSTRUMENTED } from '../../../src/index';
99

1010
vi.mock('@opentelemetry/instrumentation-mongodb');
1111

packages/node/test/sdk/init.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import type { Integration } from '@sentry/core';
22
import { logger } from '@sentry/core';
33
import * as SentryOpentelemetry from '@sentry/opentelemetry';
44
import { type Mock, type MockInstance, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5-
import { getClient } from '../../src/';
5+
import { getClient, NodeClient, validateOpenTelemetrySetup } from '../../src/';
66
import * as auto from '../../src/integrations/tracing';
77
import { init } from '../../src/sdk';
8-
import { validateOpenTelemetrySetup } from '../../src/index';
9-
import { NodeClient } from '../../src/index';
108
import { cleanupOtel } from '../helpers/mockSdkInit';
119

1210
// eslint-disable-next-line no-var

0 commit comments

Comments
 (0)