Documentation ¶
Overview ¶
Package api implements the HTTP server that receives payloads from clients.
Index ¶
- Variables
- func AttachEndpoint(e Endpoint)
- func NewMeasuredListener(ln net.Listener, name string, maxConn int, statsd statsd.ClientInterface) net.Listener
- func OnCloseConn(c net.Conn, onclose func()) net.Conn
- type Cache
- type DebugServer
- type Endpoint
- type HTTPReceiver
- type IDProvider
- type OTLPReceiver
- func (o *OTLPReceiver) Export(ctx context.Context, in ptraceotlp.ExportRequest) (ptraceotlp.ExportResponse, error)
- func (o *OTLPReceiver) ReceiveResourceSpans(ctx context.Context, rspans ptrace.ResourceSpans, httpHeader http.Header) source.Source
- func (o *OTLPReceiver) SetOTelAttributeTranslator(attrstrans *attributes.Translator)
- func (o *OTLPReceiver) Start()
- func (o *OTLPReceiver) Stop()
- type Payload
- type StatsProcessor
- type TelemetryForwarder
- type Version
Constants ¶
This section is empty.
Variables ¶
var EvpProxyAllowedHeaders = []string{"Content-Type", "Accept-Encoding", "Content-Encoding", "User-Agent", "DD-CI-PROVIDER-NAME"}
EvpProxyAllowedHeaders contains the headers that the proxy will forward. All others will be cleared.
Functions ¶
func AttachEndpoint ¶
func AttachEndpoint(e Endpoint)
AttachEndpoint attaches an additional endpoint to the trace-agent. It is not thread-safe and should be called before (pkg/trace.*Agent).Run or (*HTTPReceiver).Start. In other words, endpoint setup must be final before the agent or HTTP receiver starts.
func NewMeasuredListener ¶
func NewMeasuredListener(ln net.Listener, name string, maxConn int, statsd statsd.ClientInterface) net.Listener
NewMeasuredListener wraps ln and emits metrics every 10 seconds. The metric name is datadog.trace_agent.receiver.<name>. Additionally, a "status" tag will be added with potential values "accepted", "timedout" or "errored".
Types ¶
type Cache ¶ added in v0.40.0
type Cache struct {
// contains filtered or unexported fields
}
Cache provides a caching mechanism based on staleness toleration provided by requestor
type DebugServer ¶ added in v0.44.0
type DebugServer struct {
// contains filtered or unexported fields
}
DebugServer serves /debug/* endpoints
func NewDebugServer ¶ added in v0.44.0
func NewDebugServer(conf *config.AgentConfig) *DebugServer
NewDebugServer returns a debug server
func (*DebugServer) AddRoute ¶ added in v0.52.0
func (ds *DebugServer) AddRoute(route string, handler http.Handler)
AddRoute adds a route to the DebugServer
func (*DebugServer) Start ¶ added in v0.44.0
func (ds *DebugServer) Start()
Start configures and starts the http server
func (*DebugServer) Stop ¶ added in v0.44.0
func (ds *DebugServer) Stop()
Stop shuts down the debug server
type Endpoint ¶
type Endpoint struct { // Pattern specifies the API pattern, as registered by the HTTP handler. Pattern string // Handler specifies the http.Handler for this endpoint. Handler func(*HTTPReceiver) http.Handler // Hidden reports whether this endpoint should be hidden in the /info // discovery endpoint. Hidden bool // TimeoutOverride lets you specify a timeout for this endpoint that will be used // instead of the default one from conf.ReceiverTimeout TimeoutOverride func(conf *config.AgentConfig) time.Duration // IsEnabled specifies a function which reports whether this endpoint should be enabled // based on the given config conf. IsEnabled func(conf *config.AgentConfig) bool }
Endpoint specifies an API endpoint definition.
type HTTPReceiver ¶
type HTTPReceiver struct { Stats *info.ReceiverStats // contains filtered or unexported fields }
HTTPReceiver is a collector that uses HTTP protocol and just holds a chan where the spans received are sent one by one
func NewHTTPReceiver ¶
func NewHTTPReceiver( conf *config.AgentConfig, dynConf *sampler.DynamicConfig, out chan *Payload, statsProcessor StatsProcessor, telemetryCollector telemetry.TelemetryCollector, statsd statsd.ClientInterface, timing timing.Reporter) *HTTPReceiver
NewHTTPReceiver returns a pointer to a new HTTPReceiver
func (*HTTPReceiver) Languages ¶
func (r *HTTPReceiver) Languages() string
Languages returns the list of the languages used in the traces the agent receives.
func (*HTTPReceiver) Start ¶
func (r *HTTPReceiver) Start()
Start starts doing the HTTP server and is ready to receive traces
func (*HTTPReceiver) Stop ¶
func (r *HTTPReceiver) Stop() error
Stop stops the receiver and shuts down the HTTP server.
type IDProvider ¶ added in v0.40.0
IDProvider implementations are able to look up a container ID given a ctx and http header.
func NewIDProvider ¶ added in v0.40.0
func NewIDProvider(procRoot string) IDProvider
NewIDProvider initializes an IDProvider instance using the provided procRoot to perform cgroups lookups in linux environments.
type OTLPReceiver ¶
type OTLPReceiver struct { ptraceotlp.UnimplementedGRPCServer // contains filtered or unexported fields }
OTLPReceiver implements an OpenTelemetry Collector receiver which accepts incoming data on two ports for both plain HTTP and gRPC.
func NewOTLPReceiver ¶
func NewOTLPReceiver(out chan<- *Payload, cfg *config.AgentConfig, statsd statsd.ClientInterface, timing timing.Reporter) *OTLPReceiver
NewOTLPReceiver returns a new OTLPReceiver which sends any incoming traces down the out channel.
func (*OTLPReceiver) Export ¶
func (o *OTLPReceiver) Export(ctx context.Context, in ptraceotlp.ExportRequest) (ptraceotlp.ExportResponse, error)
Export implements ptraceotlp.Server
func (*OTLPReceiver) ReceiveResourceSpans ¶ added in v0.37.0
func (o *OTLPReceiver) ReceiveResourceSpans(ctx context.Context, rspans ptrace.ResourceSpans, httpHeader http.Header) source.Source
ReceiveResourceSpans processes the given rspans and returns the source that it identified from processing them.
func (*OTLPReceiver) SetOTelAttributeTranslator ¶ added in v0.56.0
func (o *OTLPReceiver) SetOTelAttributeTranslator(attrstrans *attributes.Translator)
SetOTelAttributeTranslator sets the attribute translator to be used by this OTLPReceiver
func (*OTLPReceiver) Start ¶
func (o *OTLPReceiver) Start()
Start starts the OTLPReceiver, if any of the servers were configured as active.
type Payload ¶
type Payload struct { // Source specifies information about the source of these traces, such as: // language, interpreter, tracer version, etc. Source *info.TagStats // TracerPayload holds the incoming payload from the tracer. TracerPayload *pb.TracerPayload // ClientComputedTopLevel specifies that the client has already marked top-level // spans. ClientComputedTopLevel bool // ClientComputedStats reports whether the client has computed and sent over stats // so that the agent doesn't have to. ClientComputedStats bool // ClientDroppedP0s specifies the number of P0 traces chunks dropped by the client. ClientDroppedP0s int64 }
Payload specifies information about a set of traces received by the API.
func (*Payload) Chunk ¶
func (p *Payload) Chunk(i int) *pb.TraceChunk
Chunk returns a chunk in TracerPayload by its index
func (*Payload) Chunks ¶
func (p *Payload) Chunks() []*pb.TraceChunk
Chunks returns chunks in TracerPayload
func (*Payload) RemoveChunk ¶
RemoveChunk removes a chunk in TracerPayload by its index
func (*Payload) ReplaceChunk ¶
func (p *Payload) ReplaceChunk(i int, chunk *pb.TraceChunk)
ReplaceChunk replaces a chunk in TracerPayload at a given index
type StatsProcessor ¶
type StatsProcessor interface { // ProcessStats takes a stats payload and consumes it. It is considered to be originating // from the given lang. ProcessStats(p *pb.ClientStatsPayload, lang, tracerVersion string) }
StatsProcessor implementations are able to process incoming client stats.
type TelemetryForwarder ¶ added in v0.57.0
type TelemetryForwarder struct {
// contains filtered or unexported fields
}
TelemetryForwarder sends HTTP requests to multiple targets. The handler returns immediately and the forwarding is done in the background.
To provide somne backpressure, we limit the number of concurrent forwarded requests
func NewTelemetryForwarder ¶ added in v0.57.0
func NewTelemetryForwarder(conf *config.AgentConfig, containerIDProvider IDProvider, statsd statsd.ClientInterface) *TelemetryForwarder
NewTelemetryForwarder creates a new TelemetryForwarder
func (*TelemetryForwarder) Stop ¶ added in v0.57.0
func (f *TelemetryForwarder) Stop()
Stop waits for up to 1s to end all telemetry forwarded requests.
type Version ¶
type Version string
Version is a dumb way to version our collector handlers
const ( // V06 API // // Request: Stats Payload. // Content-Type: application/msgpack // Payload: ClientStatsPayload (pkg/proto/datadog/trace/stats.proto) // // V06 Version = "v0.6" // V07 API // // Request: Tracer Payload. // Content-Type: application/msgpack // Payload: TracerPayload (pkg/proto/datadog/trace/tracer_payload.proto) // // Response: Service sampling rates (see description in v04). // V07 Version = "v0.7" )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package apiutil provides utility functions for the API.
|
Package apiutil provides utility functions for the API. |
internal
|
|
header
Package header defines HTTP headers known convention used by the Trace Agent and Datadog's APM intake.
|
Package header defines HTTP headers known convention used by the Trace Agent and Datadog's APM intake. |