info

package
v0.37.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string
	GitCommit string
	GitBranch string
	BuildDate string
	GoVersion string
)

version info sourced from build flags

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.

func UpdateRateLimiter

func UpdateRateLimiter(ss RateLimiterStats)

UpdateRateLimiter updates internal stats about the rate limiting.

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.

func VersionString

func VersionString() string

VersionString returns the version information filled in at build time

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 RateLimiterStats

type RateLimiterStats struct {
	// TargetRate is the rate limiting rate that we are aiming for.
	TargetRate float64
	// RecentPayloadsSeen is the number of payloads that passed by.
	RecentPayloadsSeen float64
	// RecentTracesSeen is the number of traces that passed by.
	RecentTracesSeen float64
	// RecentTracesDropped is the number of traces that were dropped.
	RecentTracesDropped float64
}

RateLimiterStats contains rate limiting data. The public content might be interesting for statistics, logging.

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

func (rs *ReceiverStats) LogStats()

LogStats logs one-line summaries of ReceiverStats. Problematic stats are logged as warnings.

func (*ReceiverStats) Publish

func (rs *ReceiverStats) Publish()

Publish updates stats about per-tag stats

func (*ReceiverStats) Reset

func (rs *ReceiverStats) Reset()

Reset resets the ReceiverStats internal data

type SpansMalformed

type SpansMalformed struct {
	// DuplicateSpanID is when one or more spans in a trace have the same SpanId
	DuplicateSpanID int64
	// ServiceEmpty is when a span has an empty Service field
	ServiceEmpty int64
	// ServiceTruncate is when a span's Service is truncated for exceeding the max length
	ServiceTruncate int64
	// ServiceInvalid is when a span's Service doesn't conform to Datadog tag naming standards
	ServiceInvalid int64
	// SpanNameEmpty is when a span's Name is empty
	SpanNameEmpty int64
	// SpanNameTruncate is when a span's Name is truncated for exceeding the max length
	SpanNameTruncate int64
	// SpanNameInvalid is when a span's Name doesn't conform to Datadog tag naming standards
	SpanNameInvalid int64
	// ResourceEmpty is when a span's Resource is empty
	ResourceEmpty int64
	// TypeTruncate is when a span's Type is truncated for exceeding the max length
	TypeTruncate int64
	// InvalidStartDate is when a span's Start date is invalid
	InvalidStartDate int64
	// InvalidDuration is when a span's Duration is invalid
	InvalidDuration int64
	// InvalidHTTPStatusCode is when a span's metadata contains an invalid http status code
	InvalidHTTPStatusCode 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 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
	// TracesFiltered is the number of traces filtered.
	TracesFiltered int64
	// TracesPriorityNone is the number of traces with no sampling priority.
	TracesPriorityNone int64
	// TracesPerPriority holds counters for each priority in position MaxAbsPriorityValue + priority.
	TracesPerSamplingPriority samplingPriorityStats
	// ClientDroppedP0Traces number of P0 traces dropped by client.
	ClientDroppedP0Traces int64
	// ClientDroppedP0Spans number of P0 spans dropped by client.
	ClientDroppedP0Spans int64
	// TracesBytes is the amount of data received on the traces endpoint (raw data, encoded, compressed).
	TracesBytes int64
	// SpansReceived is the total number of spans received, including the dropped ones.
	SpansReceived int64
	// SpansDropped is the number of spans dropped.
	SpansDropped int64
	// SpansFiltered is the number of spans filtered.
	SpansFiltered int64
	// EventsExtracted is the total number of APM events extracted from traces.
	EventsExtracted int64
	// EventsSampled is the total number of APM events sampled.
	EventsSampled int64
	// PayloadAccepted counts the number of payloads that have been accepted by the HTTP handler.
	PayloadAccepted int64
	// PayloadRefused counts the number of payloads that have been rejected by the rate limiter.
	PayloadRefused int64
}

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       int64
	ClientPayloads int64
	StatsBuckets   int64
	StatsEntries   int64
	Errors         int64
	Retries        int64
	Splits         int64
	Bytes          int64
}

StatsWriterInfo represents statistics from the stats writer.

type StatusInfo

type StatusInfo struct {
	CmdLine  []string `json:"cmdline"`
	Pid      int      `json:"pid"`
	Uptime   int      `json:"uptime"`
	MemStats struct {
		Alloc uint64
	} `json:"memstats"`
	Version       infoVersion        `json:"version"`
	Receiver      []TagStats         `json:"receiver"`
	RateByService map[string]float64 `json:"ratebyservice"`
	TraceWriter   TraceWriterInfo    `json:"trace_writer"`
	StatsWriter   StatsWriterInfo    `json:"stats_writer"`
	Watchdog      watchdog.Info      `json:"watchdog"`
	RateLimiter   RateLimiterStats   `json:"ratelimiter"`
	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
}

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

type TraceWriterInfo

type TraceWriterInfo struct {
	Payloads          int64
	Traces            int64
	Events            int64
	Spans             int64
	Errors            int64
	Retries           int64
	Bytes             int64
	BytesUncompressed int64
	BytesEstimated    int64
	SingleMaxSize     int64
}

TraceWriterInfo represents statistics from the trace writer.

type TracesDropped

type TracesDropped struct {
	// DecodingError is when the agent fails to decode a trace payload
	DecodingError int64
	// PayloadTooLarge specifies the number of traces dropped due to the payload
	// being too large to be accepted.
	PayloadTooLarge int64
	// EmptyTrace is when the trace contains no spans
	EmptyTrace int64
	// TraceIDZero is when any spans in a trace have TraceId=0
	TraceIDZero int64
	// SpanIDZero is when any span has SpanId=0
	SpanIDZero int64
	// ForeignSpan is when a span in a trace has a TraceId that is different than the first span in the trace
	ForeignSpan int64
	// Timeout is when a request times out.
	Timeout 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 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