Socket
Socket
Sign inDemoInstall

httpmetrics

Package Overview
Dependencies
0
Maintainers
7
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    httpmetrics

HTTP monkey-patching to insert metrics to each http call


Version published
Weekly downloads
4
increased by300%
Maintainers
7
Install size
28.4 kB
Created
Weekly downloads
 

Readme

Source

httpmetrics

Nodejs module that reports metrics, both for request and response, to outgoing HTTP/HTTPS connections made from the app. The module hooks into the HTTP methods of node to compute metrics. Upon completing outgoing request, module emits 'httpmetrics' event with 'request' as metric type. Upon receiving a response back on the socket, module emits 'httpmetrics' event with 'response' as metric type.

* Metrics added
 * IncomingMessage: {
    ymetrics: {
        headerSize:
        firstChunkSize:
        bodySize:
        statusCode:
        totalTransferTime:
        host:
    }
 }
 * OutgoingMessage: {
    ymetrics: {
        headerSize:
        firstChunkSize:
        bodySize:
        connectTime:
        totalTransferTime:
        firstChunkTransferTime:
        host:
    }
 }

This package is tested only with Node versions 8 and 10.

install

With npm do:

npm install httpmetrics

usage

var httpmetrics = require('httpmetrics');

//Start collecting metrics
httpmetrics.appendHttpMetrics();

httpmetrics.on('httpmetrics', function(metricType, metrics) {
    //metricType = request / response
    //metrics = corresponding metrics
});

example

Please refer to the examples/httpmetrics-app.js for details

Build Status

Build Status

Node Badge

NPM

Keywords

FAQs

Last updated on 06 Apr 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc