Skip to content

A sample application for learning how to service mesh

License

Notifications You must be signed in to change notification settings

gunjanmimo/learn-layer5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

learn-layer5

Service

The following are the routes defined by the service app and their functionality.

POST /call

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"
}
GET /metrics

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
}
DELETE /metrics

Clears the counters in service

# Command
curl --location --request DELETE 'localhost:9091/metrics' \
--header 'Content-Type: application/json' \
--data-raw '{
	"hello": "bye"
}'
# No Output

About

A sample application for learning how to service mesh

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 89.8%
  • Makefile 5.6%
  • Dockerfile 4.6%