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

datadog-tracer

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datadog-tracer

OpenTracing Tracer implementation for Datadog in JavaScript

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209
increased by25.15%
Maintainers
1
Weekly downloads
 
Created
Source

Datadog Tracer

npm Build Status codecov Code Climate Greenkeeper badge bitHound Dependencies

OpenTracing tracer implementation for Datadog in JavaScript. It is intended for use both on the server and (soon) in the browser.

Installation

NodeJS

npm install --save datadog-tracer

Node >= 4 is required.

Browser

Not yet supported

Usage

See the OpenTracing JavaScript documentation for more information.

Custom tracer options

  • service: name of the Datadog service
  • hostname: hostname of the Datadog agent (default: localhost)
  • port: port of the Datadog agent (default: 8126)
  • protocol: protocol of the Datadog agent (default: http)
  • endpoint: full URL of the Datadog agent (alternative to hostname+port+protocol)

Example

const express = require('express')
const Tracer = require('datadog-tracer')

const app = express()
const tracer = new Tracer({ service: 'example' })

// handle errors from Datadog agent. omit this if you want to ignore errors
tracer.on('error', e => console.log(e))

app.get('/hello/:name', (req, res) => {
  const span = tracer.startSpan('say_hello')

  span.addTags({
    'resource': '/hello/:name', // required by Datadog
    'type': 'web', // required by Datadog
    'span.kind': 'server',
    'http.method': 'GET',
    'http.url': req.url,
    'http.status_code': '200'
  })

  span.finish()

  res.send(`Hello, ${req.params.name}!`)
})

app.listen(3000)

See the example folder for a more advanced version.

API Documentation

See the OpenTracing JavaScript API

Additional Resources

Keywords

FAQs

Package last updated on 25 Apr 2017

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