Skip to content

Commit 1704b1e

Browse files
committed
Update from SAP DITA CMS (squashed):
commit 1146c334d0d823536dea2d8a4872ea57ef810ab2 Author: REDACTED Date: Mon Sep 2 14:37:20 2024 +0000 Update from SAP DITA CMS 2024-09-02 14:37:20 Project: dita-all/jjq1673438782153 Project map: c2f780f61c744155b0bd42b6f38fb70c.ditamap Output: loio3b732a350a824007912ca9a36076c106 Language: en-US Builddable map: 0f934adaa2c9444e8fbf43d72c5803fc.ditamap commit 8f8940b35b657e5caf95da9c19cf8a74f79ff7a6 Author: REDACTED Date: Tue Aug 20 10:39:51 2024 +0000 Update from SAP DITA CMS 2024-08-20 10:39:51 Project: dita-all/jjq1673438782153 Project map: c2f780f61c744155b0bd42b6f38fb70c.ditamap Output: loio3b732a350a824007912ca9a36076c106 Language: en-US Builddable map: 0f934adaa2c9444e8fbf43d72c5803fc.ditamap commit 260161e58462c66721e905049928ed61f70a7bde Author: REDACTED Date: Tue Aug 20 08:37:05 2024 +0000 Update from SAP DITA CMS 2024-08-20 08:37:05 Project: dita-all/jjq1673438782153 Project map: c2f780f61c744155b0bd42b6f38fb70c.ditamap Output: loio3b732a350a824007912ca9a36076c106 Language: en-US Builddable map: 0f934adaa2c9444e8fbf43d72c5803fc.ditamap ################################################## [Remaining squash message was removed before commit...]
1 parent be8df2e commit 1704b1e

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed

docs/defining-a-custom-metric-87e657e.md

+54-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Define your own metrics to scale applications based on your requirements.
1212

1313
As an alternative to the standard metrics provided by the Application Autoscaler, you can also define custom metrics such as memory consumed in megabytes or in percentage, response time, and throughput for scaling. Custom metrics offer more flexibility, so that you can scale applications based on your own requirements.
1414

15-
To use custom metrics, you need to perform the following tasks:
15+
To use custom metrics, your application needs to perform the following tasks:
1616

1717
1. Report a custom metric to the Application Autoscaler by defining a policy.
1818

@@ -35,40 +35,87 @@ The following example shows a policy with a custom metric:
3535
"adjustment":"+1"
3636
}
3737
]
38-
38+
}
3939
```
4040

4141
> ### Note:
4242
> The metric type used for custom metrics must not be any of the standard metric types.
4343
4444
> ### Tip:
4545
> We recommend a minimum duration of one minute between successive emissions of a custom metric.
46+
>
47+
> As part of the binding process, the Application Autoscaler service instance provides necessary credentials to emit custom metrics.
48+
49+
The generation of these credentials is based on the credential type parameter in the service binding. The supported credential types are binding-secret and x509. If no credential type is provided, binding-secret is used as the default credential type.
4650

4751

4852

4953
## Procedure
5054

5155
1. Bind your application with the Application Autoscaler service instance using a policy that contains custom metrics scaling rule.
5256

57+
**sample policy.json with credential Type as x509**
58+
59+
> ### Sample Code:
60+
> ```
61+
>
62+
> {
63+
> "instance_min_count":1,
64+
> "instance_max_count":4,
65+
> "scaling_rules":[
66+
> {
67+
> "metric_type":"jobqueue",
68+
> "breach_duration_secs":60,
69+
> "threshold":100,
70+
> "operator":">=",
71+
> "cool_down_secs":120,
72+
> "adjustment":"+1"
73+
> }
74+
> ],
75+
> "credential-type": "x509"
76+
> }
77+
> ```
78+
79+
**bind the service instance with the scaling policy**
80+
81+
> ### Sample Code:
82+
> ```
83+
> cf bind-service <application> <application-autoscaler-service-instance> -c policy.json
84+
> ```
85+
5386
2. Read custom metrics binding credentials from the application environment.
5487
88+
**Binding Credentials for mTLS**
89+
5590
> ### Sample Code:
5691
> ```
92+
>
5793
> "custom_metrics": {
5894
> "mtls_url": "https://autoscaler-metrics-mtls.cf.<landscape>.hana.ondemand.com",
59-
> "password": "some_secret_password",
60-
> "url": "https://autoscaler-metrics.cf.<landscape>.hana.ondemand.com",
61-
> "username": "some_username"
6295
> }
6396
>
6497
> ```
6598
66-
3. Use the X.509 certificate in the file with the path provided in the environment variable `CF_INSTANCE_CERT`, and the private key in the file with the path provided in the environment variable `CF_INSTANCE_KEY` as certificate and key for mutual TLS authentication \(mTLS\) with the base URL provided in the `mtls_url` of the service binding.
99+
3.
100+
101+
**Authenticate with X.509 Certificate:**
102+
103+
Your application requires base url, certificate and a private key for mutual TLS authentication \\\(mTLS\\\).
104+
105+
- Use the base URL provided in the `mtls_url` of the service binding.
106+
107+
- Use the X.509 certificate and private key from the paths provided in the environment variables `CF_INSTANCE_CERT` and `CF_INSTANCE_KEY` respectively.
108+
109+
110+
> ### Note:
111+
> The environment variables `CF_INSTANCE_CERT` and `CF_INSTANCE_KEY` are not shown in the cockpit or using the `cf env` command. They are only visible inside the running application container.
112+
113+
**Authenticate with Basic Authentication \(Deprecated, do not use\):**
67114
68115
> ### Note:
69116
> The X.509 certificate and private key pair are valid for 24 hours. At least 20 minutes before expiration, they are regenerated and new files replace the existing files. Make sure that your code reloads the X.509 certificate and private key pair if they are expired. See [Using Instance Identity Credentials](https://docs.cloudfoundry.org/devguide/deploy-apps/instance-identity.html) in the Cloud Foundry Documentation.
70117
71-
`url`, `username`, and `password` are provided for backwards compatibility with the HTTP basic authentication scheme and should not be used going forward.
118+
`url`, `username`, and `password` in the application environment are provided for backwards compatibility with the HTTP basic authentication scheme and should not be used going forward. If your application still needs to authenticate with basic authentication, use credential-type binding-secret in the service binding and plan to migrate to mTLS \(\`x509\`\) authentication until 2025-01-23.
72119
73120
4. Push custom metrics at an interval of your choice using APIs. For the REST API specification, see [Application Autoscaler custom metrics API](https://api.sap.com/api/ApplicationAutoscalerCustomMetricsAPI/resource).
74121

0 commit comments

Comments
 (0)