Skip to content

Commit

Permalink
docs: add multiple metrics field descriptions to KeptnMetric CRD ref (k…
Browse files Browse the repository at this point in the history
…eptn#2964)

Signed-off-by: Meg McRoberts <[email protected]>
Co-authored-by: Florian Bacher <[email protected]>
Co-authored-by: Rakshit Gondwal <[email protected]>
Signed-off-by: shivam <[email protected]>
  • Loading branch information
3 people authored and Bharadwajshivam28 committed Feb 20, 2024
1 parent e9472fc commit 387bc79
Showing 1 changed file with 61 additions and 26 deletions.
87 changes: 61 additions & 26 deletions docs/docs/reference/crd-reference/metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
fetchIntervalSeconds: <#-seconds>
range:
interval: "<timeframe>"
step: <query-resolution-step-width>
aggregation: p90 | p95 | p99 | max | min | avg | median
storedResults: <integer>
status:
properties:
value: <resulting value in human-readable language>
Expand Down Expand Up @@ -65,14 +68,27 @@ spec:
as the name of the Prometheus server that monitors the dev deployment
and `prod-prometheus` as the name of the Prometheus server
that monitors the production deployment.

* **query** (required) -- String in the provider-specific query language,
used to obtain a metric.

* **fetchIntervalSeconds** (required) --
Number of seconds between updates of the metric.
* **range**
* **interval** -- Timeframe for which the metric is queried.
Defaults to 5m.
* **interval** -- Timeframe for which the metric is queried.
Defaults to 5m.
* **step** -- A string that represents
the query resolution step width for the data query
* **aggregation** -- type of aggregation function
to be applied to the data.
Valid values are `p90`, `p95`, `p99`,
`max`, `min`, `avg`, `median`.
* **storedResults** -- Maximum number of past results
to store in the status of a `KeptnMetric` resource.
This can be set to an integer that is less than or equal to 255.
When set to a value greater than 1,
the user can see a slice of this number of metrics
in the`status.intervalResults` field.

* **status** --
Keptn fills in this information when the metric is evaluated.
Expand All @@ -82,6 +98,21 @@ spec:
If the evaluation is not successful,
this stores error details that you can use to understand the problem
such as a forbidden code.

By default, Keptn stores the most recent metric that was run.
If the value of the `spec.range.storedResults` field
is set to a value greater than 1 and no larger than 255,
Keptn stores that number of metrics.

* **value** -- A string that represents the resulting value
in human-readable format.
* **rawValue** -- An array that represents the resulting value
in raw format.
* **lastUpdated** -- Time when the status data was last updated.
* **errMsg** -- Error details if the query could not be evaluated.
* **intervalResults** -- Slice of all interval results.
Up to 255 results can be stored,
determined by the value of the `spec.range` field.
<!-- markdownlint-enable MD007 -->

## Usage
Expand Down Expand Up @@ -135,30 +166,34 @@ API Reference:

## Differences between versions

Beginning with the `v1alpha3` API version,
Keptn allows you to define multiple instances of the same data source.
In earlier versions, you could use multiple data sources
but only one instance of each.
Consequently, the `v1alpha1` and `v1alpha2` API versions
define the `provider` field with the type of the data provider
(`prometheus`, `dynatrace`, or `dql`)
rather than the particular name assigned
to the instance of the data provider
that is assigned in the
[KeptnMetricsProvider](metricsprovider.md) CR.

So the `v1alpha1` and `v1alpha2` synopsis
of the `spec` field is:

```yaml
...
spec:
provider:
name: "prometheus | dynatrace | dql"
fetchIntervalSeconds: <seconds>
query: >-
"<query-from-provider>"
```
* Beginning with the `v1beta1` API version,
the metrics controller supports multiple metrics in its `status` field
if the value of the `spec.range.storedResults` field is greater than 1.

* Beginning with the `v1alpha3` API version,
Keptn allows you to define multiple instances of the same data source.
In earlier versions, you could use multiple data sources
but only one instance of each.
Consequently, the `v1alpha1` and `v1alpha2` API versions
define the `provider` field with the type of the data provider
(`prometheus`, `dynatrace`, or `dql`)
rather than the particular name assigned
to the instance of the data provider
that is assigned in the
[KeptnMetricsProvider](metricsprovider.md) CR.

So the `v1alpha1` and `v1alpha2` synopsis
of the `spec` field is:

```yaml
...
spec:
provider:
name: "prometheus | dynatrace | dql"
fetchIntervalSeconds: <seconds>
query: >-
"<query-from-provider>"
```

## See also

Expand Down

0 comments on commit 387bc79

Please sign in to comment.