flush() {
		const list = this.registry.list({
			types: this.opts.types,
			includes: this.opts.includes,
			excludes: this.opts.excludes
		});

		if (list.length == 0) return;

		this.logger.debug("Write metrics values to CSV files...");

		list.forEach(metric => {
			metric.values.forEach(item => {
				// Is it changed?
				if (!this.lastChanges.has([metric.name, this.labelsToStr(item.labels)].join("|")))
					return;

				const filename = this.getFilename(metric, item);
				makeDirs(path.dirname(filename));
				const metricName = this.formatMetricName(metric.name);

				let headers = ["Timestamp", "Metric"];
				let data = [item.timestamp, metricName];

				metric.labelNames.forEach(label => {
					headers.push("Label " + label);
					data.push(item.labels[label] != null ? item.labels[label].toString() : "");
				});

				switch (metric.type) {
					case METRIC.TYPE_COUNTER:
					case METRIC.TYPE_GAUGE:
					case METRIC.TYPE_INFO: {
						if (item.value == null) return;

						headers.push("Value");
						data.push(item.value.toString());

						break;
					}
					case METRIC.TYPE_HISTOGRAM: {
						headers.push("Count");
						data.push(item.count);
						headers.push("Sum");
						data.push(item.sum);

						if (item.buckets) {
							Object.keys(item.buckets).forEach(b => {
								headers.push(`Bucket_${b}`);
								data.push(item.buckets[b]);
							});
						}

						if (item.quantiles) {
							headers.push("Min");
							data.push(item.min);
							headers.push("Mean");
							data.push(item.mean);
							headers.push("Var");
							data.push(item.variance);
							headers.push("StdDev");
							data.push(item.stdDev);
							headers.push("Max");
							data.push(item.max);

							Object.keys(item.quantiles).forEach(key => {
								headers.push(`Quantile_${key}`);
								data.push(item.quantiles[key]);
							});
						}

						break;
					}
				}

				if (this.opts.rowFormatter)
					this.opts.rowFormatter.call(this, data, headers, metric, item);

				this.writeRow(filename, headers, data);
			});
		});

		this.lastChanges.clear();
	}
Write metrics values to files.

@memberof CSVReporter