Horizontal plane angle measurement

I have a project where i need to measure angle in the horizontal plane (XY) in concordance with a set reference while spinning at 2500rpm.
Other limitations are that it will be enclosed in close proximity to electric motors inside a machine made of aluminium and steel.
Two modes of operation:
1: spin at high Rpm and move in a general direction based on a vector impute (angle and magnitude)
For this I can use feed back every 5 or 10 degrees of rotation at high RPM (reporting position when it moves every time when it rotates 10 degrees ) reporting integer 0, 10, 20, 30, ......350, 0
2: Vector drive turn to the angle to match the vector and drive in that direction
For this i need constant monitoring at low RPM (60-120rpm) to use in order to match the angle for the impute vector.
If it drifts 5-10 degrees in 3 minutes is OK.
I do not need to align to magnetic North it can st a reference 0 angle wherever it is set and powered as a reference 0 angle
For this i need to have a way to monitor relative angle at all times.
Can you help?
Thanks anticipated Traian

I don't understand the relationship between angle, and "magnitude" of what?

I think that a rotary encoder will do the trick for the angle. The achievable resolution depends on the platform RPM, encoder PPR, and processing power of the controller.

i am thinking like a polar system Polar coordinate system - Wikipedia where you have an angle and a radius to define direction and speed (angle magnitude) it is not the magnitude that i need to monitor but rather the angle. What i need is to track vehicle angle in horizontal plane. Kind of like this Dale's Homemade Robots - Full Body Spinner Experiment only much faster
rotary encoder is a no go since it requires to one end on main rotating shaft and the other one on a fixed point. Imagine you spin a two wheel vehicle around it's axis and this device is mounted in the vehicle.

You may use a compass, HMC5883 or similar

You may find a gyro that fits your requirements.

You may use a compass, HMC5883 or similar

Can that operate from inside a steel/aluminium enclosure with strong motors that create magnetic field?