Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aller/express-opentracing

Package Overview
Dependencies
Maintainers
17
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aller/express-opentracing

This repo is to easier allow tracing on a unanimous way with express, + having access to a tracing-middleware for express with opentracing.

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
88
increased by22.22%
Maintainers
17
Weekly downloads
 
Created
Source

@aller/express-opentracing

This repo is to easier allow tracing on a unanimous way with express, + having access to a tracing-middleware for express with opentracing.

Usage;

Start global
import { startGlobalTracer } from '@aller/express-opentracing'

const { tracer, options } = startGlobalTracer()


// If you use @promster/express, this is a good place to add that middleware;
import { createMiddleware } from '@promster/express'

app.use(createMiddleware({ app, options }))
Add tracing-middleware
import { tracingMiddleware } from '@aller/express-opentracing'
[...]

app.use('/', tracingMiddleware({}: ITracingOptions), (_, _) => {
    [...]
})

[...]

Where with ITracingOptions you can define certain paths you would like to exclude from the traces with .ignoreRoute as a string-regex

Fetch-data with tracing
import { fetchWithTracing } from '@aller/express-opentracing'

const { body, headers } = await fetchWithTracing(
   {...}, req.span
)
Log data
import { log } from '@aller/express-opentracing'

[...]

log({
    span,
    event: 'EVENTNAME',
    description: 'DESCRIPTION',
    error?: Error
    phase: IPhase
})

[...]

Keywords

FAQs

Package last updated on 22 Oct 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc