<commit_before>/*
 * moleculer
 * Copyright (c) 2019 MoleculerJS (https://github.com/moleculerjs/moleculer)
 * MIT Licensed
 */

"use strict";

const BaseReporter = require("./base");
const _ = require("lodash");
const os = require("os");
const Promise = require("bluebird");
const fetch = require("node-fetch");
const { MoleculerError } = require("../../errors");
const METRIC = require("../constants");

fetch.Promise = Promise;

const BASE_URL = "https://api.datadoghq.com/api/";

/**
 * Datadog reporter for Moleculer.
 *
 * 		https://www.datadoghq.com/
 *
 */
class DatadogReporter extends BaseReporter {

	/**
	 * Constructor of DatadogReporters
	 * @param {Object} opts
	 * @memberof DatadogReporter
	 */
	constructor(opts) {
		super(opts);

		this.opts = _.defaultsDeep(this.opts, {
			host: os.hostname(),
			apiVersion: "v1",
			path: "/series",
			apiKey: process.env.DATADOG_API_KEY,
			//appKey: process.env.DATADOG_APP_KEY,
			defaultLabels: (registry) => ({
				namespace: registry.broker.namespace,
				nodeID: registry.broker.nodeID
			}),
			interval: 10
		});<commit_msg>datadog interval 20s<commit_after>/*
 * moleculer
 * Copyright (c) 2019 MoleculerJS (https://github.com/moleculerjs/moleculer)
 * MIT Licensed
 */

"use strict";

const BaseReporter = require("./base");
const _ = require("lodash");
const os = require("os");
const Promise = require("bluebird");
const fetch = require("node-fetch");
const { MoleculerError } = require("../../errors");
const METRIC = require("../constants");

fetch.Promise = Promise;

const BASE_URL = "https://api.datadoghq.com/api/";

/**
 * Datadog reporter for Moleculer.
 *
 * 		https://www.datadoghq.com/
 *
 */
class DatadogReporter extends BaseReporter {

	/**
	 * Constructor of DatadogReporters
	 * @param {Object} opts
	 * @memberof DatadogReporter
	 */
	constructor(opts) {
		super(opts);

		this.opts = _.defaultsDeep(this.opts, {
			host: os.hostname(),
			apiVersion: "v1",
			path: "/series",
			apiKey: process.env.DATADOG_API_KEY,
			//appKey: process.env.DATADOG_APP_KEY,
			defaultLabels: (registry) => ({
				namespace: registry.broker.namespace,
				nodeID: registry.broker.nodeID
			}),
			interval: 20
		});
{'fraction_non_alphanumeric': 0.1646090534979424, 'fraction_numerical': 0.007315957933241884, 'mean_word_length': 3.8087912087912086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3376312', 'n_tokens_mistral': 836, 'n_tokens_neox': 755, 'n_words': 152}