The invention provides a fiber grating self-compensating strain transducer manufactured by adopting an online molding process, relating to the technical field of temperature transducers. A compensating device is composed of a part B and a solid body which are connected in series, wherein, the solid body is manufactured by adopting the online molding process for embedding and fixing the whole fiber grating in the solid body, and at least one of the cross-sectional area and thermal expansion coefficient of the part B and the solid body is different from each other. The strain transducer has the positive effects that: when the environmental temperature rises or falls, the automatic compensation to grating wavelength temperature drift can be realized by the effect of stress deformation, with precision compensation and good working stability; moreover, the strain transducer also has the advantages of small size, low cost, easy processing, good working stability, convenient use, stability and reliability, and long service life; the molding process of the strain transducer is simple and convenient, the compensation performance can be guaranteed to be reliable, and the problems that grating adhesive process has easy creep deformation, easy aging, unreliable grating combination, short service life and the like in the prior art are solved.