Documentation ¶
Overview ¶
Package container2 collects data related to containers and formats into csv files to send to Densify.
Index ¶
Constants ¶
View Source
const ( BestEffort = "BestEffort" Burstable = "Burstable" Guaranteed = "Guaranteed" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ProcessExitEventProvider ¶
func (*ProcessExitEventProvider) CalculateRange ¶
func (peep *ProcessExitEventProvider) CalculateRange(historyInterval int) *v1.Range
func (*ProcessExitEventProvider) TimeAndValues ¶
func (peep *ProcessExitEventProvider) TimeAndValues(value *model.SamplePair) *common.TimeAndValues
TimeAndValues "parses" a Prometheus SamplePair (Timestamp and Value) and generates a time and values string from it. We need to extract the following data: - The timestamp (either the Prometheus timestamp OR embedded into the value) - The event count, typically 1 but may be higher (embedded into the value) - The exit code (embedded into the value) - Whether the process is PID 1 (embedded into the value)
As the value is a single float64, we construct it as follows.
- The integer part of the value is either the event count, or the timestamp multiplied by the event count (if we have an exact timestamp as a metric value)
- The fraction part of the value is constructed as follows: a) As the exit code is in the range 0..255, we divide it by 1,000 b) As in most cases isPid1 is true, we take the numeric value of !isPid1 and divide it by 10,000; so true yields 0 and false yields 0.0001 c) To avoid cases that math.Modf() will return values lesser than what we expect - which is possible due to floating point precision - we add 0.5 d) The result is the sum of a), b) and c); it is in the range 0.5000..0.7551
Parsing the value:
- Use math.Modf() to separate the integer and fraction parts of the value
- If the integer part is less than the minimal possible timestamp, it's assumed to be the event count, and then the timestamp comes from the Prometheus SamplePair;
- otherwise, it's the product of the timestamp and the event count and both are calculated from it
- Subtract 0.5 from the fraction part and multiply it by 1,000
- Round it to get the exit code
- Subtract the exit code from the fraction part and take the absolute value
- Multiply it by 10, round it and compare to 0 to get the isPid1 flag
Click to show internal directories.
Click to hide internal directories.