-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdk-logs): await async resources in log processors (#4349)
- Loading branch information
1 parent
d3c311a
commit d828041
Showing
8 changed files
with
298 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ | |
"@babel/core": "7.23.6", | ||
"@opentelemetry/api": ">=1.4.0 <1.8.0", | ||
"@opentelemetry/api-logs": "0.46.0", | ||
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/[email protected]", | ||
"@types/mocha": "10.0.6", | ||
"@types/node": "18.6.5", | ||
"@types/sinon": "10.0.20", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
experimental/packages/sdk-logs/test/common/export/TestExporterWithDelay.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { ExportResult } from '@opentelemetry/core'; | ||
import { InMemoryLogRecordExporter, ReadableLogRecord } from '../../../src'; | ||
|
||
/** | ||
* A test-only exporter that delays during export to mimic a real exporter. | ||
*/ | ||
export class TestExporterWithDelay extends InMemoryLogRecordExporter { | ||
private _exporterCreatedLogRecords: ReadableLogRecord[] = []; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
override export( | ||
logRecords: ReadableLogRecord[], | ||
resultCallback: (result: ExportResult) => void | ||
): void { | ||
super.export(logRecords, () => setTimeout(resultCallback, 1)); | ||
} | ||
|
||
override shutdown(): Promise<void> { | ||
return super.shutdown().then(() => { | ||
this._exporterCreatedLogRecords = []; | ||
}); | ||
} | ||
|
||
override reset() { | ||
super.reset(); | ||
this._exporterCreatedLogRecords = []; | ||
} | ||
|
||
getExporterCreatedLogRecords(): ReadableLogRecord[] { | ||
return this._exporterCreatedLogRecords; | ||
} | ||
} |
Oops, something went wrong.