Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Add HTTP request debug logging #300

Merged
merged 2 commits into from Nov 15, 2016
Merged

Conversation

wfarner
Copy link
Contributor

@wfarner wfarner commented Nov 15, 2016

This adds debug-level logging for plugin clients and servers.

Here's an excerpt from the group Plugin to show how this logging presents, showing the full call chain to create an instance:

INFO[0000] Listening at: /Users/billfarner/.infrakit/plugins/group
DEBU[0015] Received request POST /rpc HTTP/1.1
Host: d
Accept-Encoding: gzip
Content-Length: 409
Content-Type: application/json
User-Agent: Go-http-client/1.1

{"method":"Group.CommitGroup","params":[{"Spec":{"ID":"cattle","Properties":{"Allocation":{"Size":5},"Instance":{"Plugin":"instance-file","Properties":{"Note":"Instance properties version 1.0"}},"Flavor":{"Plugin":"flavor-vanilla","Properties":{"Init":["docker pull nginx:alpine","docker run -d -p 80:80 nginx-alpine"],"Tags":{"tier":"web","project":"infrakit"}}}}},"Pretend":false}],"id":5577006791947779410}
...
DEBU[0015] Sending request POST / HTTP/1.1
Content-Type: application/json

{"method":"Flavor.Validate","params":[{"Properties":{"Init":["docker pull nginx:alpine","docker run -d -p 80:80 nginx-alpine"],"Tags":{"tier":"web","project":"infrakit"}},"Allocation":{"Size":5,"LogicalIDs":null}}],"id":2403489562072437156}
DEBU[0015] Received response HTTP/1.1 200 OK
Content-Length: 60
Content-Type: text/plain; charset=utf-8
Date: Tue, 15 Nov 2016 23:03:26 GMT

{"result":{"OK":true},"error":null,"id":2403489562072437156}
...
DEBU[0015] Sending request POST / HTTP/1.1
Content-Type: application/json

{"method":"Instance.Validate","params":[{"Properties":{"Note":"Instance properties version 1.0"}}],"id":6372761812113081704}
DEBU[0015] Received response HTTP/1.1 200 OK
Content-Length: 60
Content-Type: text/plain; charset=utf-8
Date: Tue, 15 Nov 2016 23:03:26 GMT

{"result":{"OK":true},"error":null,"id":6372761812113081704}
INFO[0015] Committing group cattle (pretend=false)
DEBU[0015] Sending response HTTP/1.1 200 OK
Connection: close
X-Content-Type-Options: nosniff

{"result":{"Details":"Managing 5 instances"},"error":null,"id":5577006791947779410}

Closes #269

Signed-off-by: Bill Farner bill@docker.com

Signed-off-by: Bill Farner <bill@docker.com>
@codecov-io
Copy link

codecov-io commented Nov 15, 2016

Current coverage is 70.87% (diff: 75.00%)

Merging #300 into master will increase coverage by 0.03%

@@             master       #300   diff @@
==========================================
  Files            25         25          
  Lines          1228       1243    +15   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            870        881    +11   
- Misses          285        287     +2   
- Partials         73         75     +2   

Powered by Codecov. Last update 67c52c9...71acfa1

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "rpc-log" git@github.com:wfarner/infrakit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842353570112
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@wfarner wfarner changed the title Add debug logging of full HTTP requests and responses Add HTTP request debug logging Nov 15, 2016
Copy link
Contributor

@chungers chungers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wfarner wfarner merged commit 7c59ff4 into docker-archive:master Nov 15, 2016
@wfarner wfarner deleted the rpc-log branch November 16, 2016 00:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More thorough logging needed throughout
4 participants