The Spring Cloud Gateway backing app for each Spring Cloud Gateway for VMware Tanzu service instance uses Spring Boot Actuator. Actuator adds a number of endpoints to the app. See the Endpoints section of the Actuator documentation for the full list of endpoints.
Note: Some examples in this topic use the jq command-line JSON processing tool.
The backing app for each Spring Cloud Gateway for VMware Tanzu service instance enables the following endpoints:
ID | Function |
info |
Displays selected information about the app |
health |
Displays information about the health and status of the app |
httptrace |
Displays HTTP trace information |
gateway/routes |
Outputs all routes configured for this service instance (requires Space Developer or Admin role) |
You can access an Actuator endpoint on the service instance's backing app by appending the path /actuator/ENDPOINT
to the URL of the service instance's backing app, where ENDPOINT
is the ID of the endpoint.
To obtain the URL of a service instance's backing app, run the cf service
command, giving the name of the service instance:
$ cf service my-gateway
Showing info of service my-gateway in org myorg / space dev as user...
name: my-gateway
service: p.gateway
tags:
plan: standard
description: Spring Cloud Gateway for VMware Tanzu
documentation:
dashboard: https://my-gateway.apps.example.com/scg-dashboard
Copy the URL given for dashboard
, removing the /scg-dashboard
path. This is the URL of the service instance's backing app. In the example above, this would be:
https://my-gateway.apps.example.com
To view the output of the info
endpoint, append /actuator/info
to the backing app's URL. The following example uses cURL to make a request of the endpoint, passing the result to the jq JSON processing tool:
$ curl https://gateway-c2663ab2-fc46-4590-9a17-5c5e4718bf9a.apps.example.com/actuator/info | jq
{
"git": {
"commit": {
"time": {
"epochSecond": 1574798276,
"nano": 0
},
"id": "6f9b676"
},
"branch": "HEAD"
},
...
You can also make the request using a browser:
To view the output of the health
endpoint, append /actuator/health
to the backing app's URL. The following example uses cURL to make a request of the endpoint, passing the result to the jq JSON processing tool:
$ curl https://gateway-c2663ab2-fc46-4590-9a17-5c5e4718bf9a.apps.example.com/actuator/health | jq
{
"status": "UP"
}
Given an unauthenticated request, the health
endpoint displays only summary health information. You can use the cf oauth-token
command to obtain an OAuth 2.0 token for use in making an authenticated request to this endpoint:
$ curl https://gateway-c2663ab2-fc46-4590-9a17-5c5e4718bf9a.apps.example.com/actuator/health -H "Authorization: $(cf oauth-token)" | jq
{
"status": "UP",
"components": {
"discoveryComposite": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN",
"components": {
"discoveryClient": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN"
}
}
},
...
You can also make the request using a browser:
To view the output of the httptrace
endpoint, append /actuator/httptrace
to the backing app's URL. The following example uses cURL to make a request of the endpoint, passing the result to the jq JSON processing tool:
$ curl https://gateway-c2663ab2-fc46-4590-9a17-5c5e4718bf9a.apps.example.com/actuator/httptrace | jq
{
"traces": [
{
"timestamp": {
"epochSecond": 1583872288,
"nano": 952000000
},
"principal": null,
"session": null,
"request": {
"method": "GET",
"uri": "https://gateway-9a618a8a-e9e4-41d9-be07-f2a2afe4bc98.apps.example.com/cook/restaurant/secret-menu",
"headers": {
...
You can also make the request using a browser:
To view the output of the gateway/routes
endpoint, append /actuator/gateway/routes
to the backing app's URL. You must supply an OAuth 2.0 token when making a request of this endpoint. The following example uses cURL to make a request of the endpoint, including a token from the cf oauth-token
command and passing the result to the jq JSON processing tool:
$ curl https://gateway-97e34c56-4852-474a-89bf-42b48b7f6d43.apps.example.com/actuator/gateway/routes -H "Authorization: $(cf oauth-token)" | jq
[
{
"route_id": "97e34c56-4852-474a-89bf-42b48b7f6d43-0",
"route_definition": {
"id": "97e34c56-4852-474a-89bf-42b48b7f6d43-0",
"predicates": [
{
"name": "Path",
"args": {
"_genkey_0": "/cook/**"
}
}
],
...
The gateway/routes
Actuator endpoint requires one of the Space Developer or Admin roles.