Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging API response times #351

Closed
morphomatt opened this issue Jun 23, 2015 · 1 comment
Closed

Logging API response times #351

morphomatt opened this issue Jun 23, 2015 · 1 comment

Comments

@morphomatt
Copy link

It would be great if the logging data included the API response times. The time it took from the initial request to when a response was sent back to the caller.

Thanks!

@subnetmarco
Copy link
Member

Closed with da54013 and b82c568 by adding a latencies property to the log.

In the next release this is going to be the logging format:

{
    "request": {
        "method": "GET",
        "uri": "/get",
        "size": "75",
        "request_uri": "http://httpbin.org:8000/get",
        "querystring": {},
        "headers": {
            "accept": "*/*",
            "host": "httpbin.org",
            "user-agent": "curl/7.37.1"
        }
    },
    "response": {
        "status": 200,
        "size": "434",
        "headers": {
            "Content-Length": "197",
            "via": "kong/0.3.0",
            "Connection": "close",
            "access-control-allow-credentials": "true",
            "Content-Type": "application/json",
            "server": "nginx",
            "access-control-allow-origin": "*"
        }
    },
    "api": {
        "public_dns": "test.com",
        "target_url": "http://httpbin.org/",
        "created_at": 1432855823000,
        "name": "test.com",
        "id": "fbaf95a1-cd04-4bf6-cb73-6cb3285fef58"
    },
    "latencies": {
        "proxy": 1430,
        "kong": 9,
        "request": 1921
    },
    "started_at": 1433209822425,
    "client_ip": "127.0.0.1"
}

A few considerations on the above JSON object:

  • request contains properties about the request sent by the client
  • response contains properties about the response sent to the client
  • api contains Kong properties about the specific API requested
  • latencies contains some data about the latencies involved:
    • proxy is the time it took for the final service to process the request
    • kong is the internal Kong latency that it took to run all the plugins
    • request is the time elapsed between the first bytes were read from the client and after the last bytes were sent to the client. Useful for detecting slow clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants