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

docs: add multiple metrics field descriptions to KeptnMetric CRD ref #2964

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Changes from all commits
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
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
Loading