statsd middleware for Telegraf
Clone or download
Failed to load latest commit information.
examples update docs Jun 15, 2016
lib update deps & bugfix Feb 26, 2017
.editorconfig initial commit May 21, 2016
.eslintignore initial commit May 21, 2016
.eslintrc initial commit May 21, 2016
.gitignore initial commit May 21, 2016
.travis.yml updete to Telegraf 2.0 Jun 14, 2016
LICENSE initial commit May 21, 2016
package.json bump version Feb 26, 2017 update deps Oct 3, 2016

statsd middleware for Telegraf

Build Status NPM Version

statsd middleware for Telegraf (Telegram bot framework).


$ npm install telegraf-statsd


const Telegraf = require('telegraf')
const stats = require('telegraf-statsd')

const telegraf = new Telegraf(process.env.BOT_TOKEN)


telegraf.on('text', (ctx) => {
  return ctx.reply('Big brother watch you!')




  • host - optional statsd host
  • port - optional statsd port
  • prefix - optional statsd prefix ('.' is appended)
  • tcp - use TCP instead of UDP

User context

Telegraf user context props and functions:

app.use((ctx) => {
  ctx.statsd  // Statsy instance

Statsy help


Metric name Type Description
counter counter bot updates counter
<type>.count counter update type counter (message, inlineQuery, etc.)
message.<subtype>.count counter message subtype counter(text, sticker, etc.)
errors.count counter error counter
errors.<type>.count counter update type error counter
errors.message.<subtype>.count counter message subtype error counter
duration timer handler duration
<type>.duration timer update type handler duration
message.<subtype>.duration timer message subtype handler duration
chats set chats set
users set users set
text.size histogram text messages length