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

@epsagon/web

v1.3.8

Published

This package provides tracing to Node.js web applications for the collection of distributed tracing and performance metrics.

Downloads

172

Readme

Epsagon Tracing for Web

This package provides tracing to front end of web applications for the collection of distributed tracing and performance metrics in Epsagon.

Contents

Installation

To install Epsagon, simply run:

npm install @epsagon/web

Usage

To initialize the tracer, import the SDK and call the init function before the start of your project.

import epsagon from '@epsagon/web'

epsagon.init({
  token: 'epsagon-token',
  appName: 'app-name-stage',
})

Custom Tags

To add additional information to spans there are two methods available. Batch add user identity information with the epsagon.identity function, or use the epsagon.tag function to add your own custom information.

Options for epsagon.identify include { userId, userName, userEmail, companyId, companyName }.

epsagon.identify({
  userId: '7128f1a08a95e46c',
  userName: 'John Doe',
  userEmail: '[email protected]',
  companyId: 'fcffa7328813e4',
  companyName: 'Epsagon'
})

Custom tags can only be added one at a time by passing a key and value to the tag function.

epsagon.tag('PurchaseId', '2ef5b4bfdd')

Configuration

Advanced options can be configured as a parameter to the init() method.

|Parameter |Type |Default |Description | |-------------------|-------|-------------|-----------------------------------------------------------------------------------| |token |String |- |Epsagon account token | |appName |String |Epsagon Application|Application name that will be set for traces | |collectorURL |String |-|The address of the trace collector to send trace to | |metadataOnly |Boolean|false |Whether to send only the metadata (true) or also the payloads (false) | |propagateTraceHeaderUrls |Array|* |Which outgoing requests to add traceparent headers to. Defaults to all. | |urlPatternsToIgnore |Array|[] |Which outgoing requests to ignore (and not add traceparent to. Default to [] | |isEpsagonDisabled |Boolean|false |A flag to completely disable Epsagon (can be used for tests or locally) | |epsagonDebug |Boolean|false |Enable debug prints for troubleshooting. Note: if this flag is true, this will override the logLevel| |logLevel |String|INFO |The default Log level. Could be one of: DEBUG, INFO, WARN, ERROR, ALL.| |errorDisabled |Boolean|false |Disables collection of errors while still sending traces |

Trace Header Propagation

By default all outgoing requests will be added with a traceparent header which allows Epsagon to connect the front end trace to the backend traces. Some external services will not accept a traceparent header on request. If you need to limit the traceparent headers to requests to internal services, pass in an array of the hosts you do want to connect to in the propagateTraceHeaderUrls param in the config.

import epsagon from '@epsagon/web'

epsagon.init({
  token: 'epsagon-token',
  appName: 'app-name-stage',
  propagateTraceHeaderUrls: ['localhost', 'sub.example.com'],
  urlPatternsToIgnore: [".*example.*", ".*abc.*"]
})

Getting Help

If you have any issue around using the library or the product, please don't hesitate to:

  • Use the documentation.
  • Use the help widget inside the product.
  • Open an issue in GitHub.

Opening Issues

If you encounter a bug with the Epsagon library, we want to hear about it.

When opening a new issue, please provide as much information about the environment:

  • Library version, Node.js runtime version, dependencies, etc.
  • Snippet of the usage.
  • A reproducible example can really help.

The GitHub issues are intended for bug reports and feature requests. For help and questions about Epsagon, use the help widget inside the product.

License

Provided under the MIT license. See LICENSE for details.

Copyright 2021, Epsagon