{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/2049","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/2049/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/2049/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/2049/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-ruby/pull/2049","id":314569387,"number":2049,"title":"Fix issue with labels when nil","user":{"login":"tareksamni","id":1134367,"avatar_url":"https://avatars2.githubusercontent.com/u/1134367?v=4","gravatar_id":"","url":"https://api.github.com/users/tareksamni","html_url":"https://github.com/tareksamni","followers_url":"https://api.github.com/users/tareksamni/followers","following_url":"https://api.github.com/users/tareksamni/following{/other_user}","gists_url":"https://api.github.com/users/tareksamni/gists{/gist_id}","starred_url":"https://api.github.com/users/tareksamni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tareksamni/subscriptions","organizations_url":"https://api.github.com/users/tareksamni/orgs","repos_url":"https://api.github.com/users/tareksamni/repos","events_url":"https://api.github.com/users/tareksamni/events{/privacy}","received_events_url":"https://api.github.com/users/tareksamni/received_events","type":"User","site_admin":false},"labels":[{"id":514847658,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/labels/api:%20trace","name":"api: trace","color":"f8f8f8","default":false},{"id":166382179,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/labels/cla:%20yes","name":"cla: yes","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":{"login":"dazuma","id":8911,"avatar_url":"https://avatars2.githubusercontent.com/u/8911?v=4","gravatar_id":"","url":"https://api.github.com/users/dazuma","html_url":"https://github.com/dazuma","followers_url":"https://api.github.com/users/dazuma/followers","following_url":"https://api.github.com/users/dazuma/following{/other_user}","gists_url":"https://api.github.com/users/dazuma/gists{/gist_id}","starred_url":"https://api.github.com/users/dazuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazuma/subscriptions","organizations_url":"https://api.github.com/users/dazuma/orgs","repos_url":"https://api.github.com/users/dazuma/repos","events_url":"https://api.github.com/users/dazuma/events{/privacy}","received_events_url":"https://api.github.com/users/dazuma/received_events","type":"User","site_admin":false},"assignees":[{"login":"dazuma","id":8911,"avatar_url":"https://avatars2.githubusercontent.com/u/8911?v=4","gravatar_id":"","url":"https://api.github.com/users/dazuma","html_url":"https://github.com/dazuma","followers_url":"https://api.github.com/users/dazuma/followers","following_url":"https://api.github.com/users/dazuma/following{/other_user}","gists_url":"https://api.github.com/users/dazuma/gists{/gist_id}","starred_url":"https://api.github.com/users/dazuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazuma/subscriptions","organizations_url":"https://api.github.com/users/dazuma/orgs","repos_url":"https://api.github.com/users/dazuma/repos","events_url":"https://api.github.com/users/dazuma/events{/privacy}","received_events_url":"https://api.github.com/users/dazuma/received_events","type":"User","site_admin":false}],"milestone":null,"comments":11,"created_at":"2018-04-16T09:29:59Z","updated_at":"2018-04-25T23:47:04Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/pulls/2049","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-ruby/pull/2049","diff_url":"https://github.com/GoogleCloudPlatform/google-cloud-ruby/pull/2049.diff","patch_url":"https://github.com/GoogleCloudPlatform/google-cloud-ruby/pull/2049.patch"},"body":"Issue trying to solve:\r\nI've integrated the GCP Stackdriver Trace into my rails project but I was getting an error in some of traces with this message `Transmit to Stackdriver Trace failed:`.\r\n\r\nAfter some traces in the code, I found out that `@service.patch_traces trace` in [middleware.rb](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/google-cloud-trace/lib/google/cloud/trace/middleware.rb#L214) throws an exception that was propagated from  [service.rb](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/google-cloud-trace/lib/google/cloud/trace/service.rb#L81) \r\n\r\nThe reason was that some of the traces are passing `labels` in the span with `nil` value which apparently violating the ProtoBuf definition at: [trace_pb.rb](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/google-cloud-trace/lib/google/devtools/cloudtrace/v1/trace_pb.rb#L25) as it expects a hash while getting a nil.\r\n\r\nHow to solve?\r\nI think explicitly protecting against nil value in labels in span should be in place to protect against any unexpected passed values to the span's labels which is the case here.\r\n\r\nI've written a test case where I passed `labels` parameter with `nil` and I expected `labels` to be `{}` which did not happen. then I fixed the issue inside the span constructor to fix the test.\r\n\r\nI hope this was clear enough. Please, feel free to discuss more details. I've monkey patched my project to override the labels if it was nil for now but I'd love to get this update so that I can remove my monkey patching .."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/comments/384468122","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-ruby/pull/2049#issuecomment-384468122","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-ruby/issues/2049","id":384468122,"user":{"login":"blowmage","id":730,"avatar_url":"https://avatars0.githubusercontent.com/u/730?v=4","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"created_at":"2018-04-25T23:47:04Z","updated_at":"2018-04-25T23:47:04Z","author_association":"COLLABORATOR","body":"Nearly all objects have `to_s`. I would replace `if v.is_a? ::String` with `if v.responds_to? :to_str` and then add a line to the conditional block that calls it `v = v.to_str`"}}
{"actor":{"display_login":"blowmage"}}