1. A method comprising: providing an exhaust stream for an internal combustion engine, the exhaust stream fluidly coupled to an aftertreatment component; optically determining an amount of an exhaust gas constituent in the exhaust stream during the operation of the internal combustion engine; and diagnosing the aftertreatment component in response to the amount of the exhaust gas constituent.