signalfx-go-tracing

command module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: BSD-3-Clause Imports: 0 Imported by: 0

README

CircleCI GoDoc

Installing

Add github.com/abulo/signalfx-go-tracing to your go mod or dep dependencies.

Requires:

  • Go 1.12+
  • mod or dep

Configuration

Configuration values can be set either from environmental variables or code:

Code Environment Variable Default Value Notes
WithServiceName SIGNALFX_SERVICE_NAME SignalFx-Tracing The name of the service.
WithEndpointURL SIGNALFX_ENDPOINT_URL http://localhost:9080/v1/trace The URL to send traces to.
WithAccessToken SIGNALFX_ACCESS_TOKEN none
WithGlobalTag SIGNALFX_SPAN_TAGS none Comma-separated list of tags included in every reported span. For example, "key1:val1,key2:val2". Note: The current transport format is Zipkin which only supports string values for tags.

Note: The current transport format is Zipkin which only supports string values for tags.

Getting Started

When your application starts enable tracing globally with tracing.Start. For Go or 3rd party libraries you will need to use the wrapper libraries from contrib to have traces automatically emitted.

Here's a basic example of instrumenting Redis:

package main

import (
	"github.com/go-redis/redis"
	redistrace "github.com/abulo/signalfx-go-tracing/contrib/go-redis/redis"
	"github.com/abulo/signalfx-go-tracing/tracing"
)

func main() {
	tracing.Start()
	defer tracing.Stop()

	opts := &redis.Options{Addr: "127.0.0.1:6379", Password: "", DB: 0}
	c := redistrace.NewClient(opts)

	c.Set("test_key", "test_value", 0)
}

Instrumentations

These are the currently supported instrumentations with the minimum version requirement.

Library Version
database/sql Standard Library
gin-gonic/gin 1.5.0
globalsign/mgo r2018.06.15+
gorilla/mux 1.7+
labstack/echo 4.0+
mongodb/mongo-go-driver 1.0+
net/http Standard Library

API

The API is documented on godoc.

Testing

Tests can be run locally using the Go toolset. The grpc.v12 integration will fail (and this is normal), because it covers for deprecated methods. In the CI environment we vendor this version of the library inside the integration. Under normal circumstances this is not something that we want to do, because users using this integration might be running versions different from the vendored one, creating hard to debug conflicts.

To run integration tests locally, you should set the INTEGRATION environment variable. The dependencies of the integration tests are best run via Docker. To get an idea about the versions and the set-up take a look at our CI config.

The best way to run the entire test suite 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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
contrib
database/sql
Package sql provides functions to trace the database/sql package (https://golang.org/pkg/database/sql).
Package sql provides functions to trace the database/sql package (https://golang.org/pkg/database/sql).
gin-gonic/gin
Package gin provides functions to trace the gin-gonic/gin package (https://github.com/gin-gonic/gin).
Package gin provides functions to trace the gin-gonic/gin package (https://github.com/gin-gonic/gin).
go-redis/redis
Package redis provides tracing functions for tracing the go-redis/redis package (https://github.com/go-redis/redis).
Package redis provides tracing functions for tracing the go-redis/redis package (https://github.com/go-redis/redis).
mongodb/mongo-go-driver/mongo
Package mongo provides functions to trace the mongodb/mongo-go-driver package (https://go.mongodb.org/mongo-driver).
Package mongo provides functions to trace the mongodb/mongo-go-driver package (https://go.mongodb.org/mongo-driver).
Package ddtrace contains the interfaces that specify the implementations of Datadog's tracing library, as well as a set of sub-packages containing various implementations: our native implementation ("tracer"), a wrapper that can be used with Opentracing ("opentracer") and a mock tracer to be used for testing ("mocktracer").
Package ddtrace contains the interfaces that specify the implementations of Datadog's tracing library, as well as a set of sub-packages containing various implementations: our native implementation ("tracer"), a wrapper that can be used with Opentracing ("opentracer") and a mock tracer to be used for testing ("mocktracer").
ext
Package ext contains a set of Datadog-specific constants.
Package ext contains a set of Datadog-specific constants.
mocktracer
Package mocktracer provides a mock implementation of the tracer used in testing.
Package mocktracer provides a mock implementation of the tracer used in testing.
opentracer
Package opentracer provides a wrapper on top of the Datadog tracer that can be used with Opentracing.
Package opentracer provides a wrapper on top of the Datadog tracer that can be used with Opentracing.
tracer
Package tracer contains Datadog's core tracing client.
Package tracer contains Datadog's core tracing client.
internal
globalconfig
Package globalconfig stores configuration which applies globally to both the tracer and integrations.
Package globalconfig stores configuration which applies globally to both the tracer and integrations.

Jump to

Keyboard shortcuts

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