We propose an optical sensor by integrating a circular-hole defect with an etched diffraction grating spectrometer based on amorphous silicon photonic platforms. There are some superiorities of this device, such as high sensitivity (~10000 nm/RIU), and ability to deliver component analysis from the near-infrared spectrum by using the integrated spectrometer. As application example, the chip is used for distinguishing similar biodiesel types and accurately determining their concentrations in a diesel oil mixture.