New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@envelop/statsd

Package Overview
Dependencies
Maintainers
0
Versions
1418
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/statsd

This plugin tracks the complete execution flow, and reports metrics using StatsD (based on `hot-shots`).

6.1.0-rc-20250304112711-219374a5ae578adf061fa06588b59e9b7f16fd1d
Source
npm
Version published
Weekly downloads
4.8K
-35.04%
Maintainers
0
Weekly downloads
 
Created
Source

@envelop/statsd

This plugin tracks the complete execution flow, and reports metrics using StatsD (based on hot-shots).

Compatible with:

  • Datadog's DogStatsD server
  • InfluxDB's Telegraf StatsD server
  • Etsy's StatsD serve

Available metrics:

  • graphql.operations.count - the number of performed operations (including failures)
  • graphql.operations.error_count - the number of failed operations
  • graphql.operations.latency - a histogram of response times (in milliseconds)

You can also customize the graphql prefix and add custom tags to the metrics.

Getting Started

yarn add hot-shots @envelop/statsd

Usage Example

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import StatsD from 'hot-shots'
import { envelop, useEngine } from '@envelop/core'
import { useStatsD } from '@envelop/statsd'

const client = new StatsD({
  port: 8020,
  globalTags: { env: process.env.NODE_ENV }
})

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useStatsD({
      client,
      prefix: 'gql', // results in `gql.operations.count` instead of `graphql.operations.count`,
      skipIntrospection: true // if you wish to disable introspection logging
    })
  ]
})

Keywords

envelop

FAQs

Package last updated on 04 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts