info

package
v0.55.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Overview

Package info exposes internal information about the trace-agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanInfoExtraLines

func CleanInfoExtraLines(info string) string

CleanInfoExtraLines removes empty lines from template code indentation. The idea is that an indented empty line (only indentation spaces) is because of code indentation, so we remove it. Real legit empty lines contain no space.

func Info

func Info(w io.Writer, conf *config.AgentConfig) error

Info writes a standard info message describing the running agent. This is not the current program, but an already running program, which we query with an HTTP request.

If error is nil, means the program is running. If not, it displays a pretty-printed message anyway (for support)

func InitInfo

func InitInfo(conf *config.AgentConfig) error

InitInfo initializes the info structure. It should be called only once.

func Languages

func Languages() []string

Languages exposes languages reporting traces to the Agent.

func UpdateRateByService

func UpdateRateByService(rbs map[string]float64)

UpdateRateByService updates the RateByService map and the filtered RateByServiceFiltered map.

func UpdateReceiverStats

func UpdateReceiverStats(rs *ReceiverStats)

UpdateReceiverStats updates internal stats about the receiver.

func UpdateStatsWriterInfo

func UpdateStatsWriterInfo(sws StatsWriterInfo)

UpdateStatsWriterInfo updates internal stats writer stats

func UpdateTraceWriterInfo

func UpdateTraceWriterInfo(tws TraceWriterInfo)

UpdateTraceWriterInfo updates internal trace writer stats

func UpdateWatchdogInfo

func UpdateWatchdogInfo(wi watchdog.Info)

UpdateWatchdogInfo updates internal stats about the watchdog.

Types

type EndpointStats

type EndpointStats struct {
	// TracesPayload is the number of traces payload sent, including errors.
	// If several URLs are given, each URL counts for one.
	TracesPayload int64
	// TracesPayloadError is the number of traces payload sent with an error.
	// If several URLs are given, each URL counts for one.
	TracesPayloadError int64
	// TracesBytes is the size of the traces payload data sent, including errors.
	// If several URLs are given, it does not change the size (shared for all).
	// This is the raw data, encoded, compressed.
	TracesBytes int64
	// TracesStats is the number of stats in the traces payload data sent, including errors.
	// If several URLs are given, it does not change the size (shared for all).
	TracesStats int64
}

EndpointStats contains stats about the volume of data written

type ReceiverStats

type ReceiverStats struct {
	sync.RWMutex
	Stats map[Tags]*TagStats
}

ReceiverStats is used to store all the stats per tags.

func NewReceiverStats

func NewReceiverStats() *ReceiverStats

NewReceiverStats returns a new ReceiverStats

func (*ReceiverStats) Acc

func (rs *ReceiverStats) Acc(recent *ReceiverStats)

Acc accumulates the stats from another ReceiverStats struct.

func (*ReceiverStats) GetTagStats

func (rs *ReceiverStats) GetTagStats(tags Tags) *TagStats

GetTagStats returns the struct in which the stats will be stored depending of their tags.

func (*ReceiverStats) Languages

func (rs *ReceiverStats) Languages() []string

Languages returns the set of languages reporting traces to the Agent.

func (*ReceiverStats) LogAndResetStats added in v0.41.0

func (rs *ReceiverStats) LogAndResetStats()

LogAndResetStats logs one-line summaries of ReceiverStats and resets internal data. Problematic stats are logged as warnings.

func (*ReceiverStats) PublishAndReset added in v0.41.0

func (rs *ReceiverStats) PublishAndReset(statsd statsd.ClientInterface)

PublishAndReset updates stats about per-tag stats

type SpansMalformed

type SpansMalformed struct {

	// DuplicateSpanID is when one or more spans in a trace have the same SpanId
	DuplicateSpanID atomic.Int64
	// ServiceEmpty is when a span has an empty Service field
	ServiceEmpty atomic.Int64
	// ServiceTruncate is when a span's Service is truncated for exceeding the max length
	ServiceTruncate atomic.Int64
	// ServiceInvalid is when a span's Service doesn't conform to Datadog tag naming standards
	ServiceInvalid atomic.Int64
	// PeerServiceTruncate is when a span's peer.service is truncated for exceeding the max length
	PeerServiceTruncate atomic.Int64
	// PeerServiceInvalid is when a span's peer.service doesn't conform to Datadog tag naming standards
	PeerServiceInvalid atomic.Int64
	// SpanNameEmpty is when a span's Name is empty
	SpanNameEmpty atomic.Int64
	// SpanNameTruncate is when a span's Name is truncated for exceeding the max length
	SpanNameTruncate atomic.Int64
	// SpanNameInvalid is when a span's Name doesn't conform to Datadog tag naming standards
	SpanNameInvalid atomic.Int64
	// ResourceEmpty is when a span's Resource is empty
	ResourceEmpty atomic.Int64
	// TypeTruncate is when a span's Type is truncated for exceeding the max length
	TypeTruncate atomic.Int64
	// InvalidStartDate is when a span's Start date is invalid
	InvalidStartDate atomic.Int64
	// InvalidDuration is when a span's Duration is invalid
	InvalidDuration atomic.Int64
	// InvalidHTTPStatusCode is when a span's metadata contains an invalid http status code
	InvalidHTTPStatusCode atomic.Int64
}

SpansMalformed contains counts for reasons malformed spans have been accepted after applying automatic fixes

func (*SpansMalformed) String

func (s *SpansMalformed) String() string

type Stats

type Stats struct {

	// TracesReceived is the total number of traces received, including the dropped ones.
	TracesReceived atomic.Int64
	// TracesFiltered is the number of traces filtered.
	TracesFiltered atomic.Int64
	// TracesPriorityNone is the number of traces with no sampling priority.
	TracesPriorityNone atomic.Int64
	// TracesPerPriority holds counters for each priority in position MaxAbsPriorityValue + priority.
	TracesPerSamplingPriority samplingPriorityStats
	// ClientDroppedP0Traces number of P0 traces dropped by client.
	ClientDroppedP0Traces atomic.Int64
	// ClientDroppedP0Spans number of P0 spans dropped by client.
	ClientDroppedP0Spans atomic.Int64
	// TracesBytes is the amount of data received on the traces endpoint (raw data, encoded, compressed).
	TracesBytes atomic.Int64
	// SpansReceived is the total number of spans received, including the dropped ones.
	SpansReceived atomic.Int64
	// SpansDropped is the number of spans dropped.
	SpansDropped atomic.Int64
	// SpansFiltered is the number of spans filtered.
	SpansFiltered atomic.Int64
	// EventsExtracted is the total number of APM events extracted from traces.
	EventsExtracted atomic.Int64
	// EventsSampled is the total number of APM events sampled.
	EventsSampled atomic.Int64
	// PayloadAccepted counts the number of payloads that have been accepted by the HTTP handler.
	PayloadAccepted atomic.Int64
	// PayloadRefused counts the number of payloads that have been rejected by the rate limiter.
	PayloadRefused atomic.Int64
	// TracesDropped contains stats about the count of dropped traces by reason
	TracesDropped *TracesDropped
	// SpansMalformed contains stats about the count of malformed traces by reason
	SpansMalformed *SpansMalformed
}

Stats holds the metrics that will be reported every 10s by the agent. Its fields require to be accessed in an atomic way.

Use NewStats to initialise.

func NewStats

func NewStats() Stats

NewStats returns new, ready to use stats.

type StatsWriterInfo

type StatsWriterInfo struct {
	Payloads       atomic.Int64
	ClientPayloads atomic.Int64
	StatsBuckets   atomic.Int64
	StatsEntries   atomic.Int64
	Errors         atomic.Int64
	Retries        atomic.Int64
	Splits         atomic.Int64
	Bytes          atomic.Int64
}

StatsWriterInfo represents statistics from the stats writer.

func (StatsWriterInfo) MarshalJSON added in v0.39.0

func (swi StatsWriterInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.MarshalJSON.

type StatusInfo

type StatusInfo struct {
	CmdLine  []string `json:"cmdline"`
	Pid      int      `json:"pid"`
	Uptime   int      `json:"uptime"`
	MemStats struct {
		Alloc uint64
	} `json:"memstats"`
	Version struct {
		Version   string
		GitCommit string
	} `json:"version"`
	Receiver      []TagStats         `json:"receiver"`
	RateByService map[string]float64 `json:"ratebyservice_filtered"`
	TraceWriter   TraceWriterInfo    `json:"trace_writer"`
	StatsWriter   StatsWriterInfo    `json:"stats_writer"`
	Watchdog      watchdog.Info      `json:"watchdog"`
	Config        config.AgentConfig `json:"config"`
}

StatusInfo is what we use to parse expvar response. It does not need to contain all the fields, only those we need to display when called with `-info` as JSON unmarshaller will automatically ignore extra fields.

type TagStats

type TagStats struct {
	Tags
	Stats
}

TagStats is the struct used to associate the stats with their set of tags.

func (*TagStats) AsTags

func (ts *TagStats) AsTags() []string

AsTags returns all the tags contained in the TagStats.

func (*TagStats) WarnString

func (ts *TagStats) WarnString() string

WarnString returns a string representation of the Stats struct containing only issues which we should be warning on if there are no issues then an empty string is returned

type Tags

type Tags struct {
	Lang, LangVersion, LangVendor, Interpreter, TracerVersion string
	EndpointVersion                                           string
	Service                                                   string
}

Tags holds the tags we parse when we handle the header of the payload.

type TraceWriterInfo

type TraceWriterInfo struct {
	Payloads          atomic.Int64
	Traces            atomic.Int64
	Events            atomic.Int64
	Spans             atomic.Int64
	Errors            atomic.Int64
	Retries           atomic.Int64
	Bytes             atomic.Int64
	BytesUncompressed atomic.Int64
	SingleMaxSize     atomic.Int64
}

TraceWriterInfo represents statistics from the trace writer.

func (TraceWriterInfo) MarshalJSON added in v0.39.0

func (twi TraceWriterInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.MarshalJSON.

type TracesDropped

type TracesDropped struct {

	// DecodingError is when the agent fails to decode a trace payload
	DecodingError atomic.Int64
	// PayloadTooLarge specifies the number of traces dropped due to the payload
	// being too large to be accepted.
	PayloadTooLarge atomic.Int64
	// EmptyTrace is when the trace contains no spans
	EmptyTrace atomic.Int64
	// TraceIDZero is when any spans in a trace have TraceId=0
	TraceIDZero atomic.Int64
	// SpanIDZero is when any span has SpanId=0
	SpanIDZero atomic.Int64
	// ForeignSpan is when a span in a trace has a TraceId that is different than the first span in the trace
	ForeignSpan atomic.Int64
	// Timeout is when a request times out.
	Timeout atomic.Int64
	// EOF is when an unexpected EOF is encountered, this can happen because the client has aborted
	// or because a bad payload (i.e. shorter than claimed in Content-Length) was sent.
	EOF atomic.Int64
	// MSGPShortBytes is when a msgp payload is bad due to missing bytes
	MSGPShortBytes atomic.Int64
}

TracesDropped contains counts for reasons traces have been dropped

func (*TracesDropped) String

func (s *TracesDropped) String() string

Jump to

Keyboard shortcuts

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