Documentation
¶
Index ¶
Constants ¶
const ( ProwLabelNameCreated model.LabelName = "label_created_by_prow" ProwLabelNameContext model.LabelName = "label_prow_k8s_io_context" ProwLabelNameJob model.LabelName = "label_prow_k8s_io_job" ProwLabelNameType model.LabelName = "label_prow_k8s_io_type" ProwLabelNameOrg model.LabelName = "label_prow_k8s_io_refs_org" ProwLabelNameRepo model.LabelName = "label_prow_k8s_io_refs_repo" ProwLabelNameBranch model.LabelName = "label_prow_k8s_io_refs_base_ref" LabelNameRehearsal model.LabelName = "label_ci_openshift_org_rehearse" LabelNameCreated model.LabelName = "label_created_by_ci" LabelNameOrg model.LabelName = "label_ci_openshift_io_metadata_org" LabelNameRepo model.LabelName = "label_ci_openshift_io_metadata_repo" LabelNameBranch model.LabelName = "label_ci_openshift_io_metadata_branch" LabelNameVariant model.LabelName = "label_ci_openshift_io_metadata_variant" LabelNameTarget model.LabelName = "label_ci_openshift_io_metadata_target" LabelNameStep model.LabelName = "label_ci_openshift_io_metadata_step" LabelNamePod model.LabelName = "pod" LabelNameContainer model.LabelName = "container" LabelNameBuild model.LabelName = "label_openshift_io_build_name" LabelNameRelease model.LabelName = "label_ci_openshift_io_release" LabelNameApp model.LabelName = "label_app" LabelNameMeasured model.LabelName = "label_pod_scaler_openshift_io_measured" )
const ( // PodLabelMeasured is the Kubernetes pod label used by the admission webhook // to mark pods as measured or unmeasured. PodLabelMeasured = "pod-scaler.openshift.io/measured" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedQuery ¶
type CachedQuery struct {
// Query is the query we executed against Prometheus to get this data.
Query string `json:"query"`
// RangesByCluster stores time ranges for which we've succeeded in getting this
// data fromm Prometheus servers on the clusters we're querying.
RangesByCluster map[string][]TimeRange `json:"ranges_by_cluster"`
// Data holds the digested metric data, indexed by the metric fingerprint.
// We digest data into log-linear histograms to allow for aggregation while
// saving enormous amounts of space and incurring only minimal accuracy loss:
// https://www.circonus.com/2018/11/the-problem-with-percentiles-aggregation-brings-aggravation/
Data map[model.Fingerprint]*circonusllhist.HistogramWithoutLookups `json:"data"`
// DataByMetaData indexes the metric data by the full set of labels.
// The list of fingerprintTimes is guaranteed to be unique for any set of labels
// and will never contain more than twenty-five items.
DataByMetaData map[FullMetadata][]FingerprintTime `json:"data_by_meta_data"`
}
CachedQuery stores digested data for a query across clusters, as well as indices for the data to access it by the fully specific set of labels as well as a smaller set that uses the step for context only.
func (*CachedQuery) PruneWithMaxAge ¶
func (q *CachedQuery) PruneWithMaxAge(maxAge time.Duration)
PruneWithMaxAge removes data older than maxAge and caps each label set to 25 entries.
type FingerprintTime ¶
type FingerprintTime struct {
// Fingerprint provides a hash-capable representation of a Metric.
Fingerprint model.Fingerprint `json:"fingerprint"`
// Added is the time which this was sourced. This is useful for later pruning of stale data.
Added time.Time `json:"added"`
}
FingerprintTime holds both the fingerprint for referencing the data, and the time at which it was added for later pruning
type FullMetadata ¶
type FullMetadata struct {
// Metadata identifies the ci-operator configuration for which this container ran.
api.Metadata `json:"api_metadata"`
// Target is the ci-operator --target for which this container ran.
Target string `json:"target"`
// Step is the multi-stage step for which this container ran, if any.
Step string `json:"step,omitempty"`
// Pod is the name of the pod which executed.
Pod string `json:"pod"`
// Container is the name of the container which executed.
Container string `json:"container"`
// Measured indicates if this pod was marked as measured (for accurate resource measurement)
Measured bool `json:"measured,omitempty"`
// WorkloadClass is the class of workload (e.g., "builds", "tests") from the ci-workload label
WorkloadClass string `json:"workload_class,omitempty"`
}
FullMetadata identifies a container by all of the relevant labels, creating the most specific set of labels for any given container in our system. We can be certain that containers with the same labels at this level of specificity will execute with similar usage.
func MetadataFor ¶
func MetadataFor(labels map[string]string, pod, container string) FullMetadata
func (FullMetadata) LogFields ¶
func (m FullMetadata) LogFields() logrus.Fields
func (FullMetadata) MarshalText ¶
func (m FullMetadata) MarshalText() (text []byte, err error)
MarshalText allows us to use this struct as a key in a JSON map when marshalling.
func (FullMetadata) StepMetadata ¶
func (m FullMetadata) StepMetadata() StepMetadata
func (*FullMetadata) String ¶
func (m *FullMetadata) String() string
func (*FullMetadata) UnmarshalText ¶
func (m *FullMetadata) UnmarshalText(text []byte) error
UnmarshalText allows us to use this struct as a key in a JSON map when unmarshalling.
type StepMetadata ¶
type StepMetadata struct {
// Step is the multi-stage step for which this container ran, if any.
Step string `json:"step,omitempty"`
// Container is the name of the container which executed.
Container string `json:"container"`
}
StepMetadata identifies a container running in the context of a step, where we expect that this container will execute in a similar way across all of the jobs for which it runs.
func (*StepMetadata) LogFields ¶
func (m *StepMetadata) LogFields() logrus.Fields
func (StepMetadata) MarshalText ¶
func (m StepMetadata) MarshalText() (text []byte, err error)
MarshalText allows us to use this struct as a key in a JSON map when marshalling.
func (*StepMetadata) String ¶
func (m *StepMetadata) String() string
func (*StepMetadata) UnmarshalText ¶
func (m *StepMetadata) UnmarshalText(text []byte) error
UnmarshalText allows us to use this struct as a key in a JSON map when unmarshalling.