Documentation ¶
Overview ¶
Package traceprof contains shared logic for cross-cutting tracer/profiler features.
Index ¶
Constants ¶
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.
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 ¶
This section is empty.
Types ¶
type EndpointCounter ¶
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 ¶
func GlobalEndpointCounter() *EndpointCounter
GlobalEndpointCounter returns the endpoint counter that is shared between tracing and profiling to support the unit of work feature.
func NewEndpointCounter ¶
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 ¶
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 ¶
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 ¶
func (e *EndpointCounter) SetEnabled(enabled bool) bool
SetEnabled changes if endpoint counting is enabled or not. The previous value is returned.
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. |