Giter VIP home page Giter VIP logo

dd-trace-go's Introduction

CircleCI Godoc

Datadog APM client that implements an OpenTracing Tracer.

Initialization

To start using the Datadog Tracer with the OpenTracing API, you should first initialize the tracer with a proper Configuration object:

import (
	// ddtrace namespace is suggested
	ddtrace "github.com/DataDog/dd-trace-go/opentracing"
	opentracing "github.com/opentracing/opentracing-go"
)

func main() {
	// create a Tracer configuration
	config := ddtrace.NewConfiguration()
	config.ServiceName = "api-intake"
	config.AgentHostname = "ddagent.consul.local"

	// initialize a Tracer and ensure a graceful shutdown
	// using the `closer.Close()`
	tracer, closer, err := ddtrace.NewTracer(config)
	if err != nil {
		// handle the configuration error
	}
	defer closer.Close()

	// set the Datadog tracer as a GlobalTracer
	opentracing.SetGlobalTracer(tracer)
	startWebServer()
}

Function NewTracer(config) returns an io.Closer instance that can be used to gracefully shutdown the tracer. It's recommended to always call the closer.Close(), otherwise internal buffers are not flushed and you may lose some traces.

Usage

See Opentracing documentation for some usage patterns. Legacy documentation is available in GoDoc format.

Contributing Quick Start

Requirements:

  • Go 1.7 or later
  • Docker

Run the tests

The best way to run the tests is using the CircleCI CLI. Simply run circleci build in the repository root. Note that you might have to increase the resources dedicated to Docker to around 4GB.

Further Reading

Automatically traced libraries and frameworks: https://godoc.org/github.com/DataDog/dd-trace-go/tracer#pkg-subdirectories Sample code: https://godoc.org/github.com/DataDog/dd-trace-go/tracer#pkg-examples

dd-trace-go's People

Contributors

awang avatar bmermet avatar chibimi avatar clutchski avatar conorbranagan avatar danielni avatar ejholmes avatar elijahandrews avatar galdor avatar gbbr avatar hamiltop avatar hawknewton avatar jbonzo avatar leocavaille avatar lotharsee avatar mogigoma avatar pierrre avatar raphaelgavache avatar talwai avatar ufoot avatar vbehar avatar vlad-mh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.