2.2.1 • Published 9 years ago

telegraf-statsd v2.2.1

Weekly downloads
71
License
MIT
Repository
github
Last release
9 years ago

statsd middleware for Telegraf

Build Status NPM Version

statsd middleware for Telegraf (Telegram bot framework).

Installation

$ npm install telegraf-statsd

Example

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

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

telegraf.use(stats())

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

telegraf.startPolling()

API

Options

  • 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

Metrics

Metric nameTypeDescription
countercounterbot updates counter
<type>.countcounterupdate type counter (message, inlineQuery, etc.)
message.<subtype>.countcountermessage subtype counter(text, sticker, etc.)
errors.countcountererror counter
errors.<type>.countcounterupdate type error counter
errors.message.<subtype>.countcountermessage subtype error counter
durationtimerhandler duration
<type>.durationtimerupdate type handler duration
message.<subtype>.durationtimermessage subtype handler duration
chatssetchats set
userssetusers set
text.sizehistogramtext messages length
2.2.1

9 years ago

2.2.0

9 years ago

2.1.0

10 years ago

2.0.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago