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

[cascading] from release/11.3 to release/11.4.0-rc #2430

Merged
merged 9 commits into from
Nov 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ describe('metadata files helpers', () => {
const major = 1;
const minor = 3;
mockCoerce.mockReturnValue({ major, minor});
await expect(getVersionRangeFromLatestVersion(`${major}.${minor}.14`, 'major')).resolves.toBe(`<${major}.0.0`);
await expect(getVersionRangeFromLatestVersion(`${major}.${minor}.14`, 'minor')).resolves.toBe(`<${major}.${minor}.0`);
await expect(getVersionRangeFromLatestVersion(`${major}.${minor}.14`, 'major')).resolves.toBe(`<${major}.0.0-a`);
await expect(getVersionRangeFromLatestVersion(`${major}.${minor}.14`, 'minor')).resolves.toBe(`<${major}.${minor}.0-a`);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ export async function getVersionRangeFromLatestVersion(latestMigrationVersion: s
if (!semver) {
throw new O3rCliError(`${latestMigrationVersion} is not a valid version.`);
}
return `<${semver.major}.${granularity === 'minor' ? semver.minor : 0}.0`;
return `<${semver.major}.${granularity === 'minor' ? semver.minor : 0}.0-a`;
}
41 changes: 27 additions & 14 deletions packages/@o3r/telemetry/src/sender/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,32 @@ export type SendDataFn = (data: MetricData, logger?: { error: (msg: string) => v
/**
* Send metric to a Amadeus Log Server
* @param data Metrics to report
* @param _logger Optional logger to provide to the function
* @param _logger.error
* @param logger Optional logger to provide to the function
*/
export const sendData: SendDataFn = async (data: MetricData, _logger?: { error: (msg: string) => void }) => {
const message = JSON.stringify(data);
const body = JSON.stringify({
messages: [{
applicationName: 'OTTER',
message
}]
});
await fetch('https://uat.digital-logging.saas.amadeus.com/postUILogs', {
method: 'POST',
body
});
export const sendData: SendDataFn = (data, logger) => {
let body!: string;
try {
const message = JSON.stringify(data);
body = JSON.stringify({
messages: [{
applicationName: 'OTTER',
message
}]
});
} catch (e: any) {
return Promise.reject(e);
}

setTimeout(() => {
void fetch('https://uat.digital-logging.saas.amadeus.com/postUILogs', {
method: 'POST',
body
}).catch((e) => {
const err = (e instanceof Error ? e : new Error(e));
logger?.error(err.stack || err.toString());
});
}, 1).unref();

return Promise.resolve();
};

Loading