A system and method are configured to monitor composition of a flow of breathable gas being provided to a subject. The monitoring is accomplished in a sidestream configuration in which control of a pump and a detector are implemented in a tightly integrated controller.