Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ export function initializeDefaultConfiguration(): ConfigurationModel {
attribute_limits: {
attribute_count_limit: 128,
},
propagator: {
composite: [{ tracecontext: null }, { baggage: null }],
composite_list: 'tracecontext,baggage',
},
};

return config;
Expand Down
17 changes: 17 additions & 0 deletions experimental/packages/configuration/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
getStringFromConfigFile,
getStringListFromConfigFile,
} from '../src/utils';
import { initializeDefaultConfiguration } from '../src/models/configModel';

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / browser-tests

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (24)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (20.6.0)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (18.19.0)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (22)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (25)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (24)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (20.6.0)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (18.19.0)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (20)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (18)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (25)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / bundler-tests

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / e2e-tests (22)

'initializeDefaultConfiguration' is declared but its value is never read.

Check failure on line 29 in experimental/packages/configuration/test/utils.test.ts

View workflow job for this annotation

GitHub Actions / build

'initializeDefaultConfiguration' is declared but its value is never read.
import { EnvironmentConfigFactory } from '../src/EnvironmentConfigFactory';

describe('config utils', function () {
afterEach(function () {
Expand Down Expand Up @@ -189,4 +191,19 @@
);
});
});

it('should set propagators from OTEL_PROPAGATORS when defined', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file focus on testing functions from the utils file, which is not the case for this test, so you can remove from here and update the ConfigFactory.test.js file accordingly

process.env.OTEL_PROPAGATORS = 'tracecontext,baggage';

const factory = new EnvironmentConfigFactory();
const config = factory.getConfigModel();

assert.strictEqual(config.propagator, 'propagator should be defined');
assert.strictEqual(
config.propagator.composite_list,
'tracecontext,baggage'
);

delete process.env.OTEL_PROPAGATORS;
});
});
4 changes: 2 additions & 2 deletions packages/opentelemetry-core/src/baggage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function parsePairKeyValue(
const rawKey = keyPairPart.substring(0, separatorIndex).trim();
const rawValue = keyPairPart.substring(separatorIndex + 1).trim();

if (!rawKey || !rawValue) return;
if (!rawKey) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the rationale behind this change and the one below? they don't seem related to your PR topic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see these changes are from your other PR, so please remove them from here

let key: string;
let value: string;
try {
Expand Down Expand Up @@ -105,7 +105,7 @@ export function parseKeyPairsIntoRecord(
value.split(BAGGAGE_ITEMS_SEPARATOR).forEach(entry => {
const keyPair = parsePairKeyValue(entry);

if (keyPair !== undefined && keyPair.value.length > 0) {
if (keyPair !== undefined && keyPair.value !== undefined) {
result[keyPair.key] = keyPair.value;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ describe('parseKeyPairsIntoRecord()', () => {
});
});

it('filters out empty values', () => {
assert.deepStrictEqual(parseKeyPairsIntoRecord('key1=,key2=value2'), {
key2: 'value2',
it('prevents empty baggage values', () => {
assert.deepStrictEqual(parseKeyPairsIntoRecord('key1=value1,key2='), {
key1: 'value1',
key2: '',
});
});
});
Loading