Skip to content

Commit

Permalink
[Monitor OpenTelemetry Exporter] Fix Integration Tests Flush (Azure#3…
Browse files Browse the repository at this point in the history
…2196)

### Packages impacted by this PR
@azure/monitor-opentelemetry-exporter

### Issues associated with this PR
Azure#32101 

### Describe the problem that is addressed by this PR
Integration tests were failing as the flush was not completing.

### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [x] Added a changelog (if necessary)
  • Loading branch information
JacksonWeber authored Dec 13, 2024
1 parent b939c31 commit 7b884b2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions sdk/monitor/monitor-opentelemetry-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
},
"devDependencies": {
"@azure-tools/test-utils-vitest": "^1.0.0",
"@azure/core-util": "^1.11.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@opentelemetry/instrumentation": "^0.56.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Log Exporter Scenarios", () => {
setTimeout(() => {
assertLogExpectation(ingest, scenario.expectation);
assertCount(ingest, scenario.expectation);
}, 1);
}, 100);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ describe("Metric Exporter Scenarios", () => {
await scenario.run();
// promisify doesn't work on this, so use callbacks/done for now
await scenario.flush();
assertMetricExpectation(ingest, scenario.expectation);
assertCount(ingest, scenario.expectation);
setTimeout(() => {
assertMetricExpectation(ingest, scenario.expectation);
assertCount(ingest, scenario.expectation);
}, 100);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ describe("Trace Exporter Scenarios", () => {
it("should work", async () => {
await scenario.run();
await scenario.flush();
assertTraceExpectation(ingest, scenario.expectation);
assertCount(ingest, scenario.expectation);
setTimeout(() => {
assertTraceExpectation(ingest, scenario.expectation);
assertCount(ingest, scenario.expectation);
}, 100);
});
});

Expand Down Expand Up @@ -69,10 +71,11 @@ describe("Trace Exporter Scenarios", () => {

it("should work with OTel resource metric disabled", async () => {
await scenario.run();

await scenario.flush();
assertTraceExpectation(ingest, scenario.disabledExpectation);
assertCount(ingest, scenario.disabledExpectation);
setTimeout(() => {
assertTraceExpectation(ingest, scenario.disabledExpectation);
assertCount(ingest, scenario.disabledExpectation);
}, 100);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe("#StandardMetricsHandler", () => {
autoCollect.recordSpan(serverSpan);
}

await new Promise((resolve) => setTimeout(resolve, 1000));
await new Promise((resolve) => setTimeout(resolve, 1500));
assert.ok(exportStub.called);
const resourceMetrics = exportStub.args[0][0];
const scopeMetrics = resourceMetrics.scopeMetrics;
Expand Down

0 comments on commit 7b884b2

Please sign in to comment.