instrumentation

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ParentSpanGormKey is the name of the parent span key
	ParentSpanGormKey = "tracingParentSpan"
	// SpanGormKey is the name of the span key
	SpanGormKey = "tracingSpan"
)

Variables

This section is empty.

Functions

func InstrumentAWSSession

func InstrumentAWSSession(session *awssession.Session, settings Settings) *awssession.Session

InstrumentAWSSession configures DD tracing mode.

func InstrumentDatabase

func InstrumentDatabase(db *gorm.DB, appName string)

InstrumentDatabase adds callbacks for tracing, call TraceDatabase to make it work

func TraceDatabase

func TraceDatabase(ctx context.Context, db *gorm.DB) *gorm.DB

TraceDatabase sets span to gorm settings, returns cloned DB

Types

type Config

type Config struct {
	Enabled bool `mapstructure:"enabled"`

	ServiceName    string `mapstructure:"service_name"`
	ServiceVersion string `mapstructure:"service_version"`
	// Enable Profiler Code Hotspots feature
	CodeHotspotsEnabled bool `mapstructure:"code_hotspots_enabled"`
	// Enable runtime metrics.
	RuntimeMetricsEnabled bool `mapstructure:"runtime_metrics_enabled"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns a new ServerConfig instance.

type LogContext

type LogContext struct {
	// TraceID returns the trace ID that this context is carrying.
	TraceID uint64

	// SpanID returns the span ID that this context is carrying.
	SpanID uint64
}

LogContext represents a log state that can be used to collerate logs emitted across the request cycle.

func TraceLogs

func TraceLogs(ctx context.Context) *LogContext

TraceLogs extracts and returns a LogContext for Logs.

type Profiler

type Profiler struct {
	// contains filtered or unexported fields
}

Profiler wraps DataDog profiles exporter.

func NewProfiler

func NewProfiler(config *Config, options ...profiler.Option) *Profiler

NewProfiler constructs new profiler with options. You can include common options like: profiler.WithService(appName), profiler.WithVersion(version).

func (*Profiler) Start

func (p *Profiler) Start() error

Start calls DD profiler with options set during Profiler construction.

func (*Profiler) Stop

func (p *Profiler) Stop()

Stop DataDog profiles exporter.

type Settings

type Settings struct {
	AppName       string
	Analytics     bool
	AnalyticsRate float64
}

Settings stores DataDog instrumentation settings.

type Tracer

type Tracer struct {
	Enabled     bool
	Environment string
	Options     []tracer.StartOption
	// contains filtered or unexported fields
}

Tracer is a "controller" to a ddtrace.tracer.

Tracer is not exactly a "wrapper" because the tracer is a private/global entity in the tracer library and it's not directly accessible. - https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer#Start - https://github.com/DataDog/dd-trace-go/blob/v1.19.0/ddtrace/tracer/tracer.go

Tracer specifies an implementation of the Datadog tracer which allows starting and propagating spans.

func NewTracer

func NewTracer(config *Config, options ...tracer.StartOption) *Tracer

NewTracer returns a new tracer with the giver configuration and an optional list of ddtrace's tracer.StartOptions.

NewTracer assigns universal the version of the service that is running, and will be applied to all spans, regardless of whether span service name and config service name match.

func (*Tracer) Router

func (t *Tracer) Router() *ddmux.Router

Router returns an instrumented-mux-compatible router instance traced with the global tracer.

Returning a Router is part of the Tracer API to ensure a single entry-point for the instrumentation features.

func (*Tracer) Start

func (t *Tracer) Start()

Start starts the current tracer.

func (*Tracer) Stop

func (t *Tracer) Stop()

Stop stops the current tracer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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