You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-61Lines changed: 49 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,106 +28,94 @@ The Learn Layer5 sample application is to be available for use across all servic
28
28
- for [Service Mesh Interface conformance](https://docs.google.com/document/d/1HL8Sk7NSLLj-9PRqoHYVIGyU6fZxUQFotrxbmfFtjwc/edit#)
29
29
30
30
## Application Architecture
31
-
The Learn Layer5 application includes three services: `app-a`, `app-b`, and `app-c`. Each service is listening on port `9091/tcp`.
31
+
The Learn Layer5 application includes three services: `app-a`, `app-b`, and `app-c`. Though they are different services, they are defines using the same app (source code in ./service). Each service is listening on port `9091/tcp`.
32
32
33
33
### Service
34
34
35
35
The following are the routes defined by the `service` app and their functionality.
36
36
37
37
#### POST /call
38
38
39
-
This is the route whose metrics will be collected by the app. This route can be used to make the service call any other web service.
39
+
This route makes the service make requests to another service. Metrics are collected for this route. sample usage given below:
40
40
41
-
Simple POST request
42
-
```shell
43
-
# Command
44
-
curl --location --request POST 'http://localhost:9091/call' \
45
-
--data-raw ''
46
-
# No Output
47
-
```
48
41
49
-
`service` makes a POST request to `"http://httpbin.org/post"`.
50
42
```shell
51
43
# Command
52
-
curl --location --request POST 'http://localhost:9091/call' \
44
+
curl --location --request POST 'http://service-a:9091/call' \
`service` makes a get request (as body is not provided) to `http://httpbin.org/get`.
80
-
```shell
81
-
# Command
82
-
curl --location --request POST 'http://localhost:9091/call' \
83
-
--header 'Content-Type: application/json' \
84
-
--data-raw '{
85
-
"host": "http://httpbin.org/get",
86
-
}'
87
-
# Output
74
+
This will make `service-a` to make a `POST` request to `http://service-b:9091/call` with the headers specified above, and the body:
75
+
```json
88
76
{
89
-
"args": {},
90
-
"headers": {
91
-
"Accept-Encoding": "gzip",
92
-
"Host": "httpbin.org",
93
-
"User-Agent": "Go-http-client/1.1",
94
-
},
95
-
"origin": "...",
96
-
"url": "http://httpbin.org/get"
77
+
"url": "http://service-c:9091/echo",
78
+
"body":"",
79
+
"method": "GET"
97
80
}
98
81
```
82
+
This inturn will make `service-b` to make a `GET` request to `http://service-c:9091/echo`.
99
83
100
84
#### GET /metrics
101
85
102
-
Gets the metrics from `service`
86
+
Gets the metrics from `service-a`
103
87
```shell
104
88
# Command
105
-
curl --location --request GET 'localhost:9091/metrics' \
106
-
--header 'Content-Type: application/json' \
107
-
--data-raw '{
108
-
"hello": "bye"
109
-
}'
89
+
curl --location --request GET 'http://service-b:9091/metrics'
110
90
# Output
111
91
{
112
-
"requestsReceived": "19", # Total requests service recieved
113
-
"responsesFailed": "3", # The responses of the requests the service made that failed
114
-
"responsesSucceeded": "7"# The responses of the requests the service made that succeeded
92
+
"ReqReceived": [
93
+
"Service-A"
94
+
],
95
+
"RespSucceeded": [
96
+
{
97
+
"URL": "http://service-c:9091/echo",
98
+
"Method": "GET",
99
+
"Headers": null
100
+
}
101
+
],
102
+
"RespFailed": []
115
103
}
116
104
```
105
+
* In ReqReceived we see list of requests `service-b` received and from whom it received. Here we see `service-A`. Actually each of the service sets a header `ServiceName` which is read by the service to determine the sender.
106
+
* As `service-b` made a request to `service-c` and the request succeeded, we can see the details in the list of successful responses (RespSucceeded).
> Note: metrics are collected only for `/call` and `/echo`.
118
+
131
119
<br /><br /><palign="center"><i>If you’re using Learn Layer5 or if you like the project, please <ahref="https://github.com/layer5io/meshery/stargazers">★</a> star this repository to show your support! 🤩</i></p>
0 commit comments