mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: prometheus now gets licensed users data (#8740)
We have the licensed users service implemented, this just spread the data to prometheus.
This commit is contained in:
		
							parent
							
								
									088eaedbc3
								
							
						
					
					
						commit
						d2daae5857
					
				| @ -359,3 +359,9 @@ test('should collect traffic_total metrics', async () => { | ||||
|         await prometheusRegister.getSingleMetricAsString('traffic_total'); | ||||
|     expect(recordedMetric).toMatch(/traffic_total 0/); | ||||
| }); | ||||
| 
 | ||||
| test('should collect licensed_users metrics', async () => { | ||||
|     const recordedMetric = | ||||
|         await prometheusRegister.getSingleMetricAsString('licensed_users'); | ||||
|     expect(recordedMetric).toMatch(/licensed_users 0/); | ||||
| }); | ||||
|  | ||||
| @ -650,6 +650,11 @@ export function registerPrometheusMetrics( | ||||
|         resourceLimit.labels({ resource }).set(limit); | ||||
|     } | ||||
| 
 | ||||
|     const licensedUsers = createGauge({ | ||||
|         name: 'licensed_users', | ||||
|         help: 'The number of licensed users.', | ||||
|     }); | ||||
| 
 | ||||
|     const addonEventsHandledCounter = createCounter({ | ||||
|         name: 'addon_events_handled', | ||||
|         help: 'Events handled by addons and the result.', | ||||
| @ -1018,6 +1023,11 @@ export function registerPrometheusMetrics( | ||||
|                 usersActive90days.reset(); | ||||
|                 usersActive90days.set(activeUsers.last90); | ||||
| 
 | ||||
|                 const licensedUsersStat = | ||||
|                     await instanceStatsService.getLicencedUsers(); | ||||
|                 licensedUsers.reset(); | ||||
|                 licensedUsers.set(licensedUsersStat); | ||||
| 
 | ||||
|                 const productionChanges = | ||||
|                     await instanceStatsService.getProductionChanges(); | ||||
|                 productionChanges30.reset(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user