The Learn Layer5 sample application is to be available for use across all service meshes that Meshery supports and is to used as:
- a learning device (for service mesh workshops)
- for Service Mesh Interface conformance
The Learn Layer5 application includes three services: app-a
, app-b
, and app-c
. Each service is listening on port 9091/tcp
.
The following are the routes defined by the service
app and their functionality.
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.
Simple POST request
# Command
curl --location --request POST 'http://localhost:9091/call' \
--data-raw ''
# No Output
service
makes a POST request to "http://httpbin.org/post"
.
# Command
curl --location --request POST 'http://localhost:9091/call' \
--header 'Content-Type: application/json' \
--data-raw '{
"host": "http://httpbin.org/post",
"body": "{\n\t\"hello\": \"bye\"\n}"
}'
# Output
{
"args": {},
"data": "{\n\t\"hello\": \"bye\"\n}",
"files": {},
"form": {},
"headers": {
"Accept-Encoding": "gzip",
"Content-Length": "19",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "Go-http-client/1.1",
},
"json": {
"hello": "bye"
},
"origin": "...",
"url": "http://httpbin.org/post"
}
service
makes a get request (as body is not provided) to http://httpbin.org/get
.
# Command
curl --location --request POST 'http://localhost:9091/call' \
--header 'Content-Type: application/json' \
--data-raw '{
"host": "http://httpbin.org/get",
}'
# Output
{
"args": {},
"headers": {
"Accept-Encoding": "gzip",
"Host": "httpbin.org",
"User-Agent": "Go-http-client/1.1",
},
"origin": "...",
"url": "http://httpbin.org/get"
}
Gets the metrics from service
# Command
curl --location --request GET 'localhost:9091/metrics' \
--header 'Content-Type: application/json' \
--data-raw '{
"hello": "bye"
}'
# Output
{
"requestsReceived": "19", # Total requests service recieved
"responsesFailed": "3", # The responses of the requests the service made that failed
"responsesSucceeded": "7" # The responses of the requests the service made that succeeded
}
Clears the counters in service
# Command
curl --location --request DELETE 'localhost:9091/metrics' \
--header 'Content-Type: application/json' \
--data-raw '{
"hello": "bye"
}'
# No Output
If you’re using Learn Layer5 or if you like the project, please ★ star this repository to show your support! 🤩
Our projects are community-built and welcome collaboration. 👍 Be sure to see the Layer5 Contributor Welcome Guide for a tour of resources available to you and jump into our Slack! Contributors are expected to adhere to the CNCF Code of Conduct.
✔️ Join weekly community meeting on Fridays from 10am - 11am Central.
✔️ Watch community meeting recordings.
✔️ Access the community drive.
Not sure where to start? Grab an open issue with the help-wanted label.
Community First
The Layer5 community represents the largest collection of service mesh projects and their maintainers in the world.
Open Source First
We build projects to provide learning environments, deployment and operational best practices, performance benchmarks, create documentation, share networking opportunities, and more. Our shared commitment to the open source spirit pushes Layer5 projects forward.
License
This repository and site are available as open source under the terms of the Apache 2.0 License.