Skip to content

Commit

Permalink
docs(metrics-operator): usage of SLI and SLO converters (#2013)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT authored Sep 11, 2023
1 parent 63f5dc1 commit 57bc225
Show file tree
Hide file tree
Showing 3 changed files with 535 additions and 1 deletion.
78 changes: 78 additions & 0 deletions metrics-operator/converter/sli_converter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SLI Converter

SLI converter is a tool to convert the old `sli.yaml`
[file format](https://github.com/keptn/spec/blob/master/service_level_indicator.md) into the new
`AnalysisValueTemplate` [custom resource definition](../../docs/content/en/docs/crd-ref/metrics/v1alpha3/_index.md).
The converter is part of `metrics-operator` image.

## Usage

The converter will convert a single `sli.yaml` file into multiple `AnalysisValueTemplate` resources.

To run the converter, execute the following command:

<!---x-release-please-start-version-->
```shell
METRICS_OPERATOR_IMAGE=ghcr.io/keptn/metrics-operator:v0.8.2
PATH_TO_SLI=<PATH_TO_SLI>
KEPTN_PROVIDER_NAME=<KEPTN_PROVIDER_NAME>
KEPTN_PROVIDER_NAMESPACE=<KEPTN_PROVIDER_NAMESPACE>

docker run $METRICS_OPERATOR_IMAGE manager --convert-sli=$PATH_TO_SLI --keptn-provider-name=$KEPTN_PROVIDER_NAME --keptn-provider-namespace=$KEPTN_PROVIDER_NAMESPACE
```
<!---x-release-please-end-->

Please be aware, you need to substitute the placeholders with the following information:

* **PATH_TO_SLI** - path to your `sli.yaml` file
* **KEPTN_PROVIDER_NAME** - name of `KeptnMetricsProvider` which will be used to fetch SLIs
* **KEPTN_PROVIDER_NAMESPACE** - namespace of `KeptnMetricsProvider` which will be used to fetch SLIs

> **Note**
All the SLIs present in `sli.yaml` file will use the same provider defined by the referenced
`KeptnMetricsProvider`.

## Example

The following content of `sli.yaml` file

```yaml
spec_version: "1.0"
indicators:
throughput: "builtin:service.requestCount.total:merge(0):count?scope=tag(keptn_project:$PROJECT),tag(keptn_stage:$STAGE),tag(keptn_service:$SERVICE),tag(keptn_deployment:$DEPLOYMENT)"
response_time_p95: "builtin:service.response.time:merge(0):percentile(95)?scope=tag(keptn_project:$PROJECT),tag(keptn_stage:$STAGE),tag(keptn_service:$SERVICE),tag(keptn_deployment:$DEPLOYMENT)"
```
with the following command
```shell
docker run $METRICS_OPERATOR_IMAGE manager --convert-sli=./sli.yaml --sli-provider=dynatrace --sli-namespace=keptn
```

will be converted to:

```yaml
---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisValueTemplate
metadata:
creationTimestamp: null
name: response_time_p95
spec:
provider:
name: dynatrace
namespace: keptn
query: builtin:service.response.time:merge(0):percentile(95)?scope=tag(keptn_project:{{.project}}),tag(keptn_stage:{{.stage}}),tag(keptn_service:{{.service}}),tag(keptn_deployment:{{.deployment}})
---
apiVersion: metrics.keptn.sh/v1alpha3
kind: AnalysisValueTemplate
metadata:
creationTimestamp: null
name: throughput
spec:
provider:
name: dynatrace
namespace: keptn
query: builtin:service.requestCount.total:merge(0):count?scope=tag(keptn_project:{{.project}}),tag(keptn_stage:{{.stage}}),tag(keptn_service:{{.service}}),tag(keptn_deployment:{{.deployment}})
```
Loading

0 comments on commit 57bc225

Please sign in to comment.