{"action":"created","issue":{"url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/353","repository_url":"https://api.github.com/repos/googleapis/nodejs-logging","labels_url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/353/labels{/name}","comments_url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/353/comments","events_url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/353/events","html_url":"https://github.com/googleapis/nodejs-logging/issues/353","id":391313762,"node_id":"MDU6SXNzdWUzOTEzMTM3NjI=","number":353,"title":"logging write() calls metadata every time","user":{"login":"wyardley","id":10714426,"node_id":"MDQ6VXNlcjEwNzE0NDI2","avatar_url":"https://avatars3.githubusercontent.com/u/10714426?v=4","gravatar_id":"","url":"https://api.github.com/users/wyardley","html_url":"https://github.com/wyardley","followers_url":"https://api.github.com/users/wyardley/followers","following_url":"https://api.github.com/users/wyardley/following{/other_user}","gists_url":"https://api.github.com/users/wyardley/gists{/gist_id}","starred_url":"https://api.github.com/users/wyardley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyardley/subscriptions","organizations_url":"https://api.github.com/users/wyardley/orgs","repos_url":"https://api.github.com/users/wyardley/repos","events_url":"https://api.github.com/users/wyardley/events{/privacy}","received_events_url":"https://api.github.com/users/wyardley/received_events","type":"User","site_admin":false},"labels":[{"id":700401781,"node_id":"MDU6TGFiZWw3MDA0MDE3ODE=","url":"https://api.github.com/repos/googleapis/nodejs-logging/labels/priority:%20p1","name":"priority: p1","color":"ffa03e","default":false},{"id":700402188,"node_id":"MDU6TGFiZWw3MDA0MDIxODg=","url":"https://api.github.com/repos/googleapis/nodejs-logging/labels/type:%20bug","name":"type: bug","color":"db4437","default":false}],"state":"open","locked":false,"assignee":{"login":"kinwa91","id":4001432,"node_id":"MDQ6VXNlcjQwMDE0MzI=","avatar_url":"https://avatars2.githubusercontent.com/u/4001432?v=4","gravatar_id":"","url":"https://api.github.com/users/kinwa91","html_url":"https://github.com/kinwa91","followers_url":"https://api.github.com/users/kinwa91/followers","following_url":"https://api.github.com/users/kinwa91/following{/other_user}","gists_url":"https://api.github.com/users/kinwa91/gists{/gist_id}","starred_url":"https://api.github.com/users/kinwa91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinwa91/subscriptions","organizations_url":"https://api.github.com/users/kinwa91/orgs","repos_url":"https://api.github.com/users/kinwa91/repos","events_url":"https://api.github.com/users/kinwa91/events{/privacy}","received_events_url":"https://api.github.com/users/kinwa91/received_events","type":"User","site_admin":false},"assignees":[{"login":"kinwa91","id":4001432,"node_id":"MDQ6VXNlcjQwMDE0MzI=","avatar_url":"https://avatars2.githubusercontent.com/u/4001432?v=4","gravatar_id":"","url":"https://api.github.com/users/kinwa91","html_url":"https://github.com/kinwa91","followers_url":"https://api.github.com/users/kinwa91/followers","following_url":"https://api.github.com/users/kinwa91/following{/other_user}","gists_url":"https://api.github.com/users/kinwa91/gists{/gist_id}","starred_url":"https://api.github.com/users/kinwa91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinwa91/subscriptions","organizations_url":"https://api.github.com/users/kinwa91/orgs","repos_url":"https://api.github.com/users/kinwa91/repos","events_url":"https://api.github.com/users/kinwa91/events{/privacy}","received_events_url":"https://api.github.com/users/kinwa91/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-12-14T23:33:34Z","updated_at":"2019-01-02T19:39:28Z","closed_at":null,"author_association":"NONE","body":"#### Environment details\r\n\r\n  - OS: Alpine Linux 3.6-3.8\r\n  - Node.js version: 8.12\r\n  - npm version: 6.4.1\r\n  - `@google-cloud/logging` version: current\r\n\r\n#### Steps to reproduce\r\n\r\n  1. Make lots of logging write calls\r\n  2. `getGKEDescriptor()` is called every time https://github.com/googleapis/nodejs-logging/blob/e894fbeeac7d7b3258b4a02b4f123ad320f0c2b0/src/metadata.ts#L96-L104 which creates two or more DNS requests for each log write, as well as http request(s) to metadata, e.g., \r\n\r\n```\r\n01:01:49.538637 IP 10.53.5.5.53309 > 10.53.57.8.domain: 60715+ A? metadata.google.internal.google.internal. (58)\r\n        0x0000:  4500 0056 141a 4000 3f11 d506 0a35 0505  E..V..@.?....5..\r\n        0x0010:  0a35 3908 d03d 0035 0042 68af ed2b 0100  .59..=.5.Bh..+..\r\n        0x0020:  0001 0000 0000 0000 086d 6574 6164 6174  .........metadat\r\n        0x0030:  6106 676f 6f67 6c65 0869 6e74 6572 6e61  a.google.interna\r\n        0x0040:  6c06 676f 6f67 6c65 0869 6e74 6572 6e61  l.google.interna\r\n        0x0050:  6c00 0001 0001                           l.....\r\n01:01:49.538657 IP 10.53.5.5.53309 > 10.53.57.8.domain: 61057+ AAAA? metadata.google.internal.google.internal. (58)\r\n        0x0000:  4500 0056 141b 4000 3f11 d505 0a35 0505  E..V..@.?....5..\r\n        0x0010:  0a35 3908 d03d 0035 0042 673e ee81 0100  .59..=.5.Bg>....\r\n        0x0020:  0001 0000 0000 0000 086d 6574 6164 6174  .........metadat\r\n        0x0030:  6106 676f 6f67 6c65 0869 6e74 6572 6e61  a.google.interna\r\n        0x0040:  6c06 676f 6f67 6c65 0869 6e74 6572 6e61  l.google.interna\r\n        0x0050:  6c00 001c 0001                           l.....\r\n```\r\n\r\n```\r\n[pid 1627782] write(36, \"GET /computeMetadata/v1/instance/attributes/cluster-name HTTP/1.1\\r\\nAccept: application/json, text/plain, */*\\r\\nMetadata-Flavor: Google\\r\\nUser-Agent: axios/0.18.0\\r\\nHost: metadata.google.internal\\r\\nConnection: close\\r\\n\\r\\n\", 214) = 214\r\n```\r\n\r\nPresumably the project, cluster name, etc., are unlikely to change, so it would seem more efficient to get / cache this information when the library is instantiated somehow? I'm not sure if https://www.npmjs.com/package/@google-cloud/logging-winston does things any differently. We do have a wrapper around this which I believe does at least some buffering, but still, this creates a lot of overhead."},"comment":{"url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/comments/450962870","html_url":"https://github.com/googleapis/nodejs-logging/issues/353#issuecomment-450962870","issue_url":"https://api.github.com/repos/googleapis/nodejs-logging/issues/353","id":450962870,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDk2Mjg3MA==","user":{"login":"stephenplusplus","id":723048,"node_id":"MDQ6VXNlcjcyMzA0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/723048?v=4","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"created_at":"2019-01-02T19:39:28Z","updated_at":"2019-01-02T19:39:28Z","author_association":"MEMBER","body":"PR sent! #359"}}
{"actor":{"display_login":"stephenplusplus"}}