Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update KeptnMetric to store multiple metrics in status #1900

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions metrics-operator/api/v1alpha3/keptnmetric_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ type KeptnMetricSpec struct {

// KeptnMetricStatus defines the observed state of KeptnMetric
type KeptnMetricStatus struct {
// Value represents the resulting value
Value string `json:"value"`
// RawValue represents the resulting value in raw format
RawValue []byte `json:"rawValue"`
// LastUpdated represents the time when the status data was last updated
LastUpdated metav1.Time `json:"lastUpdated"`
// ErrMsg represents the error details when the query could not be evaluated
ErrMsg string `json:"errMsg,omitempty"`
// Results contain a slice of all results
Results []Result `json:"results"`
}

// ProviderRef represents the provider object
Expand All @@ -63,6 +57,21 @@ type RangeSpec struct {
// Aggregation defines the type of aggregation function to be applied on the data. Accepted values: p90, p95, p99, max, min, avg, median
// +kubebuilder:validation:Enum:=p90;p95;p99;max;min;avg;median
Aggregation string `json:"aggregation,omitempty"`
// +kubebuilder:validation:Maximum:=255
rakshitgondwal marked this conversation as resolved.
Show resolved Hide resolved
StoredResults uint `json:"storedResults,omitempty"`
}

type Result struct{
// Value represents the resulting value
Value string `json:"value"`
// RawValue represents the resulting value in raw format
rakshitgondwal marked this conversation as resolved.
Show resolved Hide resolved
RawValue []byte `json:"rawValue"`
// Range represents the time range for which data has been queried
Range *RangeSpec `json:"range,omitempty"`
// LastUpdated represents the time when the status data was last updated
LastUpdated metav1.Time `json:"lastUpdated"`
// ErrMsg represents the error details when the query could not be evaluated
ErrMsg string `json:"errMsg,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ spec:
description: Step represents the query resolution step width for
the data query
type: string
storedResults:
maximum: 255
type: integer
type: object
required:
- fetchIntervalSeconds
Expand All @@ -250,26 +253,65 @@ spec:
status:
description: KeptnMetricStatus defines the observed state of KeptnMetric
properties:
errMsg:
description: ErrMsg represents the error details when the query could
not be evaluated
type: string
lastUpdated:
description: LastUpdated represents the time when the status data
was last updated
format: date-time
type: string
rawValue:
description: RawValue represents the resulting value in raw format
format: byte
type: string
value:
description: Value represents the resulting value
type: string
results:
description: Results contain a slice of all results
items:
properties:
errMsg:
description: ErrMsg represents the error details when the query
could not be evaluated
type: string
lastUpdated:
description: LastUpdated represents the time when the status
data was last updated
format: date-time
type: string
range:
description: Range represents the time range for which data
has been queried
properties:
aggregation:
description: 'Aggregation defines the type of aggregation
function to be applied on the data. Accepted values: p90,
p95, p99, max, min, avg, median'
enum:
- p90
- p95
- p99
- max
- min
- avg
- median
type: string
interval:
default: 5m
description: Interval specifies the duration of the time
interval for the data query
type: string
step:
description: Step represents the query resolution step width
for the data query
type: string
storedResults:
maximum: 255
type: integer
type: object
rawValue:
description: RawValue represents the resulting value in raw
format
format: byte
type: string
value:
description: Value represents the resulting value
type: string
required:
- lastUpdated
- rawValue
- value
type: object
type: array
required:
- lastUpdated
- rawValue
- value
- results
type: object
type: object
served: true
Expand Down
Loading