internal

package
v1.60.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvGitMetadataEnabledFlag specifies the environment variable name for enable/disable
	EnvGitMetadataEnabledFlag = "DD_TRACE_GIT_METADATA_ENABLED"
	// EnvGitRepositoryURL specifies the environment variable name for git repository URL
	EnvGitRepositoryURL = "DD_GIT_REPOSITORY_URL"
	// EnvGitCommitSha specifies the environment variable name git commit sha
	EnvGitCommitSha = "DD_GIT_COMMIT_SHA"
	// EnvDDTags specifies the environment variable name global tags
	EnvDDTags = "DD_TAGS"

	// TagRepositoryURL specifies the tag name for git repository URL
	TagRepositoryURL = "git.repository_url"
	// TagCommitSha specifies the tag name for git commit sha
	TagCommitSha = "git.commit.sha"
	// TagGoPath specifies the tag name for go module path
	TagGoPath = "go_path"

	// TraceTagRepositoryURL specifies the trace tag name for git repository URL
	TraceTagRepositoryURL = "_dd.git.repository_url"
	// TraceTagCommitSha specifies the trace tag name for git commit sha
	TraceTagCommitSha = "_dd.git.commit.sha"
	// TraceTagGoPath specifies the trace tag name for go module path
	TraceTagGoPath = "_dd.go_path"
)

Variables

View Source
var ActiveSpanKey = contextKey{}

ActiveSpanKey is used to set tracer context on a context.Context objects with a unique key

Functions

func AgentURLFromEnv added in v1.44.0

func AgentURLFromEnv() *url.URL

AgentURLFromEnv determines the trace agent URL from environment variable DD_TRACE_AGENT_URL. If the determined value is valid and the scheme is supported (unix, http or https), it will return an *url.URL. Otherwise, it returns nil.

func BoolEnv added in v1.26.0

func BoolEnv(key string, def bool) bool

BoolEnv returns the parsed boolean value of an environment variable, or def otherwise.

func CleanGitMetadataTags added in v1.48.0

func CleanGitMetadataTags(tags map[string]string)

CleanGitMetadataTags cleans up tags from git metadata

func ContainerID

func ContainerID() string

ContainerID attempts to return the container ID from /proc/self/cgroup or empty on failure.

func DurationEnv added in v1.47.0

func DurationEnv(key string, def time.Duration) time.Duration

DurationEnv returns the parsed duration value of an environment variable, or def otherwise.

func EntityID added in v1.60.0

func EntityID() string

EntityID attempts to return the container ID or the cgroup node controller's inode if the container ID is not available. The cid is prefixed with `cid-` and the inode with `in-`.

func FloatEnv added in v1.59.0

func FloatEnv(key string, def float64) float64

FloatEnv returns the parsed float64 value of an environment variable, or def otherwise.

func ForEachStringTag added in v1.48.0

func ForEachStringTag(str string, fn func(key string, val string))

ForEachStringTag runs fn on every key:val pair encountered in str. str may contain multiple key:val pairs separated by either space or comma (but not a mixture of both).

func GetGitMetadataTags added in v1.48.0

func GetGitMetadataTags() map[string]string

GetGitMetadataTags returns git metadata tags

func GetTracerGitMetadataTags added in v1.48.0

func GetTracerGitMetadataTags() map[string]string

GetTracerGitMetadataTags returns git metadata tags for tracer NB: Currently tracer inject tags with some workaround (only with _dd prefix and only for the first span in payload) So we provide different tag names

func IntEnv added in v1.36.0

func IntEnv(key string, def int) int

IntEnv returns the parsed int value of an environment variable, or def otherwise.

func IsExecutionTraced added in v1.53.0

func IsExecutionTraced(ctx context.Context) bool

IsExecutionTraced returns whether ctx is associated with an execution trace task, as indicated via WithExecutionTraced

func ParseTagString added in v1.48.0

func ParseTagString(str string) map[string]string

ParseTagString returns tags parsed from string as map

func ResetGitMetadataTags added in v1.48.0

func ResetGitMetadataTags()

ResetGitMetadataTags reset cashed metadata tags

func WithExecutionNotTraced added in v1.53.0

func WithExecutionNotTraced(ctx context.Context) context.Context

WithExecutionNotTraced marks that the context is *not* covered by an execution trace task. This is intended to prevent child spans (which inherit information from ctx) from being considered covered by a task, when an integration may create its own child span with its own execution trace task.

func WithExecutionTraced added in v1.53.0

func WithExecutionTraced(ctx context.Context) context.Context

WithExecutionTraced marks ctx as being associated with an execution trace task. It is assumed that ctx already contains a trace task. The caller is responsible for ending the task.

This is intended for a specific case where the database/sql contrib package only creates spans *after* an operation, in case the operation was unavailable, and thus execution trace tasks tied to the span only capture the very end. This function enables creating a task *before* creating a span, and communicating to the APM tracer that it does not need to create a task. In general, APM instrumentation should prefer creating tasks around the operation rather than after the fact, if possible.

Types

type LockMap added in v1.53.0

type LockMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LockMap uses an RWMutex to synchronize map access to allow for concurrent access. This should not be used for cases with heavy write load and performance concerns.

func NewLockMap added in v1.53.0

func NewLockMap(m map[string]string) *LockMap

func (*LockMap) Clear added in v1.53.0

func (l *LockMap) Clear()

func (*LockMap) Get added in v1.53.0

func (l *LockMap) Get(k string) string

func (*LockMap) Iter added in v1.53.0

func (l *LockMap) Iter(f func(key string, val string))

Iter iterates over all the map entries passing in keys and values to provided func f. Note this is READ ONLY.

func (*LockMap) Len added in v1.53.0

func (l *LockMap) Len() int

func (*LockMap) Set added in v1.53.0

func (l *LockMap) Set(k, v string)

type StatsdClient added in v1.55.0

type StatsdClient interface {
	Incr(name string, tags []string, rate float64) error
	Count(name string, value int64, tags []string, rate float64) error
	Gauge(name string, value float64, tags []string, rate float64) error
	Timing(name string, value time.Duration, tags []string, rate float64) error
	Flush() error
	Close() error
}

Directories

Path Synopsis
dyngo
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
Package dyngo is the Go implementation of Datadog's Instrumentation Gateway which provides an event-based instrumentation API based on a stack representation of instrumented functions along with nested event listeners.
emitter
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
Package emitter provides functions and types used to instrument go libraries to integrate them with Datadog AppSec features.
emitter/graphqlsec
Package graphql is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
Package graphql is the GraphQL instrumentation API and contract for AppSec defining an abstract run-time representation of AppSec middleware.
emitter/grpcsec
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
Package grpcsec is the gRPC instrumentation API and contract for AppSec defining an abstract run-time representation of gRPC handlers.
emitter/httpsec
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
Package httpsec defines is the HTTP instrumentation API and contract for AppSec.
listener
Package listener provides functions and types used to listen to AppSec instrumentation events produced by code usintrumented using the functions and types found in gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/emitter.
Package listener provides functions and types used to listen to AppSec instrumentation events produced by code usintrumented using the functions and types found in gopkg.in/DataDog/dd-trace-go.v1/internal/appsec/emitter.
trace
Package trace provides functions to annotate trace spans with AppSec related information.
Package trace provides functions to annotate trace spans with AppSec related information.
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.
cachedfetch
Package cachedfetch provides a read-through cache for fetched values.
Package cachedfetch provides a read-through cache for fetched values.
ec2
ecs
gce
validate
Package validate provides hostname validation helpers
Package validate provides hostname validation helpers
Package httpmem provides an in-memory HTTP server and client, for testing
Package httpmem provides an in-memory HTTP server and client, for testing
Package log provides logging utilities for the tracer.
Package log provides logging utilities for the tracer.
Package namingschema provides functionality to create naming schemas used by integrations to set different service and span/operation names based on the value of the DD_TRACE_SPAN_ATTRIBUTE_SCHEMA environment variable.
Package namingschema provides functionality to create naming schemas used by integrations to set different service and span/operation names based on the value of the DD_TRACE_SPAN_ATTRIBUTE_SCHEMA environment variable.
Package normalizer provides tag normalization
Package normalizer provides tag normalization
Package osinfo provides information about the current operating system release
Package osinfo provides information about the current operating system release
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.
Package telemetry implements a client for sending telemetry information to Datadog regarding usage of an APM library such as tracing or profiling.
telemetrytest
Package telemetrytest provides a mock implementation of the telemetry client for testing purposes
Package telemetrytest provides a mock implementation of the telemetry client for testing purposes
Package traceprof contains shared logic for cross-cutting tracer/profiler features.
Package traceprof contains shared logic for cross-cutting tracer/profiler features.
testapp
Package testapp has the protbuf/grpc definitions for the test application implemented in traceproftest.
Package testapp has the protbuf/grpc definitions for the test application implemented in traceproftest.
traceproftest
Package traceproftest contains test cases and test helpers for testing cross-cutting tracer/profiler features such as code hotspots and endpoints.
Package traceproftest contains test cases and test helpers for testing cross-cutting tracer/profiler features such as code hotspots and endpoints.

Jump to

Keyboard shortcuts

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