public static function start($options = array(), $sampleRate = null)
    {
        self::ignoreTransaction(); // this discards any data that was collected up to now and restarts.

        if (!is_array($options)) {
            $options = array('api_key' => $options);
        }
        if ($sampleRate !== null) {
            $options['sample_rate'] = $sampleRate;
        }

        $defaults = array(
            'api_key' => isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"),
            'sample_rate' => isset($_SERVER['TIDEWAYS_SAMPLERATE']) ? intval($_SERVER['TIDEWAYS_SAMPLERATE']) : (ini_get("tideways.sample_rate") ?: 0),
            'collect' => isset($_SERVER['TIDEWAYS_COLLECT']) ? $_SERVER['TIDEWAYS_COLLECT'] : (ini_get("tideways.collect") ?: self::MODE_PROFILING),
            'monitor' => isset($_SERVER['TIDEWAYS_MONITOR']) ? $_SERVER['TIDEWAYS_MONITOR'] : (ini_get("tideways.monitor") ?: self::MODE_BASIC),
            'triggered' => self::MODE_FULL,
            'log_level' => ini_get("tideways.log_level") ?: 0,
            'service' => isset($_SERVER['TIDEWAYS_SERVICE']) ? $_SERVER['TIDEWAYS_SERVICE'] : ini_get("tideways.service"),
            'framework' => isset($_SERVER['TIDEWAYS_FRAMEWORK']) ? $_SERVER['TIDEWAYS_FRAMEWORK'] : ini_get("tideways.framework"),
        );
        $options = array_merge($defaults, $options);

        if (strlen((string)$options['api_key']) === 0) {
            return;
        }

        self::$logLevel = $options['log_level'];
        self::init($options['api_key'], $options);
        self::decideProfiling($options['sample_rate'], $options);
    }