How to use the dogapi.initialize function in dogapi

To help you get started, we’ve selected a few dogapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbader / node-datadog-metrics / lib / reporters.js View on Github external
function DataDogReporter(apiKey, appKey, agent) {
    apiKey = apiKey || process.env.DATADOG_API_KEY;
    appKey = appKey || process.env.DATADOG_APP_KEY;

    if (!apiKey) {
        throw new Error('DATADOG_API_KEY environment variable not set');
    }

    // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
    dogapi.initialize({api_key: apiKey, app_key: appKey, proxy_agent: agent });
    // jscs:enable requireCamelCaseOrUpperCaseIdentifiers
}
github gshackles / alexa-datadog-sample / handler.js View on Github external
module.exports.queryDatadog = (event, context, callback) => {
  dogapi.initialize({
    api_key: 'TODO',
    app_key: 'TODO'
  });
  
  if (event.request.type === 'IntentRequest') {
    processIntent(event.request, event.session)
      .then(speechletResponse =>
        context.succeed(buildResponse({}, speechletResponse)));
  }
};
github expo / turtle / src / metrics / datadog / index.ts View on Github external
import dogapi from 'dogapi';
import util from 'util';

import config from 'turtle/config';

const datadogSendMetric = util.promisify(dogapi.metric.send);

if (!config.datadog.disabled) {
  dogapi.initialize({
    api_key: config.datadog.apiKey,
    app_key: config.datadog.appKey,
   });
}

const tags = [
  `env:${config.deploymentEnv}`,
  `platform:${config.platform}`,
];

export function sendMetric(name: string, value: number, additionalTags?: string[]) {
  if (!config.datadog.disabled) {
    return datadogSendMetric(name, value, { tags: [...tags, ...(additionalTags || [])] });
  }
}
github Gravebot / Gravebot / src / datadog.js View on Github external
import dogapi from 'dogapi';
import nconf from 'nconf';

import logger from './logger';


if (nconf.get('DATADOG_APIKEY') && nconf.get('DATADOG_APPKEY')) {
  logger.info('Datadog enabled');
  dogapi.initialize({
    api_key: nconf.get('DATADOG_APIKEY'),
    app_key: nconf.get('DATADOG_APPKEY')
  });
}

export default function send(metric, value) {
  if (dogapi.client.api_key && dogapi.client.app_key) dogapi.metric.send(metric, value);
}

dogapi

Datadog API Node.JS Client

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis