Skip to content
Merged
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
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
### :house: Internal

* fix(build): update @types/node to 18.19.130, remove DOM types from base tsconfig [#6280](https://github.com/open-telemetry/opentelemetry-js/pull/6280) @overbalance
* refactor(sdk-logs): simplify \_export() [#6318](https://github.com/open-telemetry/opentelemetry-js/pull/6318) @cjihrig

## 0.210.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,23 @@ export abstract class BatchLogRecordProcessorBase<T extends BufferConfig>
})
.catch(globalErrorHandler);

const pendingResources = logRecords
.map(logRecord => logRecord.resource)
.filter(resource => resource.asyncAttributesPending);
const pendingResources = [];

for (let i = 0; i < logRecords.length; i++) {
const resource = logRecords[i].resource;
if (
resource.asyncAttributesPending &&
typeof resource.waitForAsyncAttributes === 'function'
) {
pendingResources.push(resource.waitForAsyncAttributes());
}
}

// Avoid scheduling a promise to make the behavior more predictable and easier to test
if (pendingResources.length === 0) {
return doExport();
} else {
return Promise.all(
pendingResources.map(resource => resource.waitForAsyncAttributes?.())
).then(doExport, globalErrorHandler);
return Promise.all(pendingResources).then(doExport, globalErrorHandler);
}
}

Expand Down