Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitor OpenTelemetry Exporter] Add Long-Interval Statsbeat Warmup Time #32421

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0c73441
Add statsbeat warmup time.
JacksonWeber Jan 4, 2025
1686104
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 6, 2025
84d5a17
Fix lint.
JacksonWeber Jan 6, 2025
8e8d008
Fix tests.
JacksonWeber Jan 7, 2025
d735ca2
Fix lint.
JacksonWeber Jan 7, 2025
5003349
Update spanUtils.ts
JacksonWeber Jan 9, 2025
f9442db
Update spanUtils.ts
JacksonWeber Jan 9, 2025
333a1d6
Extend sleep in test.
JacksonWeber Jan 9, 2025
fe193df
Update fileSystemPersist.spec.ts
JacksonWeber Jan 9, 2025
8678b19
Fix lint.
JacksonWeber Jan 9, 2025
766b8cb
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 10, 2025
a713088
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 10, 2025
131a4fb
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 10, 2025
6752684
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 12, 2025
7252d8a
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 13, 2025
026b099
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 15, 2025
c07f6d1
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 17, 2025
53207ee
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 21, 2025
d0370ae
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 22, 2025
0340526
Extend timeout for macos.
JacksonWeber Jan 22, 2025
793c496
Update rest of timeouts.
JacksonWeber Jan 22, 2025
1d46a00
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 22, 2025
59efbcb
Merge branch 'main' into jacksonweber/add-statsbeat-warmup
JacksonWeber Jan 22, 2025
6d7b7ad
Test without 15 second wait test.
JacksonWeber Jan 23, 2025
c4209ea
Fix statsbeat test timeout issue.
JacksonWeber Jan 23, 2025
b0c886b
Update statsbeat test.
JacksonWeber Jan 23, 2025
92f3dc8
Move long interval stats export test.
JacksonWeber Jan 23, 2025
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 sdk/monitor/monitor-opentelemetry-exporter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Fix setting statsbeat custom dimensions.
- EAI_AGAIN REST errors are considered retriable.
- Add 15 second warmup before export of long interval statsbeat.

## 1.0.0-beta.27 (2024-10-23)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,17 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics {
[this.featureStatsbeatGauge],
);

// Export Feature/Attach Statsbeat once upon app initialization
this.longIntervalAzureExporter.export(
(await this.longIntervalMetricReader.collect()).resourceMetrics,
(result: ExportResult) => {
if (result.code !== ExportResultCode.SUCCESS) {
diag.error(`LongIntervalStatsbeat: metrics export failed (error ${result.error})`);
}
},
);
// Export Feature/Attach Statsbeat once upon app initialization after 15 second delay
setTimeout(async () => {
this.longIntervalAzureExporter.export(
(await this.longIntervalMetricReader.collect()).resourceMetrics,
(result: ExportResult) => {
if (result.code !== ExportResultCode.SUCCESS) {
diag.error(`LongIntervalStatsbeat: metrics export failed (error ${result.error})`);
}
},
);
}, 15000); // 15 seconds
} catch (error) {
diag.debug("Call to get the resource provider failed.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ describe("FileSystemPersist", () => {
const secondBatch = [{ batch: "second" }];
const success1 = await persister.push(firstBatch);
assert.strictEqual(success1, true);
// wait 1 ms so that we don't overwrite previous file
await sleep(1);
// wait 100 ms so that we don't overwrite previous file
await sleep(100);

const success2 = await persister.push(secondBatch);
assert.strictEqual(success2, true);
const value1 = await persister.shift();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ describe("#AzureMonitorStatsbeatExporter", () => {
});
});

it("should wait 15 seconds from startup to export long interval statsbeat", async () => {
const longIntervalStatsbeat = getInstance(options);
const mockExport = vi.spyOn(longIntervalStatsbeat["longIntervalAzureExporter"], "export");
longIntervalStatsbeat["initialize"]();
expect(mockExport).not.toHaveBeenCalled();
setTimeout(async () => {
expect(mockExport).toHaveBeenCalled();
}, 15000);
});

describe("Disable Non-Essential Statsbeat", () => {
it("should disable statsbeat when the environement variable is set", () => {
process.env[ENV_DISABLE_STATSBEAT] = "true";
Expand Down
Loading