1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-23 13:46:45 +02:00

fix: Correctly merge client application data in metrics aggregation

This commit is contained in:
unleash-bot 2025-07-02 14:41:54 +00:00
parent 2278089392
commit ca6c02cfdb

View File

@ -174,17 +174,16 @@ export default class ClientInstanceService {
const uniqueRegistrations = Object.values(this.seenClients); const uniqueRegistrations = Object.values(this.seenClients);
const uniqueApps: Partial<IClientApplication>[] = Object.values( const uniqueApps: Partial<IClientApplication>[] = Object.values(
uniqueRegistrations.reduce((soFar, reg) => { uniqueRegistrations.reduce((soFar, reg) => {
let existingProjects = []; const key = `${reg.appName} ${reg.environment}`;
if (soFar[`${reg.appName} ${reg.environment}`]) { const existing = soFar[key] || {};
existingProjects = soFar[key] = {
soFar[`${reg.appName} ${reg.environment}`] ...existing,
.projects || [];
}
soFar[`${reg.appName} ${reg.environment}`] = {
...reg, ...reg,
projects: [ projects: [
...existingProjects, ...new Set([
...(reg.projects || []), ...(existing.projects || []),
...(reg.projects || []),
]),
], ],
}; };
return soFar; return soFar;