How to view statsD events in Datadog?

1k Views Asked by At

I am using statsD (hot-shots) to try log events in datadog such as when a new item is created and by who but, when I am calling statsD.event('title', 'description') I do not see any events in datadog metrics.

My statsD client is setup like this:

const client = new StatsD({
  port: process.env.STATSD_PORT,
  host: process.env.STATSD_HOST,
  prefix: 'service-name.',
  globalTags: {
    env: process.env.CONFIG_ENV,
    service: 'service_name'
  },
  errorHandler: error => {
    console.error(error);
  }
});

and then I call the event method like so:

client.event(ACTION.CREATE, JSON.stringify({
  username: this.username,
  alias: alias,
  //...
}));

In the metrics section of datadog, I do not appear to be seeing any events come through. The only way I can see some logs there is using increment

client.increment(ACTION.CREATE, {
  username: this.username,
  alias: alias,
  ///...
});

But increment only seems to tell me how many times that action is called and I am unable to log additional data such as username and alias.

I am pretty sure my statsD client and datadog configs are setup correctly as I am able to see data from increment so I suspect it is to do with the way I am trying to use the event method.

Am I using the event method incorrectly? Perhaps I am checking in the wrong place in datadog? Perhaps I should be using increment?

How can I log events along with associated data in datadog using statsD?

0

There are 0 best solutions below