Skip to content

Commit 9a02e95

Browse files
committed
fix tests, adjust jsdoc
1 parent 8bf89f7 commit 9a02e95

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

dev-packages/browser-integration-tests/suites/public-api/logger/integration/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sentryTest('should capture console object calls', async ({ getLocalTestUrl, page
167167
'sentry.message.template': { value: 'Mixed: {} {} {} {}', type: 'string' },
168168
'sentry.message.parameter.0': { value: 'prefix', type: 'string' },
169169
'sentry.message.parameter.1': { value: '{"obj":true}', type: 'string' },
170-
'sentry.message.parameter.2': { value: [4, 5, 6], type: 'integer[]' },
170+
'sentry.message.parameter.2': { value: '[4,5,6]', type: 'string' },
171171
'sentry.message.parameter.3': { value: 'suffix', type: 'string' },
172172
},
173173
},
@@ -236,7 +236,7 @@ sentryTest('should capture console object calls', async ({ getLocalTestUrl, page
236236
'sentry.message.template': { value: 'hello {} {} {}', type: 'string' },
237237
'sentry.message.parameter.0': { value: true, type: 'boolean' },
238238
'sentry.message.parameter.1': { value: 'null', type: 'string' },
239-
'sentry.message.parameter.2': { value: 'undefined', type: 'string' },
239+
'sentry.message.parameter.2': { value: '', type: 'string' },
240240
},
241241
},
242242
],

dev-packages/browser-integration-tests/suites/public-api/logger/scopeAttributes/subject.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Sentry.logger.info('log_before_any_scope', { log_attr: 'log_attr_1' });
33

44
Sentry.getGlobalScope().setAttributes({ global_scope_attr: true });
55

6+
// this attribute will not be sent for now
7+
Sentry.getGlobalScope().setAttribute('array_attr', [1, 2, 3]);
8+
69
// global scope, log attribute
710
Sentry.logger.info('log_after_global_scope', { log_attr: 'log_attr_2' });
811

dev-packages/node-integration-tests/suites/public-api/logger/scenario.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ async function run(): Promise<void> {
1515

1616
Sentry.getGlobalScope().setAttribute('global_scope_attr', true);
1717

18+
// this attribute will not be sent for now
19+
Sentry.getGlobalScope().setAttributes({ array_attr: [1, 2, 3] });
20+
1821
// global scope, log attribute
1922
Sentry.logger.info('log_after_global_scope', { log_attr: 'log_attr_2' });
2023

dev-packages/node-integration-tests/suites/public-api/logger/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const commonAttributes: SerializedLog['attributes'] = {
2525
},
2626
};
2727

28-
describe('metrics', () => {
28+
describe('logs', () => {
2929
afterAll(() => {
3030
cleanupChildProcesses();
3131
});
3232

33-
test('should capture all metric types', async () => {
33+
test('captures logs with scope and log attributes', async () => {
3434
const runner = createRunner(__dirname, 'scenario.ts')
3535
.expect({
3636
log: {

packages/core/src/attributes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ export function isAttributeObject(maybeObj: unknown): maybeObj is AttributeObjec
6262
}
6363

6464
export function attributeValueToTypedAttributeValue(rawValue: unknown, useFallback?: true): TypedAttributeValue;
65+
6566
/**
6667
* Converts an attribute value to a typed attribute value.
6768
*
68-
* Does not allow mixed arrays. In case of a mixed array, the value is stringified and the type is 'string'.
69-
* All values besides the supported attribute types (see {@link AttributeTypeMap}) are stringified to a string attribute value.
69+
* For now, we intentionally only support primitive values and attribute objects with primitive values.
70+
* If @param useFallback is true, we stringify non-primitive values to a string attribute value. Otherwise
71+
* we return `undefined` for unsupported values.
7072
*
7173
* @param value - The value of the passed attribute.
7274
* @param useFallback - If true, unsupported values will be stringified to a string attribute value.

0 commit comments

Comments
 (0)