flush() {
		if (this.queue.length == 0) return;

		const data = this.generateDatadogTracingData();
		this.queue.length = 0;

		fetch(this.opts.agentUrl, {
			method: "post",
			body: JSON.stringify(data),
			headers: {
				"Content-Type": "application/json"
			}
		})
			.then(res => {
				this.logger.info(
					`Tracing spans (${data.length} traces) are uploaded to Datadog. Status: ${res.statusText}`
				);
			})
			.catch(err => {
				this.logger.warn(
					"Unable to upload tracing spans to Datadog. Error:" + err.message,
					err
				);
			});
	}
Flush tracing data to Datadog server

@memberof DatadogTraceExporter