api

package
v0.37.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 49 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) 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 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

	// 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
	RateLimiter *rateLimiter
	// 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) *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.

func (*HTTPReceiver) TagStats

func (r *HTTPReceiver) TagStats(v Version, header http.Header) *info.TagStats

TagStats returns the stats and tags coinciding with the information found in header. For more information, check the "Datadog-Meta-*" HTTP headers defined in this file.

type OTLPIngestSummary added in v0.37.0

type OTLPIngestSummary struct {
	// Hostname indicates the hostname of the passed resource spans.
	Hostname string
	// Tags returns a set of Datadog-specific tags which are relevant for identifying
	// the source of the passed resource spans.
	Tags []string
}

OTLPIngestSummary returns a summary of the received resource spans.

type OTLPReceiver

type OTLPReceiver struct {
	// 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) *OTLPReceiver

NewOTLPReceiver returns a new OTLPReceiver which sends any incoming traces down the out channel.

func (*OTLPReceiver) Export

Export implements ptraceotlp.Server

func (*OTLPReceiver) ReceiveResourceSpans added in v0.37.0

func (o *OTLPReceiver) ReceiveResourceSpans(rspans ptrace.ResourceSpans, header http.Header, protocol string) OTLPIngestSummary

ReceiveResourceSpans processes the given rspans and sends them to writer.

func (*OTLPReceiver) ServeHTTP

func (o *OTLPReceiver) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler

func (*OTLPReceiver) Start

func (o *OTLPReceiver) Start()

Start starts the OTLPReceiver, if any of the servers were configured as active.

func (*OTLPReceiver) Stop

func (o *OTLPReceiver) Stop()

Stop stops any running server.

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

func (p *Payload) RemoveChunk(i int)

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 Version

type Version string

Version is a dumb way to version our collector handlers

const (

	// V07 API
	//
	// Content-Type: application/msgpack
	// Payload: TracerPayload (pkg/trace/pb/tracer_payload.proto)
	// Response: Service sampling rates.
	//
	V07 Version = "v0.7"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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