{"action":"created","issue":{"url":"https://api.github.com/repos/uber/zanzibar/issues/444","repository_url":"https://api.github.com/repos/uber/zanzibar","labels_url":"https://api.github.com/repos/uber/zanzibar/issues/444/labels{/name}","comments_url":"https://api.github.com/repos/uber/zanzibar/issues/444/comments","events_url":"https://api.github.com/repos/uber/zanzibar/issues/444/events","html_url":"https://github.com/uber/zanzibar/pull/444","id":353568119,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNTg2NzM2","number":444,"title":"Add context logger; use context logger for HTTP client request log","user":{"login":"jacobgreenleaf","id":2646558,"node_id":"MDQ6VXNlcjI2NDY1NTg=","avatar_url":"https://avatars3.githubusercontent.com/u/2646558?v=4","gravatar_id":"","url":"https://api.github.com/users/jacobgreenleaf","html_url":"https://github.com/jacobgreenleaf","followers_url":"https://api.github.com/users/jacobgreenleaf/followers","following_url":"https://api.github.com/users/jacobgreenleaf/following{/other_user}","gists_url":"https://api.github.com/users/jacobgreenleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobgreenleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobgreenleaf/subscriptions","organizations_url":"https://api.github.com/users/jacobgreenleaf/orgs","repos_url":"https://api.github.com/users/jacobgreenleaf/repos","events_url":"https://api.github.com/users/jacobgreenleaf/events{/privacy}","received_events_url":"https://api.github.com/users/jacobgreenleaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-23T21:54:37Z","updated_at":"2018-08-25T00:01:13Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/uber/zanzibar/pulls/444","html_url":"https://github.com/uber/zanzibar/pull/444","diff_url":"https://github.com/uber/zanzibar/pull/444.diff","patch_url":"https://github.com/uber/zanzibar/pull/444.patch"},"body":"Adds a new logger to `DefaultDeps` that has an API like:\r\n\r\n```\r\n// ContextLogger is a logger that extracts some log fields from the context before passing through to underlying zap logger.\r\ntype ContextLogger interface {\r\n\tDebug(ctx context.Context, msg string, fields ...zap.Field)\r\n\tError(ctx context.Context, msg string, fields ...zap.Field)\r\n\tFatal(ctx context.Context, msg string, fields ...zap.Field)\r\n\tInfo(ctx context.Context, msg string, fields ...zap.Field)\r\n\tPanic(ctx context.Context, msg string, fields ...zap.Field)\r\n\tWarn(ctx context.Context, msg string, fields ...zap.Field)\r\n}\r\n```\r\n\r\nCases for log fields:\r\n1. static defined by zanzibar (server) i.e. \"production\" env var. The logger passed to `NewContextLogger()` should have this field already populated in zap fields. \r\n2. static defined by zanzibar (endpoint) i.e. endpointID=\"foo.bar\". Today we happen to call `NewContextLogger` with endpoint's zap logger preallocated to have `endpointID` field `client.loggers[methodName]`. In the future we will need to inject `endpointID` into context like other request fields to support logs emitted by user code, which makes `clients.loggers` redundant. \r\n3. Request parameter (HTTP header, etc.). Zanzibar uses `zanzibar/runtime.WithLogFields(ctx, ...)` to mutate `context.Context`. \r\n4. request value defined by zanzibar (e.g. request UUID). Same as (3). \r\n5. request value defined by platform using zanzibar (e.g. task ID, or maybe edge gateway middlewares). Platform code to use `zanzibar/runtime.WithLogFields(ctx, ...)` to mutate `context.Context` similar to (3). \r\n6. request value put in context by third party lib (e.g. jaeger trace ID). Will need to use third party API to extract value from context (since it's usually unexported type), then use `WithLogFields(ctx)` API similar to (3). \r\n7. static defined by platform using zanzibar (e.g. UDEPLOY_DEPLOYMENT_NAME). There will need to be a startup hook to register custom log fields (in a later diff). \r\n\r\nThis diff leverages previously written tests (#441). "},"comment":{"url":"https://api.github.com/repos/uber/zanzibar/issues/comments/415911572","html_url":"https://github.com/uber/zanzibar/pull/444#issuecomment-415911572","issue_url":"https://api.github.com/repos/uber/zanzibar/issues/444","id":415911572,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTkxMTU3Mg==","user":{"login":"coveralls","id":2354108,"node_id":"MDQ6VXNlcjIzNTQxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T00:01:13Z","updated_at":"2018-08-25T00:01:13Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/18662489/badge)](https://coveralls.io/builds/18662489)\n\nCoverage increased (+0.1%) to 62.63% when pulling **7ffd245bba2a60a3de96bb8c61aa3c59edb8a09b on jg-client-logger** into **0f16a51c4440e3955b1452a6ae7521aa396d0ec8 on master**.\n"}}
{"actor":{"display_login":"coveralls"}}