{"action":"created","comment":{"url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/comments/166706444","pull_request_review_id":94813076,"id":166706444,"diff_hunk":"@@ -0,0 +1,86 @@\n+/**\n+ * Copyright 2017-2018 The OpenTracing Authors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License. You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software distributed under the License\n+ * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+package io.opentracing.contrib.spring.cloud;\n+\n+import io.opentracing.ScopeManager;\n+import io.opentracing.Span;\n+import io.opentracing.SpanContext;\n+import io.opentracing.Tracer;\n+import io.opentracing.propagation.Format;\n+\n+import org.springframework.beans.factory.BeanFactory;\n+\n+public class TracerUtils {\n+\n+  private TracerUtils() {\n+  }\n+\n+  /**\n+   * This method returns a proxy that will lazily retrieve the Tracer\n+   * bean when first used. This is to avoid premature resolution of\n+   * the Tracer bean during evaluation of BeanPostProcessors, which\n+   * would subsequently prevent the Tracer bean itself from being\n+   * post processed.\n+   *\n+   * @param beanFactory The bean factory\n+   * @return The tracer proxy\n+   */\n+  public static Tracer getTracer(BeanFactory beanFactory) {\n+    return new TracerProxy(beanFactory);\n+  }\n+\n+  public static class TracerProxy implements Tracer {","path":"opentracing-spring-cloud/src/main/java/io/opentracing/contrib/spring/cloud/TracerUtils.java","position":43,"original_position":43,"commit_id":"1df9d872894d67bc1d3304856175fdbeeaafb924","original_commit_id":"1df9d872894d67bc1d3304856175fdbeeaafb924","user":{"login":"pavolloffay","id":5618424,"avatar_url":"https://avatars0.githubusercontent.com/u/5618424?v=4","gravatar_id":"","url":"https://api.github.com/users/pavolloffay","html_url":"https://github.com/pavolloffay","followers_url":"https://api.github.com/users/pavolloffay/followers","following_url":"https://api.github.com/users/pavolloffay/following{/other_user}","gists_url":"https://api.github.com/users/pavolloffay/gists{/gist_id}","starred_url":"https://api.github.com/users/pavolloffay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavolloffay/subscriptions","organizations_url":"https://api.github.com/users/pavolloffay/orgs","repos_url":"https://api.github.com/users/pavolloffay/repos","events_url":"https://api.github.com/users/pavolloffay/events{/privacy}","received_events_url":"https://api.github.com/users/pavolloffay/received_events","type":"User","site_admin":false},"body":"I am not sure whether this is the right way how to deal with this. Could we rather autowire BeanFactory and use it to get the tracer? ","created_at":"2018-02-07T18:13:05Z","updated_at":"2018-02-07T18:13:05Z","html_url":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93#discussion_r166706444","pull_request_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/comments/166706444"},"html":{"href":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93#discussion_r166706444"},"pull_request":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93","id":167740950,"html_url":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93","diff_url":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93.diff","patch_url":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93.patch","issue_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/93","number":93,"state":"open","locked":false,"title":"WIP: Allow Tracer to be processed using a BeanPostProcessor","user":{"login":"objectiser","id":164562,"avatar_url":"https://avatars3.githubusercontent.com/u/164562?v=4","gravatar_id":"","url":"https://api.github.com/users/objectiser","html_url":"https://github.com/objectiser","followers_url":"https://api.github.com/users/objectiser/followers","following_url":"https://api.github.com/users/objectiser/following{/other_user}","gists_url":"https://api.github.com/users/objectiser/gists{/gist_id}","starred_url":"https://api.github.com/users/objectiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objectiser/subscriptions","organizations_url":"https://api.github.com/users/objectiser/orgs","repos_url":"https://api.github.com/users/objectiser/repos","events_url":"https://api.github.com/users/objectiser/events{/privacy}","received_events_url":"https://api.github.com/users/objectiser/received_events","type":"User","site_admin":false},"body":"Currently when using java-spring-cloud dependency instead of java-spring-web, I get the following:\r\n\r\n`Bean 'getTracer' of type [....] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)`\r\n\r\nThis results in the `Tracer` bean not being processed by any `BeanPostProcessors`, which means extensions like `java-metrics` are not able to add a wrapper around the tracer.\r\n\r\nThe problem is caused by other BeanPostProcessor implementations autowiring in the `Tracer`, which means it is no longer available to be post processed itself.\r\n\r\nThis PR makes some changes to return a wrapper around the Tracer that only actually retrieves the Tracer bean on first use. It solves the problem, but not sure if there is a better way?\r\n\r\n","created_at":"2018-02-07T16:25:04Z","updated_at":"2018-02-07T18:13:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db81d63361a4bf8863d1be19bb4ae678df68975e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93/commits","review_comments_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93/comments","review_comment_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/93/comments","statuses_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/statuses/1df9d872894d67bc1d3304856175fdbeeaafb924","head":{"label":"objectiser:postproc","ref":"postproc","sha":"1df9d872894d67bc1d3304856175fdbeeaafb924","user":{"login":"objectiser","id":164562,"avatar_url":"https://avatars3.githubusercontent.com/u/164562?v=4","gravatar_id":"","url":"https://api.github.com/users/objectiser","html_url":"https://github.com/objectiser","followers_url":"https://api.github.com/users/objectiser/followers","following_url":"https://api.github.com/users/objectiser/following{/other_user}","gists_url":"https://api.github.com/users/objectiser/gists{/gist_id}","starred_url":"https://api.github.com/users/objectiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objectiser/subscriptions","organizations_url":"https://api.github.com/users/objectiser/orgs","repos_url":"https://api.github.com/users/objectiser/repos","events_url":"https://api.github.com/users/objectiser/events{/privacy}","received_events_url":"https://api.github.com/users/objectiser/received_events","type":"User","site_admin":false},"repo":{"id":98430845,"name":"java-spring-cloud","full_name":"objectiser/java-spring-cloud","owner":{"login":"objectiser","id":164562,"avatar_url":"https://avatars3.githubusercontent.com/u/164562?v=4","gravatar_id":"","url":"https://api.github.com/users/objectiser","html_url":"https://github.com/objectiser","followers_url":"https://api.github.com/users/objectiser/followers","following_url":"https://api.github.com/users/objectiser/following{/other_user}","gists_url":"https://api.github.com/users/objectiser/gists{/gist_id}","starred_url":"https://api.github.com/users/objectiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objectiser/subscriptions","organizations_url":"https://api.github.com/users/objectiser/orgs","repos_url":"https://api.github.com/users/objectiser/repos","events_url":"https://api.github.com/users/objectiser/events{/privacy}","received_events_url":"https://api.github.com/users/objectiser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/objectiser/java-spring-cloud","description":"OpenTracing Spring Cloud Instrumentation","fork":true,"url":"https://api.github.com/repos/objectiser/java-spring-cloud","forks_url":"https://api.github.com/repos/objectiser/java-spring-cloud/forks","keys_url":"https://api.github.com/repos/objectiser/java-spring-cloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/objectiser/java-spring-cloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/objectiser/java-spring-cloud/teams","hooks_url":"https://api.github.com/repos/objectiser/java-spring-cloud/hooks","issue_events_url":"https://api.github.com/repos/objectiser/java-spring-cloud/issues/events{/number}","events_url":"https://api.github.com/repos/objectiser/java-spring-cloud/events","assignees_url":"https://api.github.com/repos/objectiser/java-spring-cloud/assignees{/user}","branches_url":"https://api.github.com/repos/objectiser/java-spring-cloud/branches{/branch}","tags_url":"https://api.github.com/repos/objectiser/java-spring-cloud/tags","blobs_url":"https://api.github.com/repos/objectiser/java-spring-cloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/objectiser/java-spring-cloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/objectiser/java-spring-cloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/objectiser/java-spring-cloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/objectiser/java-spring-cloud/statuses/{sha}","languages_url":"https://api.github.com/repos/objectiser/java-spring-cloud/languages","stargazers_url":"https://api.github.com/repos/objectiser/java-spring-cloud/stargazers","contributors_url":"https://api.github.com/repos/objectiser/java-spring-cloud/contributors","subscribers_url":"https://api.github.com/repos/objectiser/java-spring-cloud/subscribers","subscription_url":"https://api.github.com/repos/objectiser/java-spring-cloud/subscription","commits_url":"https://api.github.com/repos/objectiser/java-spring-cloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/objectiser/java-spring-cloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/objectiser/java-spring-cloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/objectiser/java-spring-cloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/objectiser/java-spring-cloud/contents/{+path}","compare_url":"https://api.github.com/repos/objectiser/java-spring-cloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/objectiser/java-spring-cloud/merges","archive_url":"https://api.github.com/repos/objectiser/java-spring-cloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/objectiser/java-spring-cloud/downloads","issues_url":"https://api.github.com/repos/objectiser/java-spring-cloud/issues{/number}","pulls_url":"https://api.github.com/repos/objectiser/java-spring-cloud/pulls{/number}","milestones_url":"https://api.github.com/repos/objectiser/java-spring-cloud/milestones{/number}","notifications_url":"https://api.github.com/repos/objectiser/java-spring-cloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/objectiser/java-spring-cloud/labels{/name}","releases_url":"https://api.github.com/repos/objectiser/java-spring-cloud/releases{/id}","deployments_url":"https://api.github.com/repos/objectiser/java-spring-cloud/deployments","created_at":"2017-07-26T14:16:33Z","updated_at":"2017-09-13T13:42:36Z","pushed_at":"2018-02-07T16:21:14Z","git_url":"git://github.com/objectiser/java-spring-cloud.git","ssh_url":"git@github.com:objectiser/java-spring-cloud.git","clone_url":"https://github.com/objectiser/java-spring-cloud.git","svn_url":"https://github.com/objectiser/java-spring-cloud","homepage":null,"size":275,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opentracing-contrib:master","ref":"master","sha":"bb1fb159278b75f24fea1fa938c319460754a79a","user":{"login":"opentracing-contrib","id":20525934,"avatar_url":"https://avatars0.githubusercontent.com/u/20525934?v=4","gravatar_id":"","url":"https://api.github.com/users/opentracing-contrib","html_url":"https://github.com/opentracing-contrib","followers_url":"https://api.github.com/users/opentracing-contrib/followers","following_url":"https://api.github.com/users/opentracing-contrib/following{/other_user}","gists_url":"https://api.github.com/users/opentracing-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/opentracing-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentracing-contrib/subscriptions","organizations_url":"https://api.github.com/users/opentracing-contrib/orgs","repos_url":"https://api.github.com/users/opentracing-contrib/repos","events_url":"https://api.github.com/users/opentracing-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/opentracing-contrib/received_events","type":"Organization","site_admin":false},"repo":{"id":96905440,"name":"java-spring-cloud","full_name":"opentracing-contrib/java-spring-cloud","owner":{"login":"opentracing-contrib","id":20525934,"avatar_url":"https://avatars0.githubusercontent.com/u/20525934?v=4","gravatar_id":"","url":"https://api.github.com/users/opentracing-contrib","html_url":"https://github.com/opentracing-contrib","followers_url":"https://api.github.com/users/opentracing-contrib/followers","following_url":"https://api.github.com/users/opentracing-contrib/following{/other_user}","gists_url":"https://api.github.com/users/opentracing-contrib/gists{/gist_id}","starred_url":"https://api.github.com/users/opentracing-contrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentracing-contrib/subscriptions","organizations_url":"https://api.github.com/users/opentracing-contrib/orgs","repos_url":"https://api.github.com/users/opentracing-contrib/repos","events_url":"https://api.github.com/users/opentracing-contrib/events{/privacy}","received_events_url":"https://api.github.com/users/opentracing-contrib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentracing-contrib/java-spring-cloud","description":"Distributed tracing for Spring Cloud and Spring Boot","fork":false,"url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud","forks_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/forks","keys_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/teams","hooks_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/hooks","issue_events_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/events{/number}","events_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/events","assignees_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/assignees{/user}","branches_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/branches{/branch}","tags_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/tags","blobs_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/statuses/{sha}","languages_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/languages","stargazers_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/stargazers","contributors_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/contributors","subscribers_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/subscribers","subscription_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/subscription","commits_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/contents/{+path}","compare_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/merges","archive_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/downloads","issues_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues{/number}","pulls_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls{/number}","milestones_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/milestones{/number}","notifications_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/labels{/name}","releases_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/releases{/id}","deployments_url":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/deployments","created_at":"2017-07-11T14:56:50Z","updated_at":"2018-02-07T00:58:51Z","pushed_at":"2018-02-07T16:25:05Z","git_url":"git://github.com/opentracing-contrib/java-spring-cloud.git","ssh_url":"git@github.com:opentracing-contrib/java-spring-cloud.git","clone_url":"https://github.com/opentracing-contrib/java-spring-cloud.git","svn_url":"https://github.com/opentracing-contrib/java-spring-cloud","homepage":"","size":245,"stargazers_count":24,"watchers_count":24,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":14,"open_issues":12,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93"},"html":{"href":"https://github.com/opentracing-contrib/java-spring-cloud/pull/93"},"issue":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/93"},"comments":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/opentracing-contrib/java-spring-cloud/statuses/1df9d872894d67bc1d3304856175fdbeeaafb924"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"pavolloffay"}}