This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Chapter 6. Using metering with OpenShift Serverless
You are viewing documentation for a release of Red Hat OpenShift Serverless that is no longer supported. Red Hat OpenShift Serverless is currently supported on OpenShift Container Platform 4.3 and newer.
As a cluster administrator, you can use metering to analyze what is happening in your OpenShift Serverless cluster.
For more information about metering on OpenShift Container Platform, see About metering.
6.1. Installing metering Copy linkLink copied to clipboard!
For information about installing metering on OpenShift Container Platform, see Installing Metering.
6.2. Datasources for Knative Serving metering Copy linkLink copied to clipboard!
				The following ReportDataSources are examples of how Knative Serving can be used with OpenShift Container Platform metering.
			
6.2.1. Datasource for CPU usage in Knative Serving Copy linkLink copied to clipboard!
This datasource provides the accumulated CPU seconds used per Knative service over the report time period.
YAML file
6.2.2. Datasource for memory usage in Knative Serving Copy linkLink copied to clipboard!
This datasource provides the average memory consumption per Knative service over the report time period.
YAML file
6.2.3. Applying Datasources for Knative Serving metering Copy linkLink copied to clipboard!
					You can apply the ReportDataSources by using the following command:
				
oc apply -f <datasource-name>.yaml
$ oc apply -f <datasource-name>.yaml
Example
oc apply -f knative-service-memory-usage.yaml
$ oc apply -f knative-service-memory-usage.yaml
6.3. Queries for Knative Serving metering Copy linkLink copied to clipboard!
				The following ReportQuery resources reference the example DataSources provided.
			
6.3.1. Query for CPU usage in Knative Serving Copy linkLink copied to clipboard!
YAML file
6.3.2. Query for memory usage in Knative Serving Copy linkLink copied to clipboard!
YAML file
6.3.3. Applying Queries for Knative Serving metering Copy linkLink copied to clipboard!
					You can apply the ReportQuery by using the following command:
				
oc apply -f <query-name>.yaml
$ oc apply -f <query-name>.yaml
Example
oc apply -f knative-service-memory-usage.yaml
$ oc apply -f knative-service-memory-usage.yaml
6.4. Metering reports for Knative Serving Copy linkLink copied to clipboard!
				You can run metering reports against Knative Serving by creating Report resources. Before you run a report, you must modify the input parameter within the Report resource to specify the start and end dates of the reporting period.
			
YAML file
6.4.1. Running a metering report Copy linkLink copied to clipboard!
Once you have provided the input parameters, you can run the report using the command:
oc apply -f <report-name>.yml
$ oc apply -f <report-name>.yml
You can then check the report as shown in the following example:
kubectl get report
$ kubectl get report
NAME                        QUERY                       SCHEDULE   RUNNING    FAILED   LAST REPORT TIME       AGE
knative-service-cpu-usage   knative-service-cpu-usage              Finished            2019-06-30T23:59:59Z   10h