flush() {
		if (this.queue.length > 0) {
			const rows = Array.from(this.queue);
			this.queue.length = 0;

			const data = rows.map(row => {
				// {"message":"hello world", "ddsource":"moleculer", "ddtags":"env:,user:icebob", "hostname":"bobcsi-pc"}

				return {
					timestamp: row.ts,
					level: row.level,
					message: row.msg,
					nodeID: row.bindings.nodeID,
					namespace: row.bindings.ns,
					service: row.bindings.svc,
					version: row.bindings.ver,

					ddsource: this.opts.ddSource,
					ddtags: this.getTags(row),
					hostname: this.opts.hostname
				};
			});

			return fetch(this.opts.url, {
				method: "post",
				body: JSON.stringify(data),
				headers: {
					"DD-API-KEY": this.opts.apiKey,
					"Content-Type": "application/json"
				}
			})
				.then(res => {
					if (res.status >= 400) throw new Error(res.statusText);
					// console.log("Logs are uploaded to DataDog. Status: ", res.statusText);
				})
				.catch(err => {
					/* istanbul ignore next */
					// eslint-disable-next-line no-console
					console.warn(
						"Unable to upload logs to Datadog server. Error:" + err.message,
						err
					);
				});
		}

		return this.broker.Promise.resolve();
	}
Flush queued log entries to Datadog.