{"action":"closed","issue":{"url":"https://api.github.com/repos/DataDog/dd-trace-js/issues/386","repository_url":"https://api.github.com/repos/DataDog/dd-trace-js","labels_url":"https://api.github.com/repos/DataDog/dd-trace-js/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-js/issues/386/comments","events_url":"https://api.github.com/repos/DataDog/dd-trace-js/issues/386/events","html_url":"https://github.com/DataDog/dd-trace-js/issues/386","id":382843066,"node_id":"MDU6SXNzdWUzODI4NDMwNjY=","number":386,"title":"How to set a user_id tag with graphql plugin?","user":{"login":"idris","id":13989,"node_id":"MDQ6VXNlcjEzOTg5","avatar_url":"https://avatars1.githubusercontent.com/u/13989?v=4","gravatar_id":"","url":"https://api.github.com/users/idris","html_url":"https://github.com/idris","followers_url":"https://api.github.com/users/idris/followers","following_url":"https://api.github.com/users/idris/following{/other_user}","gists_url":"https://api.github.com/users/idris/gists{/gist_id}","starred_url":"https://api.github.com/users/idris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idris/subscriptions","organizations_url":"https://api.github.com/users/idris/orgs","repos_url":"https://api.github.com/users/idris/repos","events_url":"https://api.github.com/users/idris/events{/privacy}","received_events_url":"https://api.github.com/users/idris/received_events","type":"User","site_admin":false},"labels":[{"id":810199037,"node_id":"MDU6TGFiZWw4MTAxOTkwMzc=","url":"https://api.github.com/repos/DataDog/dd-trace-js/labels/community","name":"community","color":"0e8a16","default":false},{"id":807931156,"node_id":"MDU6TGFiZWw4MDc5MzExNTY=","url":"https://api.github.com/repos/DataDog/dd-trace-js/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-11-20T20:50:34Z","updated_at":"2018-11-25T04:11:50Z","closed_at":"2018-11-25T04:11:50Z","author_association":"NONE","body":"I'm setting up Trace Search, and have my graphql queries and mutations set in `analyzed_spans`.  That's all working great, but now I want to add a `user.id` tag to all of those spans so that I can filter by user ID in Trace Search & Analytics.\r\n\r\nWhat's the best way to do this?  I tried adding the following in a schema-level resolver (using [`addSchemaLevelResolveFunction` from graphql-tools](https://www.apollographql.com/docs/graphql-tools/resolvers.html#addSchemaLevelResolveFunction)):\r\n```js\r\naddSchemaLevelResolver(Schema, (user, args, ctx, info) => {\r\n  if (user) {\r\n    const scope = tracer.scopeManager().active();\r\n    if (scope) {\r\n      const span = scope.span();\r\n      if (span) {\r\n        span.setTag('user.id', user.id);\r\n      }\r\n    }\r\n  }\r\n});\r\n```\r\n\r\nThat did not work.. didn't add a tag to anything.  Ideas?"}}
{"actor":{"display_login":"idris"}}