layer5io / learn-layer5

A sample application for learning how to service mesh and for validating SMI conformance
https://layer5.io
Apache License 2.0
63 stars 30 forks source link

Feature/more metrics #10

Closed kanishkarj closed 4 years ago

kanishkarj commented 4 years ago
# builds the service
make build-service

# Run the following to start service-b (localhost:9092)
make run-service-b

# Run the following in another terminal to start service-a (localhost:9091)
make run-service-a

Run the following command to make a request to service-a which inturn will make request to service-b.

curl --location --request POST 'http://localhost:9091/call' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "http://localhost:9092/echo",
"body": "",
"method": "GET",
"headers": {
    "head": "tail"
}
}'

To see metrics:

# service-a
curl --location --request GET 'localhost:9091/metrics'

# service-b
curl --location --request GET 'localhost:9091/metrics'

sample output for the metrics : Service-a:

{
    "ReqReceived": [
        "Unidentified"
    ],
    "RespSucceeded": [
        {
            "URL": "http://localhost:9092/echo",
            "Method": "GET",
            "Headers": {
                "head": "tail"
            }
        }
    ],
    "RespFailed": []
}

Service-b:

{
    "ReqReceived": [
        "service-a"
    ],
    "RespSucceeded":[],
    "RespFailed": []
}
kanishkarj commented 4 years ago

@leecalcote @nveenjain