opentracer

package
v1.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package opentracer provides a wrapper on top of the Datadog tracer that can be used with Opentracing. It also provides a set of opentracing.StartSpanOption that are specific to Datadog's APM product. To use it, simply call "New".

Note that there are currently some small incompatibilities between the Opentracing spec and the Datadog APM product, which we are in the process of addressing on the long term. When using Datadog, the Opentracing operation name is what is called resource in Datadog's terms and the Opentracing "component" tag is Datadog's operation name. Meaning that in order to define (in Opentracing terms) a span that has the operation name "/user/profile" and the component "http.request", one would do:

opentracing.StartSpan("http.request", opentracer.ResourceName("/user/profile"))

Some libraries and frameworks are supported out-of-the-box by using our integrations. You can see a list of supported integrations here: https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib. They are fully compatible with the Opentracing implementation.

Example
package main

import (
	opentracing "github.com/opentracing/opentracing-go"

	"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer"
	"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)

func main() {
	// Start a Datadog tracer, optionally providing a set of options,
	// returning an opentracing.Tracer which wraps it.
	t := opentracer.New(tracer.WithAgentAddr("host:port"))

	// Use it with the Opentracing API. The (already started) Datadog tracer
	// may be used in parallel with the Opentracing API if desired.
	opentracing.SetGlobalTracer(t)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...tracer.StartOption) opentracing.Tracer

New creates, instantiates and returns an Opentracing compatible version of the Datadog tracer using the provided set of options.

func ResourceName

func ResourceName(name string) opentracing.StartSpanOption

ResourceName can be used with opentracing.StartSpan to set the resource name of a span.

func ServiceName

func ServiceName(name string) opentracing.StartSpanOption

ServiceName can be used with opentracing.StartSpan to set the service name of a span.

func SpanName added in v1.11.0

func SpanName(name string) opentracing.StartSpanOption

SpanName sets the Datadog operation name for the span.

func SpanType

func SpanType(name string) opentracing.StartSpanOption

SpanType can be used with opentracing.StartSpan to set the type of a span.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL