How to read animation sequence frames amount programaticlly?

I want to record an animation, but the recording starts in an arbitrary frame and ends in an arbitrary frame, because I do not know how many frames is my animation.
To make things even worse, the animation I record is the result of 2D space anmation blending(a few animation in a blend space).
Is there a way to tell the length of a full cycle in that case as well?
The way I record it is by calling a function every time update animation is called in the anim blueprint.

Do you have any other way suggestion to record the animations into a file?