Skip to content

Commit f2f387c

Browse files
committed
chore: fix formatting
1 parent 402bd0e commit f2f387c

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

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

+9-10
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ function _scrubStatement(value: unknown): unknown {
3333

3434
if (isCommandObj(value)) {
3535
const initial: Record<string, unknown> = {};
36-
return Object.entries(value).map(([key, element]) => [
37-
key,
38-
_scrubStatement(element),
39-
]).reduce((prev, current) => {
40-
if (isCommandEntry(current)) {
41-
prev[current[0]] = current[1];
42-
}
43-
return prev;
44-
}, initial);
36+
return Object.entries(value)
37+
.map(([key, element]) => [key, _scrubStatement(element)])
38+
.reduce((prev, current) => {
39+
if (isCommandEntry(current)) {
40+
prev[current[0]] = current[1];
41+
}
42+
return prev;
43+
}, initial);
4544
}
4645

4746
// A value like string or number, possible contains PII, scrub it
@@ -60,7 +59,7 @@ function isBuffer(value: unknown): boolean {
6059
return isBuffer;
6160
}
6261

63-
function isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {
62+
function isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {
6463
return Array.isArray(value);
6564
}
6665

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
22

3-
import { mongoIntegration, instrumentMongo, _defaultDbStatementSerializer } from '../../../src/integrations/tracing/mongo';
3+
import {
4+
_defaultDbStatementSerializer,
5+
instrumentMongo,
6+
mongoIntegration,
7+
} from '../../../src/integrations/tracing/mongo';
48
import { INSTRUMENTED } from '../../../src/otel/instrument';
59

610
jest.mock('@opentelemetry/instrumentation-mongodb');
@@ -37,30 +41,30 @@ describe('Mongo', () => {
3741
expect(MongoDBInstrumentation).toHaveBeenCalledTimes(1);
3842
expect(MongoDBInstrumentation).toHaveBeenCalledWith({
3943
responseHook: expect.any(Function),
40-
dbStatementSerializer: expect.any(Function)
44+
dbStatementSerializer: expect.any(Function),
4145
});
4246
});
4347

4448
describe('_defaultDbStatementSerializer', () => {
4549
it('rewrites strings as ?', () => {
4650
const serialized = _defaultDbStatementSerializer({
47-
find: 'foo'
51+
find: 'foo',
4852
});
4953
expect(JSON.parse(serialized).find).toBe('?');
5054
});
5155

5256
it('rewrites nested strings as ?', () => {
5357
const serialized = _defaultDbStatementSerializer({
5458
find: {
55-
inner: 'foo'
56-
}
59+
inner: 'foo',
60+
},
5761
});
5862
expect(JSON.parse(serialized).find.inner).toBe('?');
5963
});
6064

6165
it('rewrites Buffer as ?', () => {
6266
const serialized = _defaultDbStatementSerializer({
63-
find: Buffer.from('foo', 'utf8')
67+
find: Buffer.from('foo', 'utf8'),
6468
});
6569
expect(JSON.parse(serialized).find).toBe('?');
6670
});

0 commit comments

Comments
 (0)