sfxtracing

package module
v1.3.1 Latest Latest
Warning

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

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

README

CircleCI GoDoc

SignalFx Tracing Library for Go

The SignalFx Tracing Library for Go helps you automatically instrument Go applications with instrumented library helpers and a tracer to capture and report distributed traces to SignalFx. You can also use the library to manually instrument Go applications with the OpenTracing API.

Requirements and supported software

These are the requirements to use the SignalFx Tracing Library for Go:

  • Go 1.12+
  • mod or dep dependency management tool

These are the supported libraries you can instrument:

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

Other libraries are available to instrument, but are in beta and aren't officially supported. You can view all the libraries in the contrib directory.

Configuration values

If the default configuration values don't apply for your environment, override them before running the process you instrument.

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. Send spans to a Smart Agent, OpenTelemetry Collector, or a SignalFx ingest endpoint.
WithAccessToken SIGNALFX_ACCESS_TOKEN none The access token for your SignalFx organization.
WithGlobalTag SIGNALFX_SPAN_TAGS none Comma-separated list of tags included in every reported span. For example, "key1:val1,key2:val2". Use only string values for tags.

Instrument a Go application

Follow these steps to instrument target libraries with provided instrumentors.

For more information about how to instrument a Go application, see the examples.

  1. Import github.com/signalfx/signalfx-go-tracing to your go mod or dep dependencies.

  2. Import the instrumentor for the target library you want to instrument and replace utilities with their traced equivalents.

    Find an instrumentor for each supported target library in the contrib directory. Each instrumentor has an example_test.go file that demonstrates how to instrument a target library. Don't import examples directly in your application.

  3. Enable tracing globally with tracing.Start(). This creates a tracer and registers it as the OpenTracing global tracer.

API

See the SignalFx Tracing Library for Go API on godoc.

Testing

Test locally using the Go toolset. The grpc.v12 integration will fail because it covers for deprecated methods. This is expected. 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

Index

Constants

View Source
const LibraryName = "go-tracing"
View Source
const Version = "1.3.1"

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
contrib
Shopify/sarama
Package sarama provides functions to trace the Shopify/sarama package (https://github.com/Shopify/sarama).
Package sarama provides functions to trace the Shopify/sarama package (https://github.com/Shopify/sarama).
aws/aws-sdk-go/aws
Package aws provides functions to trace aws/aws-sdk-go (https://github.com/aws/aws-sdk-go).
Package aws provides functions to trace aws/aws-sdk-go (https://github.com/aws/aws-sdk-go).
bradfitz/gomemcache/memcache
Package memcache provides functions to trace the bradfitz/gomemcache package (https://github.com/bradfitz/gomemcache).
Package memcache provides functions to trace the bradfitz/gomemcache package (https://github.com/bradfitz/gomemcache).
confluentinc/confluent-kafka-go/kafka
Package kafka provides functions to trace the confluentinc/confluent-kafka-go package (https://github.com/confluentinc/confluent-kafka-go).
Package kafka provides functions to trace the confluentinc/confluent-kafka-go package (https://github.com/confluentinc/confluent-kafka-go).
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).
emicklei/go-restful
Package restful provides functions to trace the emicklei/go-restful package (https://github.com/emicklei/go-restful).
Package restful provides functions to trace the emicklei/go-restful package (https://github.com/emicklei/go-restful).
garyburd/redigo
Package redigo provides functions to trace the garyburd/redigo package (https://github.com/garyburd/redigo).
Package redigo provides functions to trace the garyburd/redigo package (https://github.com/garyburd/redigo).
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).
globalsign/mgo
Package mgo provides functions and types which allow tracing of the MGO MongoDB client (https://github.com/globalsign/mgo)
Package mgo provides functions and types which allow tracing of the MGO MongoDB client (https://github.com/globalsign/mgo)
go-chi/chi
Package chi provides tracing functions for tracing the go-chi/chi package (https://github.com/go-chi/chi).
Package chi provides tracing functions for tracing the go-chi/chi package (https://github.com/go-chi/chi).
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).
gocql/gocql
Package gocql provides functions to trace the gocql/gocql package (https://github.com/gocql/gocql).
Package gocql provides functions to trace the gocql/gocql package (https://github.com/gocql/gocql).
gomodule/redigo
Package redigo provides functions to trace the gomodule/redigo package (https://github.com/gomodule/redigo).
Package redigo provides functions to trace the gomodule/redigo package (https://github.com/gomodule/redigo).
google.golang.org/api
Package api provides functions to trace the google.golang.org/api package.
Package api provides functions to trace the google.golang.org/api package.
google.golang.org/grpc
Package grpc is a generated protocol buffer package.
Package grpc is a generated protocol buffer package.
google.golang.org/grpc.v12
Package grpc is a generated protocol buffer package.
Package grpc is a generated protocol buffer package.
gorilla/mux
Package mux provides tracing functions for tracing the gorilla/mux package (https://github.com/gorilla/mux).
Package mux provides tracing functions for tracing the gorilla/mux package (https://github.com/gorilla/mux).
graph-gophers/graphql-go
Package graphql provides functions to trace the graph-gophers/graphql-go package (https://github.com/graph-gophers/graphql-go).
Package graphql provides functions to trace the graph-gophers/graphql-go package (https://github.com/graph-gophers/graphql-go).
jinzhu/gorm
Package gorm provides helper functions for tracing the jinzhu/gorm package (https://github.com/jinzhu/gorm).
Package gorm provides helper functions for tracing the jinzhu/gorm package (https://github.com/jinzhu/gorm).
jmoiron/sqlx
Package sqlx provides functions to trace the jmoiron/sqlx package (https://github.com/jmoiron/sqlx).
Package sqlx provides functions to trace the jmoiron/sqlx package (https://github.com/jmoiron/sqlx).
julienschmidt/httprouter
Package httprouter provides functions to trace the julienschmidt/httprouter package (https://github.com/julienschmidt/httprouter).
Package httprouter provides functions to trace the julienschmidt/httprouter package (https://github.com/julienschmidt/httprouter).
k8s.io/client-go/kubernetes
Package kubernetes provides functions to trace k8s.io/client-go (https://github.com/kubernetes/client-go).
Package kubernetes provides functions to trace k8s.io/client-go (https://github.com/kubernetes/client-go).
labstack/echo
Package echo provides functions to trace the labstack/echo package (https://github.com/labstack/echo).
Package echo provides functions to trace the labstack/echo package (https://github.com/labstack/echo).
labstack/echo.v4
Package echo provides functions to trace the labstack/echo/v4 package (https://github.com/labstack/echo).
Package echo provides functions to trace the labstack/echo/v4 package (https://github.com/labstack/echo).
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).
net/http
Package http provides functions to trace the net/http package (https://golang.org/pkg/net/http).
Package http provides functions to trace the net/http package (https://golang.org/pkg/net/http).
olivere/elastic
Package elastic provides functions to trace the gopkg.in/olivere/elastic.v{3,5} packages.
Package elastic provides functions to trace the gopkg.in/olivere/elastic.v{3,5} packages.
syndtr/goleveldb/leveldb
Package leveldb provides functions to trace the syndtr/goleveldb package (https://github.com/syndtr/goleveldb).
Package leveldb provides functions to trace the syndtr/goleveldb package (https://github.com/syndtr/goleveldb).
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