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.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

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

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

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

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

  res.status(200)

  span.addTags({
    'resource': req.route.path, // required by Datadog
    'type': 'web', // required by Datadog
    'span.kind': 'server',
    'http.method': req.method,
    'http.url': req.url,
    'http.status_code': res.statusCode
  })

  span.finish()

  res.send('Hello, ' + req.params.name + '!')
})

app.listen(3000)

See the example folder to run this example.

API Documentation

See the OpenTracing JavaScript API

Additional Resources

Keywords

FAQs

Package last updated on 23 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