Skip to content

Commit

Permalink
[cascading] from release/11.4.0-rc to main (#2435)
Browse files Browse the repository at this point in the history
<!--
{"currentBranch":"release/11.4.0-rc","targetBranch":"main","bypassReviewers":true,"isConflicting":false}
-->

## Cascading from release/11.4.0-rc to main

The configuration requests the cascading to bypass reviewer in case of
CI success.
To not bypass the reviewing process, please check the following
checkbox:

- [ ] <!-- !cancel bypass! --> 🚫 stop reviewing process
bypass for this Pull Request

---

<small>This Pull Request has been generated with ❤️ by the
[Otter](https://github.com/AmadeusITGroup/otter) cascading tool.</small>
  • Loading branch information
kpanot authored Nov 9, 2024
2 parents dc80c32 + 198afdc commit bc26278
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
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();
};

0 comments on commit bc26278

Please sign in to comment.