traceprof

package
v1.67.0 Latest Latest
Warning

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

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

Documentation

Overview

Package traceprof contains shared logic for cross-cutting tracer/profiler features.

Index

Constants

View Source
const (
	SpanID          = "span id"
	LocalRootSpanID = "local root span id"
	TraceEndpoint   = "trace endpoint"
)

pprof labels applied by the tracer to show up in the profiler's profiles.

View Source
const (
	CodeHotspotsEnvVar  = "DD_PROFILING_CODE_HOTSPOTS_COLLECTION_ENABLED" // aka code hotspots
	EndpointEnvVar      = "DD_PROFILING_ENDPOINT_COLLECTION_ENABLED"      // aka endpoint profiling
	EndpointCountEnvVar = "DD_PROFILING_ENDPOINT_COUNT_ENABLED"           // aka unit of work
)

env variables used to control cross-cutting tracer/profiling features.

Variables

This section is empty.

Functions

func SetProfilerEnabled added in v1.53.0

func SetProfilerEnabled(val bool) bool

func SetProfilerRootTags added in v1.53.0

func SetProfilerRootTags(localRootSpan TagSetter)

Types

type EndpointCounter added in v1.47.0

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

EndpointCounter counts hits per endpoint.

TODO: This is a naive implementation with poor performance, e.g. 125ns/op in BenchmarkEndpointCounter on M1. We can do 10-20x better with something more complicated [1]. This will be done in a follow-up PR. [1] https://github.com/felixge/countermap/blob/main/xsync_map_counter_map.go

func GlobalEndpointCounter added in v1.47.0

func GlobalEndpointCounter() *EndpointCounter

GlobalEndpointCounter returns the endpoint counter that is shared between tracing and profiling to support the unit of work feature.

func NewEndpointCounter added in v1.47.0

func NewEndpointCounter(limit int) *EndpointCounter

NewEndpointCounter returns a new NewEndpointCounter that will track hit counts for up to limit endpoints. A limit of <= 0 indicates no limit.

func (*EndpointCounter) GetAndReset added in v1.47.0

func (e *EndpointCounter) GetAndReset() map[string]uint64

GetAndReset returns the hit counts for all endpoints and resets their counts back to 0.

func (*EndpointCounter) Inc added in v1.47.0

func (e *EndpointCounter) Inc(endpoint string)

Inc increments the hit counter for the given endpoint by 1. If endpoint counting is disabled, this method does nothing and is almost zero-cost.

func (*EndpointCounter) SetEnabled added in v1.47.0

func (e *EndpointCounter) SetEnabled(enabled bool) bool

SetEnabled changes if endpoint counting is enabled or not. The previous value is returned.

type TagSetter added in v1.53.0

type TagSetter interface{ SetTag(string, interface{}) }

Directories

Path Synopsis
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.
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