mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: Store metrics only if not empty (#991)
This commit is contained in:
		
							parent
							
								
									35f2f92257
								
							
						
					
					
						commit
						f6169540a5
					
				@ -140,8 +140,12 @@ export default class ClientMetricsService {
 | 
				
			|||||||
    ): Promise<void> {
 | 
					    ): Promise<void> {
 | 
				
			||||||
        const value = await clientMetricsSchema.validateAsync(data);
 | 
					        const value = await clientMetricsSchema.validateAsync(data);
 | 
				
			||||||
        const toggleNames = Object.keys(value.bucket.toggles);
 | 
					        const toggleNames = Object.keys(value.bucket.toggles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (toggleNames.length > 0) {
 | 
				
			||||||
            await this.featureToggleStore.setLastSeen(toggleNames);
 | 
					            await this.featureToggleStore.setLastSeen(toggleNames);
 | 
				
			||||||
            await this.clientMetricsStore.insert(value);
 | 
					            await this.clientMetricsStore.insert(value);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await this.clientInstanceStore.insert({
 | 
					        await this.clientInstanceStore.insert({
 | 
				
			||||||
            appName: value.appName,
 | 
					            appName: value.appName,
 | 
				
			||||||
            instanceId: value.instanceId,
 | 
					            instanceId: value.instanceId,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user