Documentation ¶
Overview ¶
Package telemetry is responsible to handle telemetry usage.
Index ¶
- Constants
- func Client(parent *http.Client) *http.Client
- type Command
- type CommandResultParam
- type DataDog
- func (DataDog) Client(parent *http.Client) *http.Client
- func (DataDog) Close()
- func (d *DataDog) Middleware(next http.Handler) http.Handler
- func (DataDog) Name() Name
- func (DataDog) SpanFromContext(ctx context.Context) (Span, bool)
- func (DataDog) StartSpanForCommand(ctx context.Context, action string, resolver Command)
- type DataDogConfig
- type Name
- type NewRelic
- func (NewRelic) Client(parent *http.Client) *http.Client
- func (relic *NewRelic) Close()
- func (relic *NewRelic) Middleware(next http.Handler) http.Handler
- func (NewRelic) Name() Name
- func (relic *NewRelic) SpanFromContext(ctx context.Context) (Span, bool)
- func (*NewRelic) StartSpanForCommand(ctx context.Context, action string, resolver Command)
- type Span
- type SpanContext
- type Tracer
Constants ¶
const TracerKey string = "tracer"
TracerKey is the key used to define tracer key name when adding it on logging.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶ added in v1.3.0
type Command func(ctx context.Context) []CommandResultParam
Command is a callback function to be implemented with block segment that should be covered.
type CommandResultParam ¶ added in v1.3.0
type CommandResultParam struct { Key string Value interface{} }
CommandResultParam are the metrics to be attached as span's attributes.
type DataDog ¶
type DataDog struct{}
DataDog implements Tracer.
func NewDatadog ¶ added in v1.1.0
NewDatadog returns a new Datadog implementation.
func (*DataDog) Middleware ¶
Middleware add into http framework datadog tracer to track each requisition.
func (DataDog) SpanFromContext ¶ added in v0.3.0
SpanFromContext return span from context.Context.
type DataDogConfig ¶
type DataDogConfig struct { Env string `env:"ENV,required"` Service string `env:"SERVICE,required"` Version string // WithProfiler enables application profiling with Datadog's Profiler, reads // directly from optional environment variable WITH_PROFILER. // Although datadog claims low overhead with negligible impact in performance // for production workloads, beaware enabling it may cause performance impacts // in your application. We recommend enabling only when needed. WithProfiler bool `env:"WITH_PROFILER"` }
DataDogConfig is the struct of config given to NewDataDog.
type Name ¶ added in v0.3.0
type Name string
Name is a string type to hold the name of Tracer implemantation.
const ( // DataDogConfigPrefix is the prefix of datadog Environment. DataDogConfigPrefix = "DD_" // DataDogName is a string of type Name with holds the telemetry tool, which is "datadog". DataDogName Name = "datadog" )
const NewRelicName Name = "newrelic"
NewRelicName is a string of type Name, which is "newrelic".
type NewRelic ¶
type NewRelic struct {
// contains filtered or unexported fields
}
NewRelic implements Tracer.
func NewNewRelic ¶
NewNewRelic Create a new NewRelic instance.
func (*NewRelic) Close ¶ added in v0.2.0
func (relic *NewRelic) Close()
Close does nothing because it is not required to close connection with NewRelic Agent.
func (*NewRelic) Middleware ¶
Middleware add into http framework request tracing.
func (NewRelic) Name ¶ added in v0.3.0
Name returns the name of telemetry implementation used, this case is newrelic.
func (*NewRelic) SpanFromContext ¶ added in v0.3.0
SpanFromContext does nothing it is a mock method.
type Span ¶ added in v0.3.0
type Span interface {
Context() SpanContext
}
Span interface handle span usage.
type SpanContext ¶ added in v0.3.0
type SpanContext interface { // SpanID Return the SpanID SpanID() interface{} // TraceID returns the trace ID that this context is carrying. TraceID() interface{} ToMap() map[string]interface{} }
SpanContext handle spans in context.
type Tracer ¶
type Tracer interface { // Middleware must return a new handler with cross application tracing (CAT) or distributed tracing. Middleware(next http.Handler) http.Handler // Client wraps parent with tracing capabilities, parent is modified during this process. Client(parent *http.Client) *http.Client // Close should be called when the application end. Close() // Return the Name of Which implementation is using ex: DataDog, NewRelic Name() Name // Get SpanFromContext given SpanFromContext(ctx context.Context) (Span, bool) // StartSpanForCommand start a new span for a command. StartSpanForCommand(ctx context.Context, action string, resolver Command) }
A Tracer has methods to help tracer instrumentation of our services.