mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	add single toggle metric endpoint
This commit is contained in:
		
							parent
							
								
									f425597640
								
							
						
					
					
						commit
						b5b846835b
					
				| @ -24,6 +24,17 @@ module.exports = function (app, config) { | ||||
|         res.json(metrics.getTogglesMetrics()); | ||||
|     }); | ||||
| 
 | ||||
|     app.get('/client/metrics/feature-toggles/:name', (req, res) => { | ||||
|         const name = req.params.name; | ||||
|         const data = metrics.getTogglesMetrics(); | ||||
|         const lastHour = data.lastHour[name] || {}; | ||||
|         const lastMinute = data.lastMinute[name] || {}; | ||||
|         res.json({ | ||||
|             lastHour, | ||||
|             lastMinute, | ||||
|         }); | ||||
|     }); | ||||
| 
 | ||||
|     app.post('/client/metrics', (req, res) => { | ||||
|         const data = req.body; | ||||
|         const clientIp = req.ip; | ||||
| @ -62,7 +73,7 @@ module.exports = function (app, config) { | ||||
|                     instanceId: cleaned.instanceId, | ||||
|                     clientIp, | ||||
|                 })) | ||||
|                 .then(() => logger.info(`New client registered with 
 | ||||
|                 .then(() => logger.info(`New client registered with
 | ||||
|                             appName=${cleaned.appName} and instanceId=${cleaned.instanceId}`))
 | ||||
|                 .catch(err => logger.error('failed to register client', err)); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user