Documentation
¶
Overview ¶
Package info exposes internal information about the trace-agent.
Index ¶
- func CleanInfoExtraLines(info string) string
- func Info(w io.Writer, conf *config.AgentConfig) error
- func InitInfo(conf *config.AgentConfig) error
- func Languages() []string
- func UpdateRateByService(rbs map[string]float64)
- func UpdateReceiverStats(rs *ReceiverStats)
- func UpdateStatsWriterInfo(sws *StatsWriterInfo)
- func UpdateTraceWriterInfo(tws *TraceWriterInfo)
- func UpdateWatchdogInfo(wi watchdog.Info)
- type EndpointStats
- type ReceiverStats
- type SpansMalformed
- type Stats
- type StatsWriterInfo
- type StatusInfo
- type TagStats
- type Tags
- type TraceWriterInfo
- type TracesDropped
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanInfoExtraLines ¶
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 package, exposing some metrics and data via expvar
func UpdateRateByService ¶
UpdateRateByService updates the sampling rate by service map
func UpdateReceiverStats ¶
func UpdateReceiverStats(rs *ReceiverStats)
UpdateReceiverStats updates all stats associated with 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 ¶
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
SendAllStats bool // if true, all stats will be published even those stats that are zero, otherwise some less-frequently-used stats will be omitted when zero to save costs
}
ReceiverStats is used to store all the stats per tags.
func NewReceiverStats ¶
func NewReceiverStats(sendAllStats bool) *ReceiverStats
NewReceiverStats returns a new ReceiverStats sendAllStats is a boolean that controls whether all stats will be published even those stats that are zero, otherwise some less-frequently-used stats will be omitted when zero to save costs
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
// BaseServiceTruncate is when a span's _dd.base_service is truncated for exceeding the max length
BaseServiceTruncate atomic.Int64
// BaseServiceInvalid is when a span's _dd.base_service doesn't conform to Datadog tag naming standards
BaseServiceInvalid 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.
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) Acc ¶ added in v0.67.0
func (swi *StatsWriterInfo) Acc(update *StatsWriterInfo)
Acc accumulates stats from the incoming update info
func (*StatsWriterInfo) MarshalJSON ¶ added in v0.39.0
func (swi *StatsWriterInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.MarshalJSON.
func (*StatsWriterInfo) Reset ¶ added in v0.67.0
func (swi *StatsWriterInfo) Reset()
Reset all the stored info to zero
type StatusInfo ¶
type StatusInfo struct {
CmdLine []string `json:"cmdline"`
Pid string `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 ¶
TagStats is the struct used to associate the stats with their set of tags.
func (*TagStats) WarnString ¶
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) Acc ¶ added in v0.67.0
func (twi *TraceWriterInfo) Acc(update *TraceWriterInfo)
Acc accumulates stats from the incoming update info
func (*TraceWriterInfo) MarshalJSON ¶ added in v0.39.0
func (twi *TraceWriterInfo) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.MarshalJSON.
func (*TraceWriterInfo) Reset ¶ added in v0.67.0
func (twi *TraceWriterInfo) Reset()
Reset all the stored info to zero
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