to summarize in brief words:
I have a ‘task engine’ with channel where tasks/functions are sent for processing. The task Engine is initialized with a cache of 5 minutes time limit. Every time, a task is submitted to the channel, I increment the value in cache and once the execution is done, I decrement the value.
Now the ‘functions’ being sent to this task engine are processed very quickly, some in let’s say just a matter of few seconds. I send the metric call to the endpoint every 30 seconds.
I want to capture the number of in-flight functions/tasks in the Task Engine. Since the metric call to endpoint is every 30 seconds, the accurate number of tasks is not captured as the actual functions might all be done by the time the call is made and the value is 0. I implemented a cache to store all the in-flight tasks for 5 min because I cannot change the time-period of the metric call but I’m not sure if that’s the best option.
Does anyone have a better idea of how in this scenario I could get the number of in-flight tasks or what’s the closest way of getting this metric?