npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

otel-instrumentation-http-plus

v0.0.4

Published

OpenTelemetry Advanced HTTP Instrumentation Package

Downloads

4

Readme

OpenTelemetry HTTP Instrumentation Plus (Javascript/Node.js)

Build Status NPM Version License

NPM package which provides advanced automatic instrumentation for Node.js http and https modules on top of OpenTelemetry @opentelemetry/instrumentation-http instrumentation module.

Installation

To install the package, you can use NPM (or Yarn):

npm install --save otel-instrumentation-http-plus

Note: Requires @opentelemetry/api version 1.0.0+ and @opentelemetry/instrumentation-http version 0.30.0+ installed.

Usage

You need to import/require HttpPlusInstrumentation first and then register HttpPlusInstrumentation instance through registerInstrumentations method provided by the instrumentation API ('@opentelemetry/instrumentation') as shown below:

const { HttpPlusInstrumentation } = require('otel-instrumentation-http-plus');
const {
  ConsoleSpanExporter,
  NodeTracerProvider,
  SimpleSpanProcessor,
} = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

const provider = new NodeTracerProvider();

provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

registerInstrumentations({
  instrumentations: [new HttpPlusInstrumentation({
      // Put options here. See "Configuration" section below for more details
  })],
});

Configuration

In addition to base OpenTelemetry HTTP instrumentation options here, OpenTelemetry HTTP Instrumentation Plus also provides the following options to configure: | Options | Type | Default Value | Description | |--------------------------|--------------------------------|-----------------|----------------------------------------------------------------------------------------------| | captureRequestBody | boolean | false | Enables capturing HTTP request body | | maxRequestBodySize | number | 4096 (4 KB) | Sets maximum size limit for HTTP request body to be captured | | captureResponseBody | boolean | false | Enables capturing HTTP response body | | maxResponseBodySize | number | 4096 (4 KB) | Sets maximum size limit for HTTP response body to be captured | | maxResponseBodySize | number | 4096 (4 KB) | Sets maximum size limit for HTTP response body to be captured | | traceNetworkOperations | boolean | false | Enables tracing network timings by creating spans for the following traced network operations - DNS Lookup - TCP Connect - TLS Handshake - TTFB (Time To First Byte) - Content Transfer | | traceNetworkOperations | boolean | false | Enables tracing network timings by creating spans for the following traced network operations - DNS Lookup - TCP Connect - TLS Handshake - TTFB (Time To First Byte) - Content Transfer | | requestBodyMaskHook | HttpRequestBodyMaskFunction | - | Function for masking traced HTTP request body (for ex. deleting or hiding sensitive fields) | | responseBodyMaskHook | HttpResponseBodyMaskFunction | - | Function for masking traced HTTP response body (for ex. deleting or hiding sensitive fields) |

Examples

You can find examples under examples directory. To be able to run the example, you can run the following command:

npm run example

Roadmap

  • Support masking for captured HTTP request and/or response bodies by configured ignored keys (without custom function implementation)

Issues and Feedback

Issues Closed issues

Please use GitHub Issues for any bug report, feature request and support.

Contribution

Pull requests Closed pull requests Contributors

If you would like to contribute, please

  • Fork the repository on GitHub and clone your fork.
  • Create a branch for your changes and make your changes on it.
  • Send a pull request by explaining clearly what is your contribution.

Tip: Please check the existing pull requests for similar contributions and consider submit an issue to discuss the proposed feature before writing code.

License

Licensed under MIT License.