diff --git a/.editorconfig b/.editorconfig index 323872eea..ddda9782f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -root=true +root = true [*.java] indent_style = tab @@ -13,4 +13,12 @@ continuation_indent_size = 8 [*.xml] indent_style = tab indent_size = 4 -continuation_indent_size = 8 \ No newline at end of file +continuation_indent_size = 8 + +[*.yml] +indent_style = space +indent_size = 2 + +[*.yaml] +indent_style = space +indent_size = 2 diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 0e7dabeff..23acc6ad8 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1 +1 @@ --Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar index 5fd4d5023..d61565a48 100644 Binary files a/.mvn/wrapper/maven-wrapper.jar and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 9ec796d92..66bfb1c18 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -13,5 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip \ No newline at end of file +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip diff --git a/.settings.xml b/.settings.xml index 8345c8587..ff7723bbe 100644 --- a/.settings.xml +++ b/.settings.xml @@ -16,74 +16,78 @@ --> - - - repo.spring.io - ${env.CI_DEPLOY_USERNAME} - ${env.CI_DEPLOY_PASSWORD} - - - - - - spring - true - - - spring-snapshots - Spring Snapshots - http://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - http://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - http://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - http://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - http://repo.spring.io/libs-milestone-local - - false - - - - - - - ide - true - - + + + repo.spring.io + ${env.CI_DEPLOY_USERNAME} + ${env.CI_DEPLOY_PASSWORD} + + + + + + spring + + true + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + spring-releases + Spring Releases + http://repo.spring.io/release + + false + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/libs-snapshot-local + + true + + + + spring-milestones + Spring Milestones + http://repo.spring.io/libs-milestone-local + + false + + + + + + + ide + + true + + + diff --git a/.springformat b/.springformat index e69de29bb..8b1378917 100644 --- a/.springformat +++ b/.springformat @@ -0,0 +1 @@ + diff --git a/asciidoctor.css b/asciidoctor.css index fbbbfb772..0960919db 100644 --- a/asciidoctor.css +++ b/asciidoctor.css @@ -17,399 +17,2011 @@ /* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */ /* Remove the comments around the @import statement below when using this as a custom stylesheet */ /*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic|Noto+Serif:400,400italic,700,700italic|Droid+Sans+Mono:400";*/ -article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block} -audio,canvas,video{display:inline-block} -audio:not([controls]){display:none;height:0} -[hidden],template{display:none} -script{display:none!important} -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} -body{margin:0} -a{background:transparent} -a:focus{outline:thin dotted} -a:active,a:hover{outline:0} -h1{font-size:2em;margin:.67em 0} -abbr[title]{border-bottom:1px dotted} -b,strong{font-weight:bold} -dfn{font-style:italic} -hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0} -mark{background:#ff0;color:#000} -code,kbd,pre,samp{font-family:monospace;font-size:1em} -pre{white-space:pre-wrap} -q{quotes:"\201C" "\201D" "\2018" "\2019"} -small{font-size:80%} -sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} -sup{top:-.5em} -sub{bottom:-.25em} -img{border:0} -svg:not(:root){overflow:hidden} -figure{margin:0} -fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} -legend{border:0;padding:0} -button,input,select,textarea{font-family:inherit;font-size:100%;margin:0} -button,input{line-height:normal} -button,select{text-transform:none} -button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer} -button[disabled],html input[disabled]{cursor:default} -input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0} -input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box} -input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none} -button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0} -textarea{overflow:auto;vertical-align:top} -table{border-collapse:collapse;border-spacing:0} -*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box} -html,body{font-size:100%} -body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto} -a:hover{cursor:pointer} -img,object,embed{max-width:100%;height:auto} -object,embed{height:100%} -img{-ms-interpolation-mode:bicubic} -#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none!important} -.left{float:left!important} -.right{float:right!important} -.text-left{text-align:left!important} -.text-right{text-align:right!important} -.text-center{text-align:center!important} -.text-justify{text-align:justify!important} -.hide{display:none} -.antialiased,body{-webkit-font-smoothing:antialiased} -img{display:inline-block;vertical-align:middle} -textarea{height:auto;min-height:50px} -select{width:100%} -p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{font-size:1.21875em;line-height:1.6} -.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em} -div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr} -a{color:#2156a5;text-decoration:underline;line-height:inherit} -a:hover,a:focus{color:#1d4b8f} -a img{border:none} -p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility} -p aside{font-size:.875em;line-height:1.35;font-style:italic} -h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em} -h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0} -h1{font-size:2.125em} -h2{font-size:1.6875em} -h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em} -h4,h5{font-size:1.125em} -h6{font-size:1em} -hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0} -em,i{font-style:italic;line-height:inherit} -strong,b{font-weight:bold;line-height:inherit} -small{font-size:60%;line-height:inherit} -code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} -ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} -ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em} -ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} -ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} -ul.square{list-style-type:square} -ul.circle{list-style-type:circle} -ul.disc{list-style-type:disc} -ul.no-bullet{list-style:none} -ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} -dl dt{margin-bottom:.3125em;font-weight:bold} -dl dd{margin-bottom:1.25em} -abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help} -abbr{text-transform:none} -blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd} -blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)} -blockquote cite:before{content:"\2014 \0020"} -blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)} -blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)} -@media only screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2} -h1{font-size:2.75em} -h2{font-size:2.3125em} -h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em} -h4{font-size:1.4375em}}table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede} -table thead,table tfoot{background:#f7f8f7;font-weight:bold} -table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left} -table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)} -table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7} -table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6} -h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em} -h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400} -.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table} -.clearfix:after,.float-group:after{clear:both} -*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed} -pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed} -.keyseq{color:rgba(51,51,51,.8)} -kbd{display:inline-block;color:rgba(0,0,0,.8);font-size:.75em;line-height:1.4;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:-.15em .15em 0 .15em;padding:.2em .6em .2em .5em;vertical-align:middle;white-space:nowrap} -.keyseq kbd:first-child{margin-left:0} -.keyseq kbd:last-child{margin-right:0} -.menuseq,.menu{color:rgba(0,0,0,.8)} -b.button:before,b.button:after{position:relative;top:-1px;font-weight:400} -b.button:before{content:"[";padding:0 3px 0 2px} -b.button:after{content:"]";padding:0 2px 0 3px} -p a>code:hover{color:rgba(0,0,0,.9)} -#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em} -#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table} -#header:after,#content:after,#footnotes:after,#footer:after{clear:both} -#content{margin-top:1.25em} -#content:before{content:none} -#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0} -#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8} -#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px} -#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap} -#header .details span:first-child{margin-left:-.125em} -#header .details span.email a{color:rgba(0,0,0,.85)} -#header .details br{display:none} -#header .details br+span:before{content:"\00a0\2013\00a0"} -#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)} -#header .details br+span#revremark:before{content:"\00a0|\00a0"} -#header #revnumber{text-transform:capitalize} -#header #revnumber:after{content:"\00a0"} -#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem} -#toc{border-bottom:1px solid #efefed;padding-bottom:.5em} -#toc>ul{margin-left:.125em} -#toc ul.sectlevel0>li>a{font-style:italic} -#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0} -#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none} -#toc a{text-decoration:none} -#toc a:active{text-decoration:underline} -#toctitle{color:#7a2518;font-size:1.2em} -@media only screen and (min-width:768px){#toctitle{font-size:1.375em} -body.toc2{padding-left:15em;padding-right:0} -#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto} -#toc.toc2 #toctitle{margin-top:0;font-size:1.2em} -#toc.toc2>ul{font-size:.9em;margin-bottom:0} -#toc.toc2 ul ul{margin-left:0;padding-left:1em} -#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em} -body.toc2.toc-right{padding-left:0;padding-right:15em} -body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}}@media only screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0} -#toc.toc2{width:20em} -#toc.toc2 #toctitle{font-size:1.375em} -#toc.toc2>ul{font-size:.95em} -#toc.toc2 ul ul{padding-left:1.25em} -body.toc2.toc-right{padding-left:0;padding-right:20em}}#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} -#content #toc>:first-child{margin-top:0} -#content #toc>:last-child{margin-bottom:0} -#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em} -#footer-text{color:rgba(255,255,255,.8);line-height:1.44} -.sect1{padding-bottom:.625em} -@media only screen and (min-width:768px){.sect1{padding-bottom:1.25em}}.sect1+.sect1{border-top:1px solid #efefed} -#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400} -#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em} -#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible} -#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none} -#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221} -.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em} -.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic} -table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0} -.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{color:rgba(0,0,0,.85)} -table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit} -.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} -.admonitionblock>table td.icon{text-align:center;width:80px} -.admonitionblock>table td.icon img{max-width:none} -.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} -.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)} -.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} -.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px} -.exampleblock>.content>:first-child{margin-top:0} -.exampleblock>.content>:last-child{margin-bottom:0} -.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} -.sidebarblock>:first-child{margin-top:0} -.sidebarblock>:last-child{margin-bottom:0} -.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center} -.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0} -.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8} -.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1} -.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em} -.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal} -@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)} -.listingblock pre.highlightjs{padding:0} -.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px} -.listingblock pre.prettyprint{border-width:0} -.listingblock>.content{position:relative} -.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999} -.listingblock:hover code[data-lang]:before{display:block} -.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999} -.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"} -table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none} -table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0} -table.pyhltable td.code{padding-left:.75em;padding-right:0} -pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8} -pre.pygments .lineno{display:inline-block;margin-right:.25em} -table.pyhltable .linenodiv{background:none!important;padding-right:0!important} -.quoteblock{margin:0 1em 1.25em 1.5em;display:table} -.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em} -.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify} -.quoteblock blockquote{margin:0;padding:0;border:0} -.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)} -.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0} -.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right} -.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)} -.quoteblock .quoteblock blockquote{padding:0 0 0 .75em} -.quoteblock .quoteblock blockquote:before{display:none} -.verseblock{margin:0 1em 1.25em 1em} -.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility} -.verseblock pre strong{font-weight:400} -.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex} -.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic} -.quoteblock .attribution br,.verseblock .attribution br{display:none} -.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.05em;color:rgba(0,0,0,.6)} -.quoteblock.abstract{margin:0 0 1.25em 0;display:block} -.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0} -.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none} -table.tableblock{max-width:100%;border-collapse:separate} -table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0} -table.spread{width:100%} -table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} -table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0} -table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0} -table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0} -table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0} -table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0} -table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0} -table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0} -table.frame-all{border-width:1px} -table.frame-sides{border-width:0 1px} -table.frame-topbot{border-width:1px 0} -th.halign-left,td.halign-left{text-align:left} -th.halign-right,td.halign-right{text-align:right} -th.halign-center,td.halign-center{text-align:center} -th.valign-top,td.valign-top{vertical-align:top} -th.valign-bottom,td.valign-bottom{vertical-align:bottom} -th.valign-middle,td.valign-middle{vertical-align:middle} -table thead th,table tfoot th{font-weight:bold} -tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7} -tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold} -p.tableblock>code:only-child{background:none;padding:0} -p.tableblock{font-size:1em} -td>div.verse{white-space:pre} -ol{margin-left:1.75em} -ul li ol{margin-left:1.5em} -dl dd{margin-left:1.125em} -dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} -ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} -ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none} -ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em} -ul.checklist li>p:first-child>.fa-check-square-o:first-child,ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} -ul.checklist li>p:first-child>input[type="checkbox"]:first-child{position:relative;top:1px} -ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden} -ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block} -ul.inline>li>*{display:block} -.unstyled dl dt{font-weight:400;font-style:normal} -ol.arabic{list-style-type:decimal} -ol.decimal{list-style-type:decimal-leading-zero} -ol.loweralpha{list-style-type:lower-alpha} -ol.upperalpha{list-style-type:upper-alpha} -ol.lowerroman{list-style-type:lower-roman} -ol.upperroman{list-style-type:upper-roman} -ol.lowergreek{list-style-type:lower-greek} -.hdlist>table,.colist>table{border:0;background:none} -.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none} -td.hdlist1{padding-right:.75em;font-weight:bold} -td.hdlist1,td.hdlist2{vertical-align:top} -.literalblock+.colist,.listingblock+.colist{margin-top:-.5em} -.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1} -.colist>table tr>td:last-of-type{padding:.25em 0} -.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} -.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0} -.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em} -.imageblock>.title{margin-bottom:0} -.imageblock.thumb,.imageblock.th{border-width:6px} -.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em} -.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0} -.image.left{margin-right:.625em} -.image.right{margin-left:.625em} -a.image{text-decoration:none} -span.footnote,span.footnoteref{vertical-align:super;font-size:.875em} -span.footnote a,span.footnoteref a{text-decoration:none} -span.footnote a:active,span.footnoteref a:active{text-decoration:underline} -#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em} -#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0} -#footnotes .footnote{padding:0 .375em;line-height:1.3;font-size:.875em;margin-left:1.2em;text-indent:-1.2em;margin-bottom:.2em} -#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none} -#footnotes .footnote:last-of-type{margin-bottom:0} -#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0} -.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0} -.gist .file-data>table td.line-data{width:99%} -div.unbreakable{page-break-inside:avoid} -.big{font-size:larger} -.small{font-size:smaller} -.underline{text-decoration:underline} -.overline{text-decoration:overline} -.line-through{text-decoration:line-through} -.aqua{color:#00bfbf} -.aqua-background{background-color:#00fafa} -.black{color:#000} -.black-background{background-color:#000} -.blue{color:#0000bf} -.blue-background{background-color:#0000fa} -.fuchsia{color:#bf00bf} -.fuchsia-background{background-color:#fa00fa} -.gray{color:#606060} -.gray-background{background-color:#7d7d7d} -.green{color:#006000} -.green-background{background-color:#007d00} -.lime{color:#00bf00} -.lime-background{background-color:#00fa00} -.maroon{color:#600000} -.maroon-background{background-color:#7d0000} -.navy{color:#000060} -.navy-background{background-color:#00007d} -.olive{color:#606000} -.olive-background{background-color:#7d7d00} -.purple{color:#600060} -.purple-background{background-color:#7d007d} -.red{color:#bf0000} -.red-background{background-color:#fa0000} -.silver{color:#909090} -.silver-background{background-color:#bcbcbc} -.teal{color:#006060} -.teal-background{background-color:#007d7d} -.white{color:#bfbfbf} -.white-background{background-color:#fafafa} -.yellow{color:#bfbf00} -.yellow-background{background-color:#fafa00} -span.icon>.fa{cursor:default} -.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} -.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c} -.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} -.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900} -.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400} -.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000} -.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold} -.conum[data-value] *{color:#fff!important} -.conum[data-value]+b{display:none} -.conum[data-value]:after{content:attr(data-value)} -pre .conum[data-value]{position:relative;top:-.125em} -b.conum *{color:inherit!important} -.conum:not([data-value]):empty{display:none} -h1,h2{letter-spacing:-.01em} -dt,th.tableblock,td.content{text-rendering:optimizeLegibility} -p,td.content{letter-spacing:-.01em} -p strong,td.content strong{letter-spacing:-.005em} -p,blockquote,dt,td.content{font-size:1.0625rem} -p{margin-bottom:1.25rem} -.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em} -.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc} -.print-only{display:none!important} -@media print{@page{margin:1.25cm .75cm} -*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important} -a{color:inherit!important;text-decoration:underline!important} -a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important} -a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em} -abbr[title]:after{content:" (" attr(title) ")"} -pre,blockquote,tr,img{page-break-inside:avoid} -thead{display:table-header-group} -img{max-width:100%!important} -p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3} -h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid} -#toc,.sidebarblock,.exampleblock>.content{background:none!important} -#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important} -.sect1{padding-bottom:0!important} -.sect1+.sect1{border:0!important} -#header>h1:first-child{margin-top:1.25rem} -body.book #header{text-align:center} -body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0} -body.book #header .details{border:0!important;display:block;padding:0!important} -body.book #header .details span:first-child{margin-left:0!important} -body.book #header .details br{display:block} -body.book #header .details br+span:before{content:none!important} -body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important} -body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always} -.listingblock code[data-lang]:before{display:block} -#footer{background:none!important;padding:0 .9375em} -#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em} -.hide-on-print{display:none!important} -.print-only{display:block!important} -.hide-for-print{display:none!important} -.show-for-print{display:inherit!important}} \ No newline at end of file +article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { + display: block +} + +audio, canvas, video { + display: inline-block +} + +audio:not([controls]) { + display: none; + height: 0 +} + +[hidden], template { + display: none +} + +script { + display: none !important +} + +html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100% +} + +body { + margin: 0 +} + +a { + background: transparent +} + +a:focus { + outline: thin dotted +} + +a:active, a:hover { + outline: 0 +} + +h1 { + font-size: 2em; + margin: .67em 0 +} + +abbr[title] { + border-bottom: 1px dotted +} + +b, strong { + font-weight: bold +} + +dfn { + font-style: italic +} + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0 +} + +mark { + background: #ff0; + color: #000 +} + +code, kbd, pre, samp { + font-family: monospace; + font-size: 1em +} + +pre { + white-space: pre-wrap +} + +q { + quotes: "\201C" "\201D" "\2018" "\2019" +} + +small { + font-size: 80% +} + +sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline +} + +sup { + top: -.5em +} + +sub { + bottom: -.25em +} + +img { + border: 0 +} + +svg:not(:root) { + overflow: hidden +} + +figure { + margin: 0 +} + +fieldset { + border: 1px solid silver; + margin: 0 2px; + padding: .35em .625em .75em +} + +legend { + border: 0; + padding: 0 +} + +button, input, select, textarea { + font-family: inherit; + font-size: 100%; + margin: 0 +} + +button, input { + line-height: normal +} + +button, select { + text-transform: none +} + +button, html input[type="button"], input[type="reset"], input[type="submit"] { + -webkit-appearance: button; + cursor: pointer +} + +button[disabled], html input[disabled] { + cursor: default +} + +input[type="checkbox"], input[type="radio"] { + box-sizing: border-box; + padding: 0 +} + +input[type="search"] { + -webkit-appearance: textfield; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box +} + +input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none +} + +button::-moz-focus-inner, input::-moz-focus-inner { + border: 0; + padding: 0 +} + +textarea { + overflow: auto; + vertical-align: top +} + +table { + border-collapse: collapse; + border-spacing: 0 +} + +*, *:before, *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box +} + +html, body { + font-size: 100% +} + +body { + background: #fff; + color: rgba(0, 0, 0, .8); + padding: 0; + margin: 0; + font-family: "Noto Serif", "DejaVu Serif", serif; + font-weight: 400; + font-style: normal; + line-height: 1; + position: relative; + cursor: auto +} + +a:hover { + cursor: pointer +} + +img, object, embed { + max-width: 100%; + height: auto +} + +object, embed { + height: 100% +} + +img { + -ms-interpolation-mode: bicubic +} + +#map_canvas img, #map_canvas embed, #map_canvas object, .map_canvas img, .map_canvas embed, .map_canvas object { + max-width: none !important +} + +.left { + float: left !important +} + +.right { + float: right !important +} + +.text-left { + text-align: left !important +} + +.text-right { + text-align: right !important +} + +.text-center { + text-align: center !important +} + +.text-justify { + text-align: justify !important +} + +.hide { + display: none +} + +.antialiased, body { + -webkit-font-smoothing: antialiased +} + +img { + display: inline-block; + vertical-align: middle +} + +textarea { + height: auto; + min-height: 50px +} + +select { + width: 100% +} + +p.lead, .paragraph.lead > p, #preamble > .sectionbody > .paragraph:first-of-type p { + font-size: 1.21875em; + line-height: 1.6 +} + +.subheader, .admonitionblock td.content > .title, .audioblock > .title, .exampleblock > .title, .imageblock > .title, .listingblock > .title, .literalblock > .title, .stemblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, table.tableblock > .title, .verseblock > .title, .videoblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { + line-height: 1.45; + color: #7a2518; + font-weight: 400; + margin-top: 0; + margin-bottom: .25em +} + +div, dl, dt, dd, ul, ol, li, h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6, pre, form, p, blockquote, th, td { + margin: 0; + padding: 0; + direction: ltr +} + +a { + color: #2156a5; + text-decoration: underline; + line-height: inherit +} + +a:hover, a:focus { + color: #1d4b8f +} + +a img { + border: none +} + +p { + font-family: inherit; + font-weight: 400; + font-size: 1em; + line-height: 1.6; + margin-bottom: 1.25em; + text-rendering: optimizeLegibility +} + +p aside { + font-size: .875em; + line-height: 1.35; + font-style: italic +} + +h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { + font-family: "Open Sans", "DejaVu Sans", sans-serif; + font-weight: 300; + font-style: normal; + color: #ba3925; + text-rendering: optimizeLegibility; + margin-top: 1em; + margin-bottom: .5em; + line-height: 1.0125em +} + +h1 small, h2 small, h3 small, #toctitle small, .sidebarblock > .content > .title small, h4 small, h5 small, h6 small { + font-size: 60%; + color: #e99b8f; + line-height: 0 +} + +h1 { + font-size: 2.125em +} + +h2 { + font-size: 1.6875em +} + +h3, #toctitle, .sidebarblock > .content > .title { + font-size: 1.375em +} + +h4, h5 { + font-size: 1.125em +} + +h6 { + font-size: 1em +} + +hr { + border: solid #ddddd8; + border-width: 1px 0 0; + clear: both; + margin: 1.25em 0 1.1875em; + height: 0 +} + +em, i { + font-style: italic; + line-height: inherit +} + +strong, b { + font-weight: bold; + line-height: inherit +} + +small { + font-size: 60%; + line-height: inherit +} + +code { + font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace; + font-weight: 400; + color: rgba(0, 0, 0, .9) +} + +ul, ol, dl { + font-size: 1em; + line-height: 1.6; + margin-bottom: 1.25em; + list-style-position: outside; + font-family: inherit +} + +ul, ol, ul.no-bullet, ol.no-bullet { + margin-left: 1.5em +} + +ul li ul, ul li ol { + margin-left: 1.25em; + margin-bottom: 0; + font-size: 1em +} + +ul.square li ul, ul.circle li ul, ul.disc li ul { + list-style: inherit +} + +ul.square { + list-style-type: square +} + +ul.circle { + list-style-type: circle +} + +ul.disc { + list-style-type: disc +} + +ul.no-bullet { + list-style: none +} + +ol li ul, ol li ol { + margin-left: 1.25em; + margin-bottom: 0 +} + +dl dt { + margin-bottom: .3125em; + font-weight: bold +} + +dl dd { + margin-bottom: 1.25em +} + +abbr, acronym { + text-transform: uppercase; + font-size: 90%; + color: rgba(0, 0, 0, .8); + border-bottom: 1px dotted #ddd; + cursor: help +} + +abbr { + text-transform: none +} + +blockquote { + margin: 0 0 1.25em; + padding: .5625em 1.25em 0 1.1875em; + border-left: 1px solid #ddd +} + +blockquote cite { + display: block; + font-size: .9375em; + color: rgba(0, 0, 0, .6) +} + +blockquote cite:before { + content: "\2014 \0020" +} + +blockquote cite a, blockquote cite a:visited { + color: rgba(0, 0, 0, .6) +} + +blockquote, blockquote p { + line-height: 1.6; + color: rgba(0, 0, 0, .85) +} + +@media only screen and (min-width: 768px) { + h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { + line-height: 1.2 + } + + h1 { + font-size: 2.75em + } + + h2 { + font-size: 2.3125em + } + + h3, #toctitle, .sidebarblock > .content > .title { + font-size: 1.6875em + } + + h4 { + font-size: 1.4375em + } +} + +table { + background: #fff; + margin-bottom: 1.25em; + border: solid 1px #dedede +} + +table thead, table tfoot { + background: #f7f8f7; + font-weight: bold +} + +table thead tr th, table thead tr td, table tfoot tr th, table tfoot tr td { + padding: .5em .625em .625em; + font-size: inherit; + color: rgba(0, 0, 0, .8); + text-align: left +} + +table tr th, table tr td { + padding: .5625em .625em; + font-size: inherit; + color: rgba(0, 0, 0, .8) +} + +table tr.even, table tr.alt, table tr:nth-of-type(even) { + background: #f8f8f7 +} + +table thead tr th, table tfoot tr th, table tbody tr td, table tr td, table tfoot tr td { + display: table-cell; + line-height: 1.6 +} + +h1, h2, h3, #toctitle, .sidebarblock > .content > .title, h4, h5, h6 { + line-height: 1.2; + word-spacing: -.05em +} + +h1 strong, h2 strong, h3 strong, #toctitle strong, .sidebarblock > .content > .title strong, h4 strong, h5 strong, h6 strong { + font-weight: 400 +} + +.clearfix:before, .clearfix:after, .float-group:before, .float-group:after { + content: " "; + display: table +} + +.clearfix:after, .float-group:after { + clear: both +} + +*:not(pre) > code { + font-size: .9375em; + font-style: normal !important; + letter-spacing: 0; + padding: .1em .5ex; + word-spacing: -.15em; + background-color: #f7f7f8; + -webkit-border-radius: 4px; + border-radius: 4px; + line-height: 1.45; + text-rendering: optimizeSpeed +} + +pre, pre > code { + line-height: 1.45; + color: rgba(0, 0, 0, .9); + font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace; + font-weight: 400; + text-rendering: optimizeSpeed +} + +.keyseq { + color: rgba(51, 51, 51, .8) +} + +kbd { + display: inline-block; + color: rgba(0, 0, 0, .8); + font-size: .75em; + line-height: 1.4; + background-color: #f7f7f7; + border: 1px solid #ccc; + -webkit-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 0 0 .1em white inset; + box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 0 0 .1em #fff inset; + margin: -.15em .15em 0 .15em; + padding: .2em .6em .2em .5em; + vertical-align: middle; + white-space: nowrap +} + +.keyseq kbd:first-child { + margin-left: 0 +} + +.keyseq kbd:last-child { + margin-right: 0 +} + +.menuseq, .menu { + color: rgba(0, 0, 0, .8) +} + +b.button:before, b.button:after { + position: relative; + top: -1px; + font-weight: 400 +} + +b.button:before { + content: "["; + padding: 0 3px 0 2px +} + +b.button:after { + content: "]"; + padding: 0 2px 0 3px +} + +p a > code:hover { + color: rgba(0, 0, 0, .9) +} + +#header, #content, #footnotes, #footer { + width: 100%; + margin-left: auto; + margin-right: auto; + margin-top: 0; + margin-bottom: 0; + max-width: 62.5em; + *zoom: 1; + position: relative; + padding-left: .9375em; + padding-right: .9375em +} + +#header:before, #header:after, #content:before, #content:after, #footnotes:before, #footnotes:after, #footer:before, #footer:after { + content: " "; + display: table +} + +#header:after, #content:after, #footnotes:after, #footer:after { + clear: both +} + +#content { + margin-top: 1.25em +} + +#content:before { + content: none +} + +#header > h1:first-child { + color: rgba(0, 0, 0, .85); + margin-top: 2.25rem; + margin-bottom: 0 +} + +#header > h1:first-child + #toc { + margin-top: 8px; + border-top: 1px solid #ddddd8 +} + +#header > h1:only-child, body.toc2 #header > h1:nth-last-child(2) { + border-bottom: 1px solid #ddddd8; + padding-bottom: 8px +} + +#header .details { + border-bottom: 1px solid #ddddd8; + line-height: 1.45; + padding-top: .25em; + padding-bottom: .25em; + padding-left: .25em; + color: rgba(0, 0, 0, .6); + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -ms-flex-flow: row wrap; + -webkit-flex-flow: row wrap; + flex-flow: row wrap +} + +#header .details span:first-child { + margin-left: -.125em +} + +#header .details span.email a { + color: rgba(0, 0, 0, .85) +} + +#header .details br { + display: none +} + +#header .details br + span:before { + content: "\00a0\2013\00a0" +} + +#header .details br + span.author:before { + content: "\00a0\22c5\00a0"; + color: rgba(0, 0, 0, .85) +} + +#header .details br + span#revremark:before { + content: "\00a0|\00a0" +} + +#header #revnumber { + text-transform: capitalize +} + +#header #revnumber:after { + content: "\00a0" +} + +#content > h1:first-child:not([class]) { + color: rgba(0, 0, 0, .85); + border-bottom: 1px solid #ddddd8; + padding-bottom: 8px; + margin-top: 0; + padding-top: 1rem; + margin-bottom: 1.25rem +} + +#toc { + border-bottom: 1px solid #efefed; + padding-bottom: .5em +} + +#toc > ul { + margin-left: .125em +} + +#toc ul.sectlevel0 > li > a { + font-style: italic +} + +#toc ul.sectlevel0 ul.sectlevel1 { + margin: .5em 0 +} + +#toc ul { + font-family: "Open Sans", "DejaVu Sans", sans-serif; + list-style-type: none +} + +#toc a { + text-decoration: none +} + +#toc a:active { + text-decoration: underline +} + +#toctitle { + color: #7a2518; + font-size: 1.2em +} + +@media only screen and (min-width: 768px) { + #toctitle { + font-size: 1.375em + } + + body.toc2 { + padding-left: 15em; + padding-right: 0 + } + + #toc.toc2 { + margin-top: 0 !important; + background-color: #f8f8f7; + position: fixed; + width: 15em; + left: 0; + top: 0; + border-right: 1px solid #efefed; + border-top-width: 0 !important; + border-bottom-width: 0 !important; + z-index: 1000; + padding: 1.25em 1em; + height: 100%; + overflow: auto + } + + #toc.toc2 #toctitle { + margin-top: 0; + font-size: 1.2em + } + + #toc.toc2 > ul { + font-size: .9em; + margin-bottom: 0 + } + + #toc.toc2 ul ul { + margin-left: 0; + padding-left: 1em + } + + #toc.toc2 ul.sectlevel0 ul.sectlevel1 { + padding-left: 0; + margin-top: .5em; + margin-bottom: .5em + } + + body.toc2.toc-right { + padding-left: 0; + padding-right: 15em + } + + body.toc2.toc-right #toc.toc2 { + border-right-width: 0; + border-left: 1px solid #efefed; + left: auto; + right: 0 + } +} + +@media only screen and (min-width: 1280px) { + body.toc2 { + padding-left: 20em; + padding-right: 0 + } + + #toc.toc2 { + width: 20em + } + + #toc.toc2 #toctitle { + font-size: 1.375em + } + + #toc.toc2 > ul { + font-size: .95em + } + + #toc.toc2 ul ul { + padding-left: 1.25em + } + + body.toc2.toc-right { + padding-left: 0; + padding-right: 20em + } +} + +#content #toc { + border-style: solid; + border-width: 1px; + border-color: #e0e0dc; + margin-bottom: 1.25em; + padding: 1.25em; + background: #f8f8f7; + -webkit-border-radius: 4px; + border-radius: 4px +} + +#content #toc > :first-child { + margin-top: 0 +} + +#content #toc > :last-child { + margin-bottom: 0 +} + +#footer { + max-width: 100%; + background-color: rgba(0, 0, 0, .8); + padding: 1.25em +} + +#footer-text { + color: rgba(255, 255, 255, .8); + line-height: 1.44 +} + +.sect1 { + padding-bottom: .625em +} + +@media only screen and (min-width: 768px) { + .sect1 { + padding-bottom: 1.25em + } +} + +.sect1 + .sect1 { + border-top: 1px solid #efefed +} + +#content h1 > a.anchor, h2 > a.anchor, h3 > a.anchor, #toctitle > a.anchor, .sidebarblock > .content > .title > a.anchor, h4 > a.anchor, h5 > a.anchor, h6 > a.anchor { + position: absolute; + z-index: 1001; + width: 1.5ex; + margin-left: -1.5ex; + display: block; + text-decoration: none !important; + visibility: hidden; + text-align: center; + font-weight: 400 +} + +#content h1 > a.anchor:before, h2 > a.anchor:before, h3 > a.anchor:before, #toctitle > a.anchor:before, .sidebarblock > .content > .title > a.anchor:before, h4 > a.anchor:before, h5 > a.anchor:before, h6 > a.anchor:before { + content: "\00A7"; + font-size: .85em; + display: block; + padding-top: .1em +} + +#content h1:hover > a.anchor, #content h1 > a.anchor:hover, h2:hover > a.anchor, h2 > a.anchor:hover, h3:hover > a.anchor, #toctitle:hover > a.anchor, .sidebarblock > .content > .title:hover > a.anchor, h3 > a.anchor:hover, #toctitle > a.anchor:hover, .sidebarblock > .content > .title > a.anchor:hover, h4:hover > a.anchor, h4 > a.anchor:hover, h5:hover > a.anchor, h5 > a.anchor:hover, h6:hover > a.anchor, h6 > a.anchor:hover { + visibility: visible +} + +#content h1 > a.link, h2 > a.link, h3 > a.link, #toctitle > a.link, .sidebarblock > .content > .title > a.link, h4 > a.link, h5 > a.link, h6 > a.link { + color: #ba3925; + text-decoration: none +} + +#content h1 > a.link:hover, h2 > a.link:hover, h3 > a.link:hover, #toctitle > a.link:hover, .sidebarblock > .content > .title > a.link:hover, h4 > a.link:hover, h5 > a.link:hover, h6 > a.link:hover { + color: #a53221 +} + +.audioblock, .imageblock, .literalblock, .listingblock, .stemblock, .videoblock { + margin-bottom: 1.25em +} + +.admonitionblock td.content > .title, .audioblock > .title, .exampleblock > .title, .imageblock > .title, .listingblock > .title, .literalblock > .title, .stemblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, table.tableblock > .title, .verseblock > .title, .videoblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { + text-rendering: optimizeLegibility; + text-align: left; + font-family: "Noto Serif", "DejaVu Serif", serif; + font-size: 1rem; + font-style: italic +} + +table.tableblock > caption.title { + white-space: nowrap; + overflow: visible; + max-width: 0 +} + +.paragraph.lead > p, #preamble > .sectionbody > .paragraph:first-of-type p { + color: rgba(0, 0, 0, .85) +} + +table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { + font-size: inherit +} + +.admonitionblock > table { + border-collapse: separate; + border: 0; + background: none; + width: 100% +} + +.admonitionblock > table td.icon { + text-align: center; + width: 80px +} + +.admonitionblock > table td.icon img { + max-width: none +} + +.admonitionblock > table td.icon .title { + font-weight: bold; + font-family: "Open Sans", "DejaVu Sans", sans-serif; + text-transform: uppercase +} + +.admonitionblock > table td.content { + padding-left: 1.125em; + padding-right: 1.25em; + border-left: 1px solid #ddddd8; + color: rgba(0, 0, 0, .6) +} + +.admonitionblock > table td.content > :last-child > :last-child { + margin-bottom: 0 +} + +.exampleblock > .content { + border-style: solid; + border-width: 1px; + border-color: #e6e6e6; + margin-bottom: 1.25em; + padding: 1.25em; + background: #fff; + -webkit-border-radius: 4px; + border-radius: 4px +} + +.exampleblock > .content > :first-child { + margin-top: 0 +} + +.exampleblock > .content > :last-child { + margin-bottom: 0 +} + +.sidebarblock { + border-style: solid; + border-width: 1px; + border-color: #e0e0dc; + margin-bottom: 1.25em; + padding: 1.25em; + background: #f8f8f7; + -webkit-border-radius: 4px; + border-radius: 4px +} + +.sidebarblock > :first-child { + margin-top: 0 +} + +.sidebarblock > :last-child { + margin-bottom: 0 +} + +.sidebarblock > .content > .title { + color: #7a2518; + margin-top: 0; + text-align: center +} + +.exampleblock > .content > :last-child > :last-child, .exampleblock > .content .olist > ol > li:last-child > :last-child, .exampleblock > .content .ulist > ul > li:last-child > :last-child, .exampleblock > .content .qlist > ol > li:last-child > :last-child, .sidebarblock > .content > :last-child > :last-child, .sidebarblock > .content .olist > ol > li:last-child > :last-child, .sidebarblock > .content .ulist > ul > li:last-child > :last-child, .sidebarblock > .content .qlist > ol > li:last-child > :last-child { + margin-bottom: 0 +} + +.literalblock pre, .listingblock pre:not(.highlight), .listingblock pre[class="highlight"], .listingblock pre[class^="highlight "], .listingblock pre.CodeRay, .listingblock pre.prettyprint { + background: #f7f7f8 +} + +.sidebarblock .literalblock pre, .sidebarblock .listingblock pre:not(.highlight), .sidebarblock .listingblock pre[class="highlight"], .sidebarblock .listingblock pre[class^="highlight "], .sidebarblock .listingblock pre.CodeRay, .sidebarblock .listingblock pre.prettyprint { + background: #f2f1f1 +} + +.literalblock pre, .literalblock pre[class], .listingblock pre, .listingblock pre[class] { + -webkit-border-radius: 4px; + border-radius: 4px; + word-wrap: break-word; + padding: 1em; + font-size: .8125em +} + +.literalblock pre.nowrap, .literalblock pre[class].nowrap, .listingblock pre.nowrap, .listingblock pre[class].nowrap { + overflow-x: auto; + white-space: pre; + word-wrap: normal +} + +@media only screen and (min-width: 768px) { + .literalblock pre, .literalblock pre[class], .listingblock pre, .listingblock pre[class] { + font-size: .90625em + } +} + +@media only screen and (min-width: 1280px) { + .literalblock pre, .literalblock pre[class], .listingblock pre, .listingblock pre[class] { + font-size: 1em + } +} + +.literalblock.output pre { + color: #f7f7f8; + background-color: rgba(0, 0, 0, .9) +} + +.listingblock pre.highlightjs { + padding: 0 +} + +.listingblock pre.highlightjs > code { + padding: 1em; + -webkit-border-radius: 4px; + border-radius: 4px +} + +.listingblock pre.prettyprint { + border-width: 0 +} + +.listingblock > .content { + position: relative +} + +.listingblock code[data-lang]:before { + display: none; + content: attr(data-lang); + position: absolute; + font-size: .75em; + top: .425rem; + right: .5rem; + line-height: 1; + text-transform: uppercase; + color: #999 +} + +.listingblock:hover code[data-lang]:before { + display: block +} + +.listingblock.terminal pre .command:before { + content: attr(data-prompt); + padding-right: .5em; + color: #999 +} + +.listingblock.terminal pre .command:not([data-prompt]):before { + content: "$" +} + +table.pyhltable { + border-collapse: separate; + border: 0; + margin-bottom: 0; + background: none +} + +table.pyhltable td { + vertical-align: top; + padding-top: 0; + padding-bottom: 0 +} + +table.pyhltable td.code { + padding-left: .75em; + padding-right: 0 +} + +pre.pygments .lineno, table.pyhltable td:not(.code) { + color: #999; + padding-left: 0; + padding-right: .5em; + border-right: 1px solid #ddddd8 +} + +pre.pygments .lineno { + display: inline-block; + margin-right: .25em +} + +table.pyhltable .linenodiv { + background: none !important; + padding-right: 0 !important +} + +.quoteblock { + margin: 0 1em 1.25em 1.5em; + display: table +} + +.quoteblock > .title { + margin-left: -1.5em; + margin-bottom: .75em +} + +.quoteblock blockquote, .quoteblock blockquote p { + color: rgba(0, 0, 0, .85); + font-size: 1.15rem; + line-height: 1.75; + word-spacing: .1em; + letter-spacing: 0; + font-style: italic; + text-align: justify +} + +.quoteblock blockquote { + margin: 0; + padding: 0; + border: 0 +} + +.quoteblock blockquote:before { + content: "\201c"; + float: left; + font-size: 2.75em; + font-weight: bold; + line-height: .6em; + margin-left: -.6em; + color: #7a2518; + text-shadow: 0 1px 2px rgba(0, 0, 0, .1) +} + +.quoteblock blockquote > .paragraph:last-child p { + margin-bottom: 0 +} + +.quoteblock .attribution { + margin-top: .5em; + margin-right: .5ex; + text-align: right +} + +.quoteblock .quoteblock { + margin-left: 0; + margin-right: 0; + padding: .5em 0; + border-left: 3px solid rgba(0, 0, 0, .6) +} + +.quoteblock .quoteblock blockquote { + padding: 0 0 0 .75em +} + +.quoteblock .quoteblock blockquote:before { + display: none +} + +.verseblock { + margin: 0 1em 1.25em 1em +} + +.verseblock pre { + font-family: "Open Sans", "DejaVu Sans", sans; + font-size: 1.15rem; + color: rgba(0, 0, 0, .85); + font-weight: 300; + text-rendering: optimizeLegibility +} + +.verseblock pre strong { + font-weight: 400 +} + +.verseblock .attribution { + margin-top: 1.25rem; + margin-left: .5ex +} + +.quoteblock .attribution, .verseblock .attribution { + font-size: .9375em; + line-height: 1.45; + font-style: italic +} + +.quoteblock .attribution br, .verseblock .attribution br { + display: none +} + +.quoteblock .attribution cite, .verseblock .attribution cite { + display: block; + letter-spacing: -.05em; + color: rgba(0, 0, 0, .6) +} + +.quoteblock.abstract { + margin: 0 0 1.25em 0; + display: block +} + +.quoteblock.abstract blockquote, .quoteblock.abstract blockquote p { + text-align: left; + word-spacing: 0 +} + +.quoteblock.abstract blockquote:before, .quoteblock.abstract blockquote p:first-of-type:before { + display: none +} + +table.tableblock { + max-width: 100%; + border-collapse: separate +} + +table.tableblock td > .paragraph:last-child p > p:last-child, table.tableblock th > p:last-child, table.tableblock td > p:last-child { + margin-bottom: 0 +} + +table.spread { + width: 100% +} + +table.tableblock, th.tableblock, td.tableblock { + border: 0 solid #dedede +} + +table.grid-all th.tableblock, table.grid-all td.tableblock { + border-width: 0 1px 1px 0 +} + +table.grid-all tfoot > tr > th.tableblock, table.grid-all tfoot > tr > td.tableblock { + border-width: 1px 1px 0 0 +} + +table.grid-cols th.tableblock, table.grid-cols td.tableblock { + border-width: 0 1px 0 0 +} + +table.grid-all * > tr > .tableblock:last-child, table.grid-cols * > tr > .tableblock:last-child { + border-right-width: 0 +} + +table.grid-rows th.tableblock, table.grid-rows td.tableblock { + border-width: 0 0 1px 0 +} + +table.grid-all tbody > tr:last-child > th.tableblock, table.grid-all tbody > tr:last-child > td.tableblock, table.grid-all thead:last-child > tr > th.tableblock, table.grid-rows tbody > tr:last-child > th.tableblock, table.grid-rows tbody > tr:last-child > td.tableblock, table.grid-rows thead:last-child > tr > th.tableblock { + border-bottom-width: 0 +} + +table.grid-rows tfoot > tr > th.tableblock, table.grid-rows tfoot > tr > td.tableblock { + border-width: 1px 0 0 0 +} + +table.frame-all { + border-width: 1px +} + +table.frame-sides { + border-width: 0 1px +} + +table.frame-topbot { + border-width: 1px 0 +} + +th.halign-left, td.halign-left { + text-align: left +} + +th.halign-right, td.halign-right { + text-align: right +} + +th.halign-center, td.halign-center { + text-align: center +} + +th.valign-top, td.valign-top { + vertical-align: top +} + +th.valign-bottom, td.valign-bottom { + vertical-align: bottom +} + +th.valign-middle, td.valign-middle { + vertical-align: middle +} + +table thead th, table tfoot th { + font-weight: bold +} + +tbody tr th { + display: table-cell; + line-height: 1.6; + background: #f7f8f7 +} + +tbody tr th, tbody tr th p, tfoot tr th, tfoot tr th p { + color: rgba(0, 0, 0, .8); + font-weight: bold +} + +p.tableblock > code:only-child { + background: none; + padding: 0 +} + +p.tableblock { + font-size: 1em +} + +td > div.verse { + white-space: pre +} + +ol { + margin-left: 1.75em +} + +ul li ol { + margin-left: 1.5em +} + +dl dd { + margin-left: 1.125em +} + +dl dd:last-child, dl dd:last-child > :last-child { + margin-bottom: 0 +} + +ol > li p, ul > li p, ul dd, ol dd, .olist .olist, .ulist .ulist, .ulist .olist, .olist .ulist { + margin-bottom: .625em +} + +ul.unstyled, ol.unnumbered, ul.checklist, ul.none { + list-style-type: none +} + +ul.unstyled, ol.unnumbered, ul.checklist { + margin-left: .625em +} + +ul.checklist li > p:first-child > .fa-check-square-o:first-child, ul.checklist li > p:first-child > input[type="checkbox"]:first-child { + margin-right: .25em +} + +ul.checklist li > p:first-child > input[type="checkbox"]:first-child { + position: relative; + top: 1px +} + +ul.inline { + margin: 0 auto .625em auto; + margin-left: -1.375em; + margin-right: 0; + padding: 0; + list-style: none; + overflow: hidden +} + +ul.inline > li { + list-style: none; + float: left; + margin-left: 1.375em; + display: block +} + +ul.inline > li > * { + display: block +} + +.unstyled dl dt { + font-weight: 400; + font-style: normal +} + +ol.arabic { + list-style-type: decimal +} + +ol.decimal { + list-style-type: decimal-leading-zero +} + +ol.loweralpha { + list-style-type: lower-alpha +} + +ol.upperalpha { + list-style-type: upper-alpha +} + +ol.lowerroman { + list-style-type: lower-roman +} + +ol.upperroman { + list-style-type: upper-roman +} + +ol.lowergreek { + list-style-type: lower-greek +} + +.hdlist > table, .colist > table { + border: 0; + background: none +} + +.hdlist > table > tbody > tr, .colist > table > tbody > tr { + background: none +} + +td.hdlist1 { + padding-right: .75em; + font-weight: bold +} + +td.hdlist1, td.hdlist2 { + vertical-align: top +} + +.literalblock + .colist, .listingblock + .colist { + margin-top: -.5em +} + +.colist > table tr > td:first-of-type { + padding: 0 .75em; + line-height: 1 +} + +.colist > table tr > td:last-of-type { + padding: .25em 0 +} + +.thumb, .th { + line-height: 0; + display: inline-block; + border: solid 4px #fff; + -webkit-box-shadow: 0 0 0 1px #ddd; + box-shadow: 0 0 0 1px #ddd +} + +.imageblock.left, .imageblock[style*="float: left"] { + margin: .25em .625em 1.25em 0 +} + +.imageblock.right, .imageblock[style*="float: right"] { + margin: .25em 0 1.25em .625em +} + +.imageblock > .title { + margin-bottom: 0 +} + +.imageblock.thumb, .imageblock.th { + border-width: 6px +} + +.imageblock.thumb > .title, .imageblock.th > .title { + padding: 0 .125em +} + +.image.left, .image.right { + margin-top: .25em; + margin-bottom: .25em; + display: inline-block; + line-height: 0 +} + +.image.left { + margin-right: .625em +} + +.image.right { + margin-left: .625em +} + +a.image { + text-decoration: none +} + +span.footnote, span.footnoteref { + vertical-align: super; + font-size: .875em +} + +span.footnote a, span.footnoteref a { + text-decoration: none +} + +span.footnote a:active, span.footnoteref a:active { + text-decoration: underline +} + +#footnotes { + padding-top: .75em; + padding-bottom: .75em; + margin-bottom: .625em +} + +#footnotes hr { + width: 20%; + min-width: 6.25em; + margin: -.25em 0 .75em 0; + border-width: 1px 0 0 0 +} + +#footnotes .footnote { + padding: 0 .375em; + line-height: 1.3; + font-size: .875em; + margin-left: 1.2em; + text-indent: -1.2em; + margin-bottom: .2em +} + +#footnotes .footnote a:first-of-type { + font-weight: bold; + text-decoration: none +} + +#footnotes .footnote:last-of-type { + margin-bottom: 0 +} + +#content #footnotes { + margin-top: -.625em; + margin-bottom: 0; + padding: .75em 0 +} + +.gist .file-data > table { + border: 0; + background: #fff; + width: 100%; + margin-bottom: 0 +} + +.gist .file-data > table td.line-data { + width: 99% +} + +div.unbreakable { + page-break-inside: avoid +} + +.big { + font-size: larger +} + +.small { + font-size: smaller +} + +.underline { + text-decoration: underline +} + +.overline { + text-decoration: overline +} + +.line-through { + text-decoration: line-through +} + +.aqua { + color: #00bfbf +} + +.aqua-background { + background-color: #00fafa +} + +.black { + color: #000 +} + +.black-background { + background-color: #000 +} + +.blue { + color: #0000bf +} + +.blue-background { + background-color: #0000fa +} + +.fuchsia { + color: #bf00bf +} + +.fuchsia-background { + background-color: #fa00fa +} + +.gray { + color: #606060 +} + +.gray-background { + background-color: #7d7d7d +} + +.green { + color: #006000 +} + +.green-background { + background-color: #007d00 +} + +.lime { + color: #00bf00 +} + +.lime-background { + background-color: #00fa00 +} + +.maroon { + color: #600000 +} + +.maroon-background { + background-color: #7d0000 +} + +.navy { + color: #000060 +} + +.navy-background { + background-color: #00007d +} + +.olive { + color: #606000 +} + +.olive-background { + background-color: #7d7d00 +} + +.purple { + color: #600060 +} + +.purple-background { + background-color: #7d007d +} + +.red { + color: #bf0000 +} + +.red-background { + background-color: #fa0000 +} + +.silver { + color: #909090 +} + +.silver-background { + background-color: #bcbcbc +} + +.teal { + color: #006060 +} + +.teal-background { + background-color: #007d7d +} + +.white { + color: #bfbfbf +} + +.white-background { + background-color: #fafafa +} + +.yellow { + color: #bfbf00 +} + +.yellow-background { + background-color: #fafa00 +} + +span.icon > .fa { + cursor: default +} + +.admonitionblock td.icon [class^="fa icon-"] { + font-size: 2.5em; + text-shadow: 1px 1px 2px rgba(0, 0, 0, .5); + cursor: default +} + +.admonitionblock td.icon .icon-note:before { + content: "\f05a"; + color: #19407c +} + +.admonitionblock td.icon .icon-tip:before { + content: "\f0eb"; + text-shadow: 1px 1px 2px rgba(155, 155, 0, .8); + color: #111 +} + +.admonitionblock td.icon .icon-warning:before { + content: "\f071"; + color: #bf6900 +} + +.admonitionblock td.icon .icon-caution:before { + content: "\f06d"; + color: #bf3400 +} + +.admonitionblock td.icon .icon-important:before { + content: "\f06a"; + color: #bf0000 +} + +.conum[data-value] { + display: inline-block; + color: #fff !important; + background-color: rgba(0, 0, 0, .8); + -webkit-border-radius: 100px; + border-radius: 100px; + text-align: center; + font-size: .75em; + width: 1.67em; + height: 1.67em; + line-height: 1.67em; + font-family: "Open Sans", "DejaVu Sans", sans-serif; + font-style: normal; + font-weight: bold +} + +.conum[data-value] * { + color: #fff !important +} + +.conum[data-value] + b { + display: none +} + +.conum[data-value]:after { + content: attr(data-value) +} + +pre .conum[data-value] { + position: relative; + top: -.125em +} + +b.conum * { + color: inherit !important +} + +.conum:not([data-value]):empty { + display: none +} + +h1, h2 { + letter-spacing: -.01em +} + +dt, th.tableblock, td.content { + text-rendering: optimizeLegibility +} + +p, td.content { + letter-spacing: -.01em +} + +p strong, td.content strong { + letter-spacing: -.005em +} + +p, blockquote, dt, td.content { + font-size: 1.0625rem +} + +p { + margin-bottom: 1.25rem +} + +.sidebarblock p, .sidebarblock dt, .sidebarblock td.content, p.tableblock { + font-size: 1em +} + +.exampleblock > .content { + background-color: #fffef7; + border-color: #e0e0dc; + -webkit-box-shadow: 0 1px 4px #e0e0dc; + box-shadow: 0 1px 4px #e0e0dc +} + +.print-only { + display: none !important +} + +@media print { + @page { + margin: 1.25cm .75cm + } + + * { + -webkit-box-shadow: none !important; + box-shadow: none !important; + text-shadow: none !important + } + + a { + color: inherit !important; + text-decoration: underline !important + } + + a.bare, a[href^="#"], a[href^="mailto:"] { + text-decoration: none !important + } + + a[href^="http:"]:not(.bare):after, a[href^="https:"]:not(.bare):after { + content: "(" attr(href) ")"; + display: inline-block; + font-size: .875em; + padding-left: .25em + } + + abbr[title]:after { + content: " (" attr(title) ")" + } + + pre, blockquote, tr, img { + page-break-inside: avoid + } + + thead { + display: table-header-group + } + + img { + max-width: 100% !important + } + + p, blockquote, dt, td.content { + font-size: 1em; + orphans: 3; + widows: 3 + } + + h2, h3, #toctitle, .sidebarblock > .content > .title { + page-break-after: avoid + } + + #toc, .sidebarblock, .exampleblock > .content { + background: none !important + } + + #toc { + border-bottom: 1px solid #ddddd8 !important; + padding-bottom: 0 !important + } + + .sect1 { + padding-bottom: 0 !important + } + + .sect1 + .sect1 { + border: 0 !important + } + + #header > h1:first-child { + margin-top: 1.25rem + } + + body.book #header { + text-align: center + } + + body.book #header > h1:first-child { + border: 0 !important; + margin: 2.5em 0 1em 0 + } + + body.book #header .details { + border: 0 !important; + display: block; + padding: 0 !important + } + + body.book #header .details span:first-child { + margin-left: 0 !important + } + + body.book #header .details br { + display: block + } + + body.book #header .details br + span:before { + content: none !important + } + + body.book #toc { + border: 0 !important; + text-align: left !important; + padding: 0 !important; + margin: 0 !important + } + + body.book #toc, body.book #preamble, body.book h1.sect0, body.book .sect1 > h2 { + page-break-before: always + } + + .listingblock code[data-lang]:before { + display: block + } + + #footer { + background: none !important; + padding: 0 .9375em + } + + #footer-text { + color: rgba(0, 0, 0, .6) !important; + font-size: .9em + } + + .hide-on-print { + display: none !important + } + + .print-only { + display: block !important + } + + .hide-for-print { + display: none !important + } + + .show-for-print { + display: inherit !important + } +} diff --git a/benchmarks/README.adoc b/benchmarks/README.adoc index d515d8164..95a7c9c02 100644 --- a/benchmarks/README.adoc +++ b/benchmarks/README.adoc @@ -35,4 +35,4 @@ For now we're testing the performance impact of the following: - our custom Trace HTTP filter - instrumentation of controllers - `@Callable` returning and the sync one - instrumentation of RestTemplate -- `@Async` annotated methods \ No newline at end of file +- `@Async` annotated methods diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 5284f550c..312d448e0 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -14,8 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - 4.0.0 @@ -249,7 +249,8 @@ org.openjdk.jmh.Main - false + false + @@ -281,7 +282,9 @@ start - "-Dserver.port=9875" "-Dspring.sleuth.enabled=false" + "-Dserver.port=9875" + "-Dspring.sleuth.enabled=false" + 8875 true @@ -344,7 +347,8 @@ false true - true + true + true @@ -424,7 +428,9 @@ jmeter-analysis-maven-plugin 1.0.6 - ${project.build.directory}/jmeter/results/analysis/ + + ${project.build.directory}/jmeter/results/analysis/ + @@ -434,7 +440,9 @@ analyze - ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks.jtl + + ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks.jtl + @@ -444,7 +452,9 @@ analyze - ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks.jtl + + ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks.jtl + @@ -454,7 +464,9 @@ analyze - ${project.build.directory}/jmeter/results/SyncHttpBenchmarks.jtl + + ${project.build.directory}/jmeter/results/SyncHttpBenchmarks.jtl + @@ -464,7 +476,9 @@ analyze - ${project.build.directory}/jmeter/results/*.jtl + + ${project.build.directory}/jmeter/results/*.jtl + @@ -481,25 +495,34 @@ verify - ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks.jtl + + ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks.jtl + ResponseTimesOverTime 800 600 - ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-ResponseTimesOverTime.png + + ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-ResponseTimesOverTime.png + - ResponseTimesPercentiles + ResponseTimesPercentiles + 800 600 - ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-ResponseTimesPercentiles.png + + ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-ResponseTimesPercentiles.png + LatenciesOverTime 800 600 - ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-LatenciesOverTime.png + + ${project.build.directory}/jmeter/results/AsyncHttpBenchmarks-LatenciesOverTime.png + @@ -511,25 +534,34 @@ verify - ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks.jtl + + ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks.jtl + ResponseTimesOverTime 800 600 - ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-ResponseTimesOverTime.png + + ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-ResponseTimesOverTime.png + - ResponseTimesPercentiles + ResponseTimesPercentiles + 800 600 - ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-ResponseTimesPercentiles.png + + ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-ResponseTimesPercentiles.png + LatenciesOverTime 800 600 - ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-LatenciesOverTime.png + + ${project.build.directory}/jmeter/results/AsyncMethodBenchmarks-LatenciesOverTime.png + @@ -541,25 +573,34 @@ verify - ${project.build.directory}/jmeter/results/SyncHttpBenchmarks.jtl + + ${project.build.directory}/jmeter/results/SyncHttpBenchmarks.jtl + ResponseTimesOverTime 800 600 - ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-ResponseTimesOverTime.png + + ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-ResponseTimesOverTime.png + - ResponseTimesPercentiles + ResponseTimesPercentiles + 800 600 - ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-ResponseTimesPercentiles.png + + ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-ResponseTimesPercentiles.png + LatenciesOverTime 800 600 - ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-LatenciesOverTime.png + + ${project.build.directory}/jmeter/results/SyncHttpBenchmarks-LatenciesOverTime.png + diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/mvc/SleuthBenchmarkingSpringApp.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/mvc/SleuthBenchmarkingSpringApp.java index b14491b47..403f1eede 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/mvc/SleuthBenchmarkingSpringApp.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/mvc/SleuthBenchmarkingSpringApp.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.regex.Pattern; + import javax.annotation.PreDestroy; import brave.Span; @@ -29,6 +30,7 @@ import brave.Tracer; import brave.sampler.Sampler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -54,8 +56,8 @@ import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController @EnableAsync -public class SleuthBenchmarkingSpringApp implements - ApplicationListener { +public class SleuthBenchmarkingSpringApp + implements ApplicationListener { private static final Log log = LogFactory.getLog(SleuthBenchmarkingSpringApp.class); @@ -63,8 +65,15 @@ public class SleuthBenchmarkingSpringApp implements public int port; - @Autowired(required = false) Tracer tracer; - @Autowired AClass aClass; + @Autowired(required = false) + Tracer tracer; + + @Autowired + AClass aClass; + + public static void main(String... args) { + SpringApplication.run(SleuthBenchmarkingSpringApp.class, args); + } @RequestMapping("/foo") public String foo() { @@ -100,9 +109,11 @@ public class SleuthBenchmarkingSpringApp implements } @Bean - public ServletWebServerFactory servletContainer(@Value("${server.port:0}") int serverPort) { + public ServletWebServerFactory servletContainer( + @Value("${server.port:0}") int serverPort) { log.info("Starting container at port [" + serverPort + "]"); - return new TomcatServletWebServerFactory(serverPort == 0 ? SocketUtils.findAvailableTcpPort() : serverPort); + return new TomcatServletWebServerFactory( + serverPort == 0 ? SocketUtils.findAvailableTcpPort() : serverPort); } @PreDestroy @@ -110,21 +121,26 @@ public class SleuthBenchmarkingSpringApp implements this.pool.shutdownNow(); } - @Bean Sampler alwaysSampler() { + @Bean + Sampler alwaysSampler() { return Sampler.ALWAYS_SAMPLE; } - @Bean AnotherClass anotherClass() { + @Bean + AnotherClass anotherClass() { return new AnotherClass(this.tracer); } - @Bean AClass aClass() { + @Bean + AClass aClass() { return new AClass(this.tracer, anotherClass()); } - @Bean SkipPatternProvider patternProvider() { + @Bean + SkipPatternProvider patternProvider() { return new SkipPatternProvider() { - @Override public Pattern skipPattern() { + @Override + public Pattern skipPattern() { return Pattern.compile(""); } }; @@ -134,12 +150,12 @@ public class SleuthBenchmarkingSpringApp implements return this.pool; } - public static void main(String... args) { - SpringApplication.run(SleuthBenchmarkingSpringApp.class, args); - } } + class AClass { + private final Tracer tracer; + private final AnotherClass anotherClass; AClass(Tracer tracer, AnotherClass anotherClass) { @@ -151,7 +167,8 @@ class AClass { Span manual = this.tracer.nextSpan().name("span-name"); try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(manual.start())) { return this.anotherClass.continuedSpan(); - } finally { + } + finally { manual.finish(); } } @@ -160,9 +177,11 @@ class AClass { public String newSpan() { return this.anotherClass.continuedAnnotation("bar"); } + } class AnotherClass { + private final Tracer tracer; AnotherClass(Tracer tracer) { @@ -182,4 +201,5 @@ class AnotherClass { span.annotate("continuedspan.after"); return response; } + } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/webflux/SleuthBenchmarkingSpringWebFluxApp.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/webflux/SleuthBenchmarkingSpringWebFluxApp.java index a9b3e58f1..42af449aa 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/webflux/SleuthBenchmarkingSpringWebFluxApp.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/app/webflux/SleuthBenchmarkingSpringWebFluxApp.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,17 @@ * limitations under the License. */ - package org.springframework.cloud.sleuth.benchmarks.app.webflux; -import brave.Tracer; +import java.util.regex.Pattern; + import brave.sampler.Sampler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; +import reactor.core.publisher.Mono; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -34,24 +37,25 @@ import org.springframework.context.annotation.Bean; import org.springframework.util.SocketUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Mono; -import zipkin2.Span; -import zipkin2.reporter.Reporter; - -import java.util.regex.Pattern; - /** * @author alvin */ @SpringBootApplication @RestController -public class SleuthBenchmarkingSpringWebFluxApp implements ApplicationListener { +public class SleuthBenchmarkingSpringWebFluxApp + implements ApplicationListener { - private static final Log log = LogFactory.getLog(SleuthBenchmarkingSpringWebFluxApp.class); + private static final Log log = LogFactory + .getLog(SleuthBenchmarkingSpringWebFluxApp.class); public int port; + public static void main(String... args) { + new SpringApplicationBuilder(SleuthBenchmarkingSpringWebFluxApp.class) + .web(WebApplicationType.REACTIVE).application().run(args); + } + @RequestMapping("/foo") public Mono foo() { return Mono.just("foo"); @@ -67,18 +71,12 @@ public class SleuthBenchmarkingSpringWebFluxApp implements ApplicationListener Pattern.compile(""); } - @Bean - NettyReactiveWebServerFactory nettyReactiveWebServerFactory(@Value("${server.port:0}") int serverPort) { + NettyReactiveWebServerFactory nettyReactiveWebServerFactory( + @Value("${server.port:0}") int serverPort) { log.info("Starting container at port [" + serverPort + "]"); - return new NettyReactiveWebServerFactory(serverPort == 0 ? SocketUtils.findAvailableTcpPort() : serverPort); - } - - public static void main(String... args) { - new SpringApplicationBuilder(SleuthBenchmarkingSpringWebFluxApp.class) - .web(WebApplicationType.REACTIVE) - .application() - .run(args); + return new NettyReactiveWebServerFactory( + serverPort == 0 ? SocketUtils.findAvailableTcpPort() : serverPort); } @Bean @@ -86,11 +84,9 @@ public class SleuthBenchmarkingSpringWebFluxApp implements ApplicationListener vanilla() { return () -> "vanilla"; } + } + } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/ProcessLauncherState.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/ProcessLauncherState.java index 1250cded9..91ebb2077 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/ProcessLauncherState.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/ProcessLauncherState.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; import java.io.BufferedReader; @@ -35,10 +36,15 @@ import org.springframework.cloud.sleuth.benchmarks.app.mvc.SleuthBenchmarkingSpr public class ProcessLauncherState { private Process started; + private List args; + private List extraArgs; + private File home; + private String mainClass = SleuthBenchmarkingSpringApp.class.getName(); + private int length; public ProcessLauncherState(String dir, String... args) { @@ -58,6 +64,21 @@ public class ProcessLauncherState { this.home = new File(dir); } + protected static String output(InputStream inputStream, String marker) + throws IOException { + StringBuilder sb = new StringBuilder(); + BufferedReader br = null; + br = new BufferedReader(new InputStreamReader(inputStream)); + String line = null; + while ((line = br.readLine()) != null && !line.contains(marker)) { + sb.append(line + System.getProperty("line.separator")); + } + if (line != null) { + sb.append(line + System.getProperty("line.separator")); + } + return sb.toString(); + } + public void setMainClass(String mainClass) { this.mainClass = mainClass; } @@ -101,7 +122,7 @@ public class ProcessLauncherState { public void run() throws Exception { List args = new ArrayList<>(this.args); args.add(args.size() - this.length, this.mainClass); - if (extraArgs!=null) { + if (extraArgs != null) { args.addAll(extraArgs); } ProcessBuilder builder = new ProcessBuilder(args); @@ -122,22 +143,8 @@ public class ProcessLauncherState { System.out.println(output(started.getInputStream(), "Started")); } - protected static String output(InputStream inputStream, String marker) - throws IOException { - StringBuilder sb = new StringBuilder(); - BufferedReader br = null; - br = new BufferedReader(new InputStreamReader(inputStream)); - String line = null; - while ((line = br.readLine()) != null && !line.contains(marker)) { - sb.append(line + System.getProperty("line.separator")); - } - if (line != null) { - sb.append(line + System.getProperty("line.separator")); - } - return sb.toString(); - } - public File getHome() { return home; } + } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/RestTemplateBenchmark.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/RestTemplateBenchmark.java index 836341c4c..d4319adca 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/RestTemplateBenchmark.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/RestTemplateBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; import java.io.IOException; import java.util.Collections; import java.util.concurrent.TimeUnit; + import javax.servlet.ServletException; import brave.spring.web.TracingClientHttpRequestInterceptor; @@ -33,6 +35,7 @@ import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; + import org.springframework.boot.SpringApplication; import org.springframework.cloud.sleuth.benchmarks.app.mvc.SleuthBenchmarkingSpringApp; import org.springframework.context.ConfigurableApplicationContext; @@ -44,8 +47,7 @@ import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.BDDAssertions.then; /** - * We're checking how much overhead does the instrumentation - * of the RestTemplate take + * We're checking how much overhead does the instrumentation of the RestTemplate take */ @Measurement(iterations = 5) @Warmup(iterations = 10) @@ -55,20 +57,37 @@ import static org.assertj.core.api.BDDAssertions.then; @Threads(Threads.MAX) public class RestTemplateBenchmark { + @Benchmark + public void syncEndpointWithoutSleuth(BenchmarkContext context) + throws IOException, ServletException { + then(context.untracedTemplate.getForObject("/foo", String.class)) + .isEqualTo("foo"); + } + + @Benchmark + public void syncEndpointWithSleuth(BenchmarkContext context) + throws ServletException, IOException { + then(context.tracedTemplate.getForObject("/foo", String.class)).isEqualTo("foo"); + } + @State(Scope.Benchmark) public static class BenchmarkContext { + volatile ConfigurableApplicationContext withSleuth; + volatile MockMvc mockMvc; + volatile RestTemplate tracedTemplate; + volatile RestTemplate untracedTemplate; - @Setup public void setup() { - new SpringApplication( - SleuthBenchmarkingSpringApp.class) - .run("--spring.jmx.enabled=false", - "--spring.application.name=withSleuth"); - this.mockMvc = MockMvcBuilders.standaloneSetup( - this.withSleuth.getBean(SleuthBenchmarkingSpringApp.class)) + @Setup + public void setup() { + new SpringApplication(SleuthBenchmarkingSpringApp.class).run( + "--spring.jmx.enabled=false", "--spring.application.name=withSleuth"); + this.mockMvc = MockMvcBuilders + .standaloneSetup( + this.withSleuth.getBean(SleuthBenchmarkingSpringApp.class)) .build(); this.tracedTemplate = new RestTemplate( new MockMvcClientHttpRequestFactory(this.mockMvc)); @@ -78,22 +97,12 @@ public class RestTemplateBenchmark { new MockMvcClientHttpRequestFactory(this.mockMvc)); } - @TearDown public void clean() { + @TearDown + public void clean() { this.withSleuth.getBean(SleuthBenchmarkingSpringApp.class).clean(); this.withSleuth.close(); } - } - @Benchmark - public void syncEndpointWithoutSleuth(BenchmarkContext context) - throws IOException, ServletException { - then(context.untracedTemplate.getForObject("/foo", String.class)).isEqualTo("foo"); - } - - @Benchmark - public void syncEndpointWithSleuth(BenchmarkContext context) - throws ServletException, IOException { - then(context.tracedTemplate.getForObject("/foo", String.class)).isEqualTo("foo"); } } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/SpringWebFluxBenchmarks.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/SpringWebFluxBenchmarks.java index 77aa164ee..27427eb65 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/SpringWebFluxBenchmarks.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/SpringWebFluxBenchmarks.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,8 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + import brave.Tracing; import brave.http.HttpTracing; import brave.httpclient.TracingHttpClientBuilder; @@ -41,15 +45,13 @@ import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; +import zipkin2.reporter.Reporter; + import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.sleuth.benchmarks.app.webflux.SleuthBenchmarkingSpringWebFluxApp; import org.springframework.context.ConfigurableApplicationContext; -import zipkin2.reporter.Reporter; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; @Measurement(iterations = 5, time = 1) @Warmup(iterations = 10, time = 1) @@ -60,31 +62,34 @@ import java.util.concurrent.TimeUnit; @State(Scope.Benchmark) public class SpringWebFluxBenchmarks { + protected static TraceContext defaultTraceContext = TraceContext.newBuilder() + .traceIdHigh(333L).traceId(444L).spanId(3).sampled(true).build(); protected ConfigurableApplicationContext applicationContext; protected SleuthBenchmarkingSpringWebFluxApp springWebFluxApp; CloseableHttpClient client; CloseableHttpClient tracedClient; CloseableHttpClient unsampledClient; + private String baseUrl; - protected static TraceContext defaultTraceContext = - TraceContext.newBuilder().traceIdHigh(333L).traceId(444L).spanId(3).sampled(true).build(); + public static void main(String[] args) throws RunnerException { + Options opt = new OptionsBuilder() + .include(".*" + SpringWebFluxBenchmarks.class.getSimpleName() + ".*") + .build(); + + new Runner(opt).run(); + } public String getBaseUrl() { return baseUrl; } - private String baseUrl; - protected CloseableHttpClient newClient(HttpTracing httpTracing) { - return TracingHttpClientBuilder.create(httpTracing) - .disableAutomaticRetries() + return TracingHttpClientBuilder.create(httpTracing).disableAutomaticRetries() .build(); } protected CloseableHttpClient newClient() { - return HttpClients.custom() - .disableAutomaticRetries() - .build(); + return HttpClients.custom().disableAutomaticRetries().build(); } protected void get(CloseableHttpClient client) throws Exception { @@ -95,31 +100,27 @@ public class SpringWebFluxBenchmarks { client.close(); } - @Setup public void setup() { ConfigurableApplicationContext context = initContext(); this.applicationContext = context; - this.springWebFluxApp = this.applicationContext.getBean( - SleuthBenchmarkingSpringWebFluxApp.class); + this.springWebFluxApp = this.applicationContext + .getBean(SleuthBenchmarkingSpringWebFluxApp.class); baseUrl = "http://127.0.0.1:" + springWebFluxApp.port + "/foo"; client = newClient(); - tracedClient = newClient(HttpTracing.create( - Tracing.newBuilder().spanReporter(Reporter.NOOP).build() - )); - unsampledClient = newClient(HttpTracing.create( - Tracing.newBuilder().sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build() - )); + tracedClient = newClient(HttpTracing + .create(Tracing.newBuilder().spanReporter(Reporter.NOOP).build())); + unsampledClient = newClient(HttpTracing.create(Tracing.newBuilder() + .sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build())); postSetUp(); } protected ConfigurableApplicationContext initContext() { - SpringApplication application = new SpringApplicationBuilder(SleuthBenchmarkingSpringWebFluxApp.class) - .web(WebApplicationType.REACTIVE) - .application(); + SpringApplication application = new SpringApplicationBuilder( + SleuthBenchmarkingSpringWebFluxApp.class).web(WebApplicationType.REACTIVE) + .application(); customSpringApplication(application); - return application - .run(runArgs()); + return application.run(runArgs()); } protected void customSpringApplication(SpringApplication springApplication) { @@ -129,14 +130,12 @@ public class SpringWebFluxBenchmarks { protected void postSetUp() { } - protected String[] runArgs() { - return new String[]{"--spring.jmx.enabled=false", + return new String[] { "--spring.jmx.enabled=false", "--spring.application.name=defaultTraceContext", - "--spring.sleuth.enabled=true"}; + "--spring.sleuth.enabled=true" }; } - @TearDown public void clean() throws Exception { close(client); @@ -146,7 +145,8 @@ public class SpringWebFluxBenchmarks { try { this.applicationContext.close(); - } catch (Exception ig) { + } + catch (Exception ig) { } } @@ -168,18 +168,10 @@ public class SpringWebFluxBenchmarks { @Benchmark public void tracedClient_get_resumeTrace() throws Exception { - try (CurrentTraceContext.Scope scope = Tracing.current().currentTraceContext().newScope(defaultTraceContext)) { + try (CurrentTraceContext.Scope scope = Tracing.current().currentTraceContext() + .newScope(defaultTraceContext)) { get(tracedClient); } } - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(".*" + SpringWebFluxBenchmarks.class.getSimpleName() + ".*") - .build(); - - new Runner(opt).run(); - } - - } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/StartupBenchmark.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/StartupBenchmark.java index 7ce48a16c..8c3c93831 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/StartupBenchmark.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/StartupBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; import org.openjdk.jmh.annotations.Benchmark; @@ -42,27 +43,34 @@ public class StartupBenchmark { state.setExtraArgs("--spring.sleuth.annotation.enabled=false"); state.run(); } - + @Benchmark public void withoutAsync(ApplicationState state) throws Exception { - state.setExtraArgs("--spring.sleuth.async.enabled=false", "--spring.sleuth.annotation.enabled=false"); + state.setExtraArgs("--spring.sleuth.async.enabled=false", + "--spring.sleuth.annotation.enabled=false"); state.run(); } @Benchmark public void withoutScheduled(ApplicationState state) throws Exception { - state.setExtraArgs("--spring.sleuth.scheduled.enabled=false", "--spring.sleuth.async.enabled=false", "--spring.sleuth.annotation.enabled=false"); + state.setExtraArgs("--spring.sleuth.scheduled.enabled=false", + "--spring.sleuth.async.enabled=false", + "--spring.sleuth.annotation.enabled=false"); state.run(); } @Benchmark public void withoutWeb(ApplicationState state) throws Exception { - state.setExtraArgs("--spring.sleuth.web.enabled=false", "--spring.sleuth.scheduled.enabled=false", "--spring.sleuth.async.enabled=false", "--spring.sleuth.annotation.enabled=false"); + state.setExtraArgs("--spring.sleuth.web.enabled=false", + "--spring.sleuth.scheduled.enabled=false", + "--spring.sleuth.async.enabled=false", + "--spring.sleuth.annotation.enabled=false"); state.run(); } @State(Scope.Benchmark) public static class ApplicationState extends ProcessLauncherState { + public ApplicationState() { super("target", "--server.port=0"); } @@ -71,6 +79,7 @@ public class StartupBenchmark { public void stop() throws Exception { super.after(); } + } } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutReactorSleuthSpringWebFluxBenchmarks.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutReactorSleuthSpringWebFluxBenchmarks.java index 01a082d29..c43b7d8b2 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutReactorSleuthSpringWebFluxBenchmarks.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutReactorSleuthSpringWebFluxBenchmarks.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; import org.openjdk.jmh.runner.Runner; @@ -25,12 +26,20 @@ import org.openjdk.jmh.runner.options.OptionsBuilder; */ public class WithOutReactorSleuthSpringWebFluxBenchmarks extends SpringWebFluxBenchmarks { + public static void main(String[] args) throws RunnerException { + Options opt = new OptionsBuilder().include( + ".*" + WithOutReactorSleuthSpringWebFluxBenchmarks.class.getSimpleName() + + ".*") + .build(); + + new Runner(opt).run(); + } + @Override protected String[] runArgs() { - return new String[]{"--spring.jmx.enabled=false", + return new String[] { "--spring.jmx.enabled=false", "--spring.application.name=defaultTraceContext", - "--spring.sleuth.enabled=true", - "--spring.sleuth.reactor.enabled=false" + "--spring.sleuth.enabled=true", "--spring.sleuth.reactor.enabled=false" }; } @@ -40,11 +49,4 @@ public class WithOutReactorSleuthSpringWebFluxBenchmarks extends SpringWebFluxBe super.postSetUp(); } - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(".*" + WithOutReactorSleuthSpringWebFluxBenchmarks.class.getSimpleName() + ".*") - .build(); - - new Runner(opt).run(); - } } diff --git a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutSleuthSpringWebFluxBenchmarks.java b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutSleuthSpringWebFluxBenchmarks.java index f0d53f2c9..1c0d24b2c 100644 --- a/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutSleuthSpringWebFluxBenchmarks.java +++ b/benchmarks/src/main/java/org/springframework/cloud/sleuth/benchmarks/jmh/benchmarks/WithOutSleuthSpringWebFluxBenchmarks.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.benchmarks.jmh.benchmarks; import org.openjdk.jmh.runner.Runner; @@ -25,11 +26,19 @@ import org.openjdk.jmh.runner.options.OptionsBuilder; */ public class WithOutSleuthSpringWebFluxBenchmarks extends SpringWebFluxBenchmarks { + public static void main(String[] args) throws RunnerException { + Options opt = new OptionsBuilder().include( + ".*" + WithOutSleuthSpringWebFluxBenchmarks.class.getSimpleName() + ".*") + .build(); + + new Runner(opt).run(); + } + @Override protected String[] runArgs() { - return new String[]{"--spring.jmx.enabled=false", + return new String[] { "--spring.jmx.enabled=false", "--spring.application.name=defaultTraceContext", - "--spring.sleuth.enabled=false"}; + "--spring.sleuth.enabled=false" }; } @Override @@ -37,11 +46,4 @@ public class WithOutSleuthSpringWebFluxBenchmarks extends SpringWebFluxBenchmark super.postSetUp(); } - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(".*" + WithOutSleuthSpringWebFluxBenchmarks.class.getSimpleName() + ".*") - .build(); - - new Runner(opt).run(); - } } diff --git a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/RunSleuthJmhBenchmarksFromIde.java b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/RunSleuthJmhBenchmarksFromIde.java index 9abfb7af7..13562a76b 100644 --- a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/RunSleuthJmhBenchmarksFromIde.java +++ b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/RunSleuthJmhBenchmarksFromIde.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,11 @@ public class RunSleuthJmhBenchmarksFromIde { // Convenience main entry-point for testing from IDE public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() - .include(RunSleuthJmhBenchmarksFromIde.class.getPackage().getName() + ".benchmarks.*") + .include(RunSleuthJmhBenchmarksFromIde.class.getPackage().getName() + + ".benchmarks.*") .build(); new Runner(opt).run(); } -} \ No newline at end of file + +} diff --git a/benchmarks/src/test/jmeter/jmeter.properties b/benchmarks/src/test/jmeter/jmeter.properties index 70a8f7fc7..f6c8a0feb 100644 --- a/benchmarks/src/test/jmeter/jmeter.properties +++ b/benchmarks/src/test/jmeter/jmeter.properties @@ -13,5 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # - sampleresult.useNanoTime=true diff --git a/docs/pom.xml b/docs/pom.xml index e811a83f5..b6fe391f2 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -15,8 +15,9 @@ ~ limitations under the License. --> - + 4.0.0 org.springframework.cloud @@ -30,7 +31,8 @@ spring-cloud-sleuth - 1.0.x,1.1.x,1.2.x,1.3.x,2.0.x + 1.0.x,1.1.x,1.2.x,1.3.x,2.0.x + ${basedir}/.. diff --git a/docs/src/main/asciidoc/ghpages.sh b/docs/src/main/asciidoc/ghpages.sh index 57c5da3a3..4ff53f18e 100755 --- a/docs/src/main/asciidoc/ghpages.sh +++ b/docs/src/main/asciidoc/ghpages.sh @@ -327,4 +327,4 @@ build_docs_if_applicable retrieve_doc_properties stash_changes add_docs_from_target -checkout_previous_branch \ No newline at end of file +checkout_previous_branch diff --git a/docs/src/main/asciidoc/images/.gitkeep b/docs/src/main/asciidoc/images/.gitkeep index e69de29bb..8b1378917 100644 --- a/docs/src/main/asciidoc/images/.gitkeep +++ b/docs/src/main/asciidoc/images/.gitkeep @@ -0,0 +1 @@ + diff --git a/docs/src/main/asciidoc/images/dependencies.png b/docs/src/main/asciidoc/images/dependencies.png index 324a10062..33c4e7c48 100644 Binary files a/docs/src/main/asciidoc/images/dependencies.png and b/docs/src/main/asciidoc/images/dependencies.png differ diff --git a/docs/src/main/asciidoc/images/kibana.png b/docs/src/main/asciidoc/images/kibana.png index bc44a43f9..571e7afe8 100644 Binary files a/docs/src/main/asciidoc/images/kibana.png and b/docs/src/main/asciidoc/images/kibana.png differ diff --git a/docs/src/main/asciidoc/images/parents.png b/docs/src/main/asciidoc/images/parents.png index 7f868f75a..337b70c49 100644 Binary files a/docs/src/main/asciidoc/images/parents.png and b/docs/src/main/asciidoc/images/parents.png differ diff --git a/docs/src/main/asciidoc/images/pws.png b/docs/src/main/asciidoc/images/pws.png index a791bd742..e586a00d2 100644 Binary files a/docs/src/main/asciidoc/images/pws.png and b/docs/src/main/asciidoc/images/pws.png differ diff --git a/docs/src/main/asciidoc/images/trace-id.png b/docs/src/main/asciidoc/images/trace-id.png index 8d72b2cd8..5e54aea24 100644 Binary files a/docs/src/main/asciidoc/images/trace-id.png and b/docs/src/main/asciidoc/images/trace-id.png differ diff --git a/docs/src/main/asciidoc/images/zipkin-error-trace-screenshot.png b/docs/src/main/asciidoc/images/zipkin-error-trace-screenshot.png index 02a7270eb..93bc75b04 100644 Binary files a/docs/src/main/asciidoc/images/zipkin-error-trace-screenshot.png and b/docs/src/main/asciidoc/images/zipkin-error-trace-screenshot.png differ diff --git a/docs/src/main/asciidoc/images/zipkin-error-traces.png b/docs/src/main/asciidoc/images/zipkin-error-traces.png index 233b0cbf3..8d9a00659 100644 Binary files a/docs/src/main/asciidoc/images/zipkin-error-traces.png and b/docs/src/main/asciidoc/images/zipkin-error-traces.png differ diff --git a/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png b/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png index b230a19a3..5e8770abe 100644 Binary files a/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png and b/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png differ diff --git a/docs/src/main/asciidoc/images/zipkin-traces.png b/docs/src/main/asciidoc/images/zipkin-traces.png index 421bddec8..9af0f64d2 100644 Binary files a/docs/src/main/asciidoc/images/zipkin-traces.png and b/docs/src/main/asciidoc/images/zipkin-traces.png differ diff --git a/docs/src/main/asciidoc/images/zipkin-ui.png b/docs/src/main/asciidoc/images/zipkin-ui.png index 6bfe38e67..89a60872e 100644 Binary files a/docs/src/main/asciidoc/images/zipkin-ui.png and b/docs/src/main/asciidoc/images/zipkin-ui.png differ diff --git a/pom.xml b/pom.xml index f1171f849..2590a83be 100644 --- a/pom.xml +++ b/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 @@ -36,8 +36,11 @@ https://github.com/spring-cloud/spring-cloud-sleuth - scm:git:git://github.com/spring-cloud/spring-cloud-sleuth.git - scm:git:ssh://git@github.com/spring-cloud/spring-cloud-sleuth.git + scm:git:git://github.com/spring-cloud/spring-cloud-sleuth.git + + + scm:git:ssh://git@github.com/spring-cloud/spring-cloud-sleuth.git + HEAD @@ -111,14 +114,14 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - io.spring.javaformat spring-javaformat-maven-plugin + + org.apache.maven.plugins + maven-checkstyle-plugin + @@ -210,7 +213,7 @@ org.objenesis objenesis 2.1 - + commons-logging @@ -254,9 +257,17 @@ 2.1.1.BUILD-SNAPSHOT Fishtown.BUILD-SNAPSHOT 2.1.1.BUILD-SNAPSHOT - 2.1.1.BUILD-SNAPSHOT + 2.1.1.BUILD-SNAPSHOT + 5.6.1 - 2.1.2.RELEASE + 2.1.2.RELEASE + + + true + true + + true + @@ -376,7 +387,8 @@ surefireArgLine - ${project.build.directory}/jacoco.exec + ${project.build.directory}/jacoco.exec + @@ -387,7 +399,8 @@ - ${project.build.directory}/jacoco.exec + ${project.build.directory}/jacoco.exec + diff --git a/scripts/runJmeterBenchmarks.sh b/scripts/runJmeterBenchmarks.sh index 45de29c8a..ffea067f1 100755 --- a/scripts/runJmeterBenchmarks.sh +++ b/scripts/runJmeterBenchmarks.sh @@ -6,4 +6,4 @@ pkill -f SleuthBenchmarkingSpringApp || echo "No apps to kill" echo "Running JMeter Benchmarks" ./mvnw clean verify --projects benchmarks --also-make -Pbenchmarks,jmeter echo "Killing the remaining apps - if something went wrong after the tests" -pkill -f SleuthBenchmarkingSpringApp || echo "No apps to kill" \ No newline at end of file +pkill -f SleuthBenchmarkingSpringApp || echo "No apps to kill" diff --git a/scripts/runJmhBenchmarks.sh b/scripts/runJmhBenchmarks.sh index c9aa73f88..25f47d856 100755 --- a/scripts/runJmhBenchmarks.sh +++ b/scripts/runJmhBenchmarks.sh @@ -2,4 +2,4 @@ echo "Running JMH Benchmarks" ./mvnw clean install -DskipTests --projects benchmarks --also-make -Pbenchmarks,jmh -java -Djmh.ignoreLock=true -jar benchmarks/target/benchmarks.jar org.springframework.cloud.sleuth.benchmarks.jmh.* -rf csv -rff jmh-result.csv | tee target/benchmarks.log \ No newline at end of file +java -Djmh.ignoreLock=true -jar benchmarks/target/benchmarks.jar org.springframework.cloud.sleuth.benchmarks.jmh.* -rf csv -rff jmh-result.csv | tee target/benchmarks.log diff --git a/spring-cloud-sleuth-core/pom.xml b/spring-cloud-sleuth-core/pom.xml index 5e16f9256..c5d09ccc4 100644 --- a/spring-cloud-sleuth-core/pom.xml +++ b/spring-cloud-sleuth-core/pom.xml @@ -15,8 +15,9 @@ ~ limitations under the License. --> - + 4.0.0 spring-cloud-sleuth-core @@ -334,10 +335,10 @@ - com.google.guava - guava - 20.0 - test + com.google.guava + guava + 20.0 + test diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/DefaultSpanNamer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/DefaultSpanNamer.java index 1bbfc9ddb..b1453c83c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/DefaultSpanNamer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/DefaultSpanNamer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,14 @@ import org.springframework.core.annotation.AnnotationUtils; */ public class DefaultSpanNamer implements SpanNamer { + private static boolean isDefaultToString(Object delegate, String spanName) { + if (delegate instanceof Method) { + return delegate.toString().equals(spanName); + } + return (delegate.getClass().getName() + "@" + + Integer.toHexString(delegate.hashCode())).equals(spanName); + } + @Override public String name(Object object, String defaultValue) { SpanName annotation = annotation(object); @@ -63,12 +71,4 @@ public class DefaultSpanNamer implements SpanNamer { return AnnotationUtils.findAnnotation(o.getClass(), SpanName.class); } - private static boolean isDefaultToString(Object delegate, String spanName) { - if (delegate instanceof Method) { - return delegate.toString().equals(spanName); - } - return (delegate.getClass().getName() + "@" - + Integer.toHexString(delegate.hashCode())).equals(spanName); - } - } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanAdjuster.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanAdjuster.java index c2ec54db6..1fda40480 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanAdjuster.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanAdjuster.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanName.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanName.java index c45a1d983..3ea5c0e77 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanName.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanName.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanNamer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanNamer.java index 1a5bd93e4..8f355ef4e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanNamer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/SpanNamer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/AbstractSleuthMethodInvocationProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/AbstractSleuthMethodInvocationProcessor.java index a6ca43ac1..d6ffefad5 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/AbstractSleuthMethodInvocationProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/AbstractSleuthMethodInvocationProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +21,13 @@ import brave.Tracer; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; /** - * Sleuth annotation processor + * Sleuth annotation processor. * * @author Marcin Grzejszczak */ diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ContinueSpan.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ContinueSpan.java index 5652d3bdc..4bd057b08 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ContinueSpan.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ContinueSpan.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import java.lang.annotation.Target; */ @Retention(RetentionPolicy.RUNTIME) @Inherited -@Target(value = { ElementType.METHOD }) +@Target(ElementType.METHOD) public @interface ContinueSpan { /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/DefaultSpanCreator.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/DefaultSpanCreator.java index 090948144..6daedefa1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/DefaultSpanCreator.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/DefaultSpanCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.annotation; import brave.SpanCustomizer; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.cloud.sleuth.util.SpanNameUtil; import org.springframework.util.StringUtils; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpan.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpan.java index c19cecb4c..1d62d8341 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpan.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpan.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.annotation; import java.lang.annotation.ElementType; @@ -38,7 +39,7 @@ import org.springframework.core.annotation.AliasFor; */ @Retention(RetentionPolicy.RUNTIME) @Inherited -@Target(value = { ElementType.METHOD }) +@Target(ElementType.METHOD) public @interface NewSpan { /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpanParser.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpanParser.java index 2cc8705c3..4ddac86e4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpanParser.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NewSpanParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,9 @@ public interface NewSpanParser { /** * Override to control the name and tags on an annotation-based span. - * @param methodInvocation - * @param newSpan - * @param span + * @param methodInvocation method invocation annotated with new span + * @param newSpan meta data of the new span + * @param span span to customize */ void parse(MethodInvocation methodInvocation, NewSpan newSpan, SpanCustomizer span); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolver.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolver.java index 603d47589..a131cc96a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolver.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NonReactorSleuthMethodInvocationProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NonReactorSleuthMethodInvocationProcessor.java index 9e5382fe8..7754bfe06 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NonReactorSleuthMethodInvocationProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/NonReactorSleuthMethodInvocationProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.annotation; import brave.Span; import brave.Tracer; import org.aopalliance.intercept.MethodInvocation; + import org.springframework.util.StringUtils; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ReactorSleuthMethodInvocationProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ReactorSleuthMethodInvocationProcessor.java index 560f15d07..44b3ea55d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ReactorSleuthMethodInvocationProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/ReactorSleuthMethodInvocationProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,10 +45,10 @@ import org.springframework.util.StringUtils; class ReactorSleuthMethodInvocationProcessor extends AbstractSleuthMethodInvocationProcessor { - private NonReactorSleuthMethodInvocationProcessor nonReactorSleuthMethodInvocationProcessor; - Tracing tracing; + private NonReactorSleuthMethodInvocationProcessor nonReactorSleuthMethodInvocationProcessor; + Tracing tracing() { if (this.tracing == null) { this.tracing = this.beanFactory.getBean(Tracing.class); @@ -100,6 +100,19 @@ class ReactorSleuthMethodInvocationProcessor } } + private boolean isReactorReturnType(Class returnType) { + return Flux.class.equals(returnType) || Mono.class.equals(returnType); + } + + private NonReactorSleuthMethodInvocationProcessor nonReactorSleuthMethodInvocationProcessor() { + if (this.nonReactorSleuthMethodInvocationProcessor == null) { + this.nonReactorSleuthMethodInvocationProcessor = new NonReactorSleuthMethodInvocationProcessor(); + this.nonReactorSleuthMethodInvocationProcessor + .setBeanFactory(this.beanFactory); + } + return this.nonReactorSleuthMethodInvocationProcessor; + } + private static final class FluxSpan extends FluxOperator { final Span span; @@ -307,17 +320,4 @@ class ReactorSleuthMethodInvocationProcessor } - private boolean isReactorReturnType(Class returnType) { - return Flux.class.equals(returnType) || Mono.class.equals(returnType); - } - - private NonReactorSleuthMethodInvocationProcessor nonReactorSleuthMethodInvocationProcessor() { - if (this.nonReactorSleuthMethodInvocationProcessor == null) { - this.nonReactorSleuthMethodInvocationProcessor = new NonReactorSleuthMethodInvocationProcessor(); - this.nonReactorSleuthMethodInvocationProcessor - .setBeanFactory(this.beanFactory); - } - return this.nonReactorSleuthMethodInvocationProcessor; - } - } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAdvisorConfig.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAdvisorConfig.java index c326f73bc..5ed4bac67 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAdvisorConfig.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAdvisorConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,12 @@ package org.springframework.cloud.sleuth.annotation; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.concurrent.atomic.AtomicBoolean; + import javax.annotation.PostConstruct; import org.aopalliance.aop.Advice; import org.aopalliance.intercept.MethodInvocation; + import org.springframework.aop.ClassFilter; import org.springframework.aop.IntroductionInterceptor; import org.springframework.aop.Pointcut; @@ -87,6 +89,34 @@ class SleuthAdvisorConfig extends AbstractPointcutAdvisor implements BeanFactory return new AnnotationClassOrMethodOrArgsPointcut(); } + /** + * Checks if a method is properly annotated with a given Sleuth annotation. + */ + private static class AnnotationMethodsResolver { + + private final Class annotationType; + + AnnotationMethodsResolver(Class annotationType) { + this.annotationType = annotationType; + } + + boolean hasAnnotatedMethods(Class clazz) { + final AtomicBoolean found = new AtomicBoolean(false); + ReflectionUtils.doWithMethods(clazz, (method -> { + if (found.get()) { + return; + } + Annotation annotation = AnnotationUtils.findAnnotation(method, + AnnotationMethodsResolver.this.annotationType); + if (annotation != null) { + found.set(true); + } + })); + return found.get(); + } + + } + /** * Checks if a class or a method is is annotated with Sleuth related annotations. */ @@ -130,34 +160,6 @@ class SleuthAdvisorConfig extends AbstractPointcutAdvisor implements BeanFactory } - /** - * Checks if a method is properly annotated with a given Sleuth annotation. - */ - private static class AnnotationMethodsResolver { - - private final Class annotationType; - - AnnotationMethodsResolver(Class annotationType) { - this.annotationType = annotationType; - } - - boolean hasAnnotatedMethods(Class clazz) { - final AtomicBoolean found = new AtomicBoolean(false); - ReflectionUtils.doWithMethods(clazz, (method -> { - if (found.get()) { - return; - } - Annotation annotation = AnnotationUtils.findAnnotation(method, - AnnotationMethodsResolver.this.annotationType); - if (annotation != null) { - found.set(true); - } - })); - return found.get(); - } - - } - } /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotatedParameter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotatedParameter.java index 4c253528d..42a05f818 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotatedParameter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotatedParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.annotation; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationAutoConfiguration.java index 714c93861..5526c3cf9 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.annotation; import brave.Tracing; + import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationProperties.java index ed8f7ffa4..b42fc7aef 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java index 2a743bb38..e2571c6d4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.core.annotation.AnnotationUtils; /** @@ -32,14 +33,14 @@ import org.springframework.core.annotation.AnnotationUtils; * @author Christian Schwerdtfeger * @since 1.2.0 */ -class SleuthAnnotationUtils { +final class SleuthAnnotationUtils { + + private static final Log log = LogFactory.getLog(SleuthAnnotationUtils.class); private SleuthAnnotationUtils() { } - private static final Log log = LogFactory.getLog(SleuthAnnotationUtils.class); - static boolean isMethodAnnotated(Method method) { return findAnnotation(method, NewSpan.class) != null || findAnnotation(method, ContinueSpan.class) != null; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthMethodInvocationProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthMethodInvocationProcessor.java index c8d54a15f..981fe675f 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthMethodInvocationProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthMethodInvocationProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTag.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTag.java index 885fdd2b5..cc4db05f2 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTag.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ import org.springframework.core.annotation.AliasFor; */ @Retention(RetentionPolicy.RUNTIME) @Inherited -@Target(value = { ElementType.PARAMETER }) +@Target(ElementType.PARAMETER) public @interface SpanTag { /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandler.java index 8d6b51253..45894b017 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import brave.SpanCustomizer; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.BeanFactory; import org.springframework.util.StringUtils; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolver.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolver.java index df6fcf42c..c495bdc34 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolver.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.annotation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueExpressionResolver.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueExpressionResolver.java index ae6be9056..3ed42c31d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueExpressionResolver.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueExpressionResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueResolver.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueResolver.java index 32d1690fe..1093f18e3 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueResolver.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/TagValueResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/SleuthProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/SleuthProperties.java index 0b40aee78..da12f72c2 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/SleuthProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/SleuthProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.java index 000845202..2b910ffff 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.java @@ -38,7 +38,6 @@ import zipkin2.reporter.InMemoryReporterMetrics; import zipkin2.reporter.Reporter; import zipkin2.reporter.ReporterMetrics; -import org.springframework.lang.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -49,6 +48,7 @@ import org.springframework.cloud.sleuth.SpanAdjuster; import org.springframework.cloud.sleuth.SpanNamer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.lang.Nullable; import org.springframework.util.StringUtils; /** @@ -110,66 +110,6 @@ public class TraceAutoConfiguration { return builder.build(); } - private static class CompositeReporter implements Reporter { - - private static final Log log = LogFactory.getLog(CompositeReporter.class); - - private final List spanAdjusters; - - private final Reporter spanReporter; - - private CompositeReporter(List spanAdjusters, - List> spanReporters) { - this.spanAdjusters = spanAdjusters; - this.spanReporter = spanReporters.size() == 1 ? spanReporters.get(0) - : new ListReporter(spanReporters); - } - - private static class ListReporter implements Reporter { - - private final List> spanReporters; - - private ListReporter(List> spanReporters) { - this.spanReporters = spanReporters; - } - - @Override - public void report(Span span) { - for (Reporter spanReporter : this.spanReporters) { - try { - spanReporter.report(span); - } - catch (Exception ex) { - log.warn("Exception occurred while trying to report the span " - + span, ex); - } - } - } - - @Override - public String toString() { - return "ListReporter{" + "spanReporters=" + this.spanReporters + '}'; - } - - } - - @Override - public void report(Span span) { - Span spanToAdjust = span; - for (SpanAdjuster spanAdjuster : this.spanAdjusters) { - spanToAdjust = spanAdjuster.adjust(spanToAdjust); - } - this.spanReporter.report(spanToAdjust); - } - - @Override - public String toString() { - return "CompositeReporter{" + "spanAdjusters=" + this.spanAdjusters - + ", spanReporters=" + this.spanReporter + '}'; - } - - } - @Bean(name = TRACER_BEAN_NAME) @ConditionalOnMissingBean Tracer tracer(Tracing tracing) { @@ -257,4 +197,64 @@ public class TraceAutoConfiguration { return CurrentSpanCustomizer.create(tracing); } + private static final class CompositeReporter implements Reporter { + + private static final Log log = LogFactory.getLog(CompositeReporter.class); + + private final List spanAdjusters; + + private final Reporter spanReporter; + + private CompositeReporter(List spanAdjusters, + List> spanReporters) { + this.spanAdjusters = spanAdjusters; + this.spanReporter = spanReporters.size() == 1 ? spanReporters.get(0) + : new ListReporter(spanReporters); + } + + @Override + public void report(Span span) { + Span spanToAdjust = span; + for (SpanAdjuster spanAdjuster : this.spanAdjusters) { + spanToAdjust = spanAdjuster.adjust(spanToAdjust); + } + this.spanReporter.report(spanToAdjust); + } + + @Override + public String toString() { + return "CompositeReporter{" + "spanAdjusters=" + this.spanAdjusters + + ", spanReporters=" + this.spanReporter + '}'; + } + + private static final class ListReporter implements Reporter { + + private final List> spanReporters; + + private ListReporter(List> spanReporters) { + this.spanReporters = spanReporters; + } + + @Override + public void report(Span span) { + for (Reporter spanReporter : this.spanReporters) { + try { + spanReporter.report(span); + } + catch (Exception ex) { + log.warn("Exception occurred while trying to report the span " + + span, ex); + } + } + } + + @Override + public String toString() { + return "ListReporter{" + "spanReporters=" + this.spanReporters + '}'; + } + + } + + } + } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceEnvironmentPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceEnvironmentPostProcessor.java index 9fba6a093..66226e19a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceEnvironmentPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceEnvironmentPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,8 +48,8 @@ public class TraceEnvironmentPostProcessor implements EnvironmentPostProcessor { // traces in logs without having to configure it. if (Boolean .parseBoolean(environment.getProperty("spring.sleuth.enabled", "true"))) { - map.put("logging.pattern.level", - "%5p [${spring.zipkin.service.name:${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]"); + map.put("logging.pattern.level", "%5p [${spring.zipkin.service.name:" + + "${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]"); } addOrReplace(environment.getPropertySources(), map); } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncAutoConfiguration.java index e9f6ec110..d872b4be1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfiguration.java index c4f190d79..dff63dc71 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncDefaultAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncDefaultAutoConfiguration.java index b52bd5b5f..b6f83662b 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncDefaultAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/AsyncDefaultAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListener.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListener.java index ca2afe4f5..1be0fbb5c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListener.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ import org.springframework.context.event.SmartApplicationListener; class ContextRefreshedListener extends AtomicBoolean implements SmartApplicationListener { - private static final Log log = LogFactory.getLog(ContextRefreshedListener.class); - static final Map CACHE = new ConcurrentHashMap<>(); + private static final Log log = LogFactory.getLog(ContextRefreshedListener.class); + ContextRefreshedListener(boolean initialValue) { super(initialValue); } @@ -44,6 +44,10 @@ class ContextRefreshedListener extends AtomicBoolean implements SmartApplication this(false); } + static ContextRefreshedListener getBean(BeanFactory beanFactory) { + return CACHE.getOrDefault(beanFactory, new ContextRefreshedListener(false)); + } + @Override public boolean supportsEventType(Class eventType) { return ContextRefreshedEvent.class.isAssignableFrom(eventType); @@ -67,8 +71,4 @@ class ContextRefreshedListener extends AtomicBoolean implements SmartApplication } } - static ContextRefreshedListener getBean(BeanFactory beanFactory) { - return CACHE.getOrDefault(beanFactory, new ContextRefreshedListener(false)); - } - -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextUtil.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextUtil.java index 35959f8e3..c3f847f8a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextUtil.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ContextUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,11 @@ import org.springframework.beans.factory.BeanFactory; * @author Marcin Grzejszczak * @since 2.1.0 */ -class ContextUtil { +final class ContextUtil { + + private ContextUtil() { + throw new IllegalStateException("Can't instantiate a utility class"); + } private static final Log log = LogFactory.getLog(ContextUtil.class); @@ -39,4 +43,4 @@ class ContextUtil { return !contextRefreshed; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessor.java index e025bbafe..449f47bf4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizer.java index 06f070bdb..6298c8445 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceExecutor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceExecutor.java index d7562c7be..ef3f11ed8 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceExecutor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanNamer; /** - * {@link Executor} that wraps {@link Runnable} in a trace representation + * {@link Executor} that wraps {@link Runnable} in a trace representation. * * @author Dave Syer * @since 1.0.0 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceThreadPoolTaskExecutor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceThreadPoolTaskExecutor.java index 0cdc52ada..f2b9137d6 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceThreadPoolTaskExecutor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceThreadPoolTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.util.concurrent.ListenableFuture; /** - * Trace representation of {@link ThreadPoolTaskExecutor} + * Trace representation of {@link ThreadPoolTaskExecutor}. * * @author Marcin Grzejszczak * @since 1.0.10 @@ -108,11 +108,6 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { this.delegate.setThreadFactory(threadFactory); } - @Override - public void setThreadNamePrefix(String threadNamePrefix) { - this.delegate.setThreadNamePrefix(threadNamePrefix); - } - @Override public void setRejectedExecutionHandler( RejectedExecutionHandler rejectedExecutionHandler) { @@ -185,8 +180,8 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public void setThreadPriority(int threadPriority) { - this.delegate.setThreadPriority(threadPriority); + public void setThreadNamePrefix(String threadNamePrefix) { + this.delegate.setThreadNamePrefix(threadNamePrefix); } @Override @@ -195,8 +190,8 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public void setDaemon(boolean daemon) { - this.delegate.setDaemon(daemon); + public void setThreadPriority(int threadPriority) { + this.delegate.setThreadPriority(threadPriority); } @Override @@ -205,13 +200,13 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public void setThreadGroupName(String name) { - this.delegate.setThreadGroupName(name); + public void setDaemon(boolean daemon) { + this.delegate.setDaemon(daemon); } @Override - public void setThreadGroup(ThreadGroup threadGroup) { - this.delegate.setThreadGroup(threadGroup); + public void setThreadGroupName(String name) { + this.delegate.setThreadGroupName(name); } @Override @@ -220,13 +215,13 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public Thread createThread(Runnable runnable) { - return this.delegate.createThread(runnable); + public void setThreadGroup(ThreadGroup threadGroup) { + this.delegate.setThreadGroup(threadGroup); } @Override - public void setCorePoolSize(int corePoolSize) { - this.delegate.setCorePoolSize(corePoolSize); + public Thread createThread(Runnable runnable) { + return this.delegate.createThread(runnable); } @Override @@ -235,8 +230,8 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public void setMaxPoolSize(int maxPoolSize) { - this.delegate.setMaxPoolSize(maxPoolSize); + public void setCorePoolSize(int corePoolSize) { + this.delegate.setCorePoolSize(corePoolSize); } @Override @@ -245,8 +240,8 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { } @Override - public void setKeepAliveSeconds(int keepAliveSeconds) { - this.delegate.setKeepAliveSeconds(keepAliveSeconds); + public void setMaxPoolSize(int maxPoolSize) { + this.delegate.setMaxPoolSize(maxPoolSize); } @Override @@ -254,6 +249,11 @@ public class LazyTraceThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { return this.delegate.getKeepAliveSeconds(); } + @Override + public void setKeepAliveSeconds(int keepAliveSeconds) { + this.delegate.setKeepAliveSeconds(keepAliveSeconds); + } + @Override public void setQueueCapacity(int queueCapacity) { this.delegate.setQueueCapacity(queueCapacity); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/SleuthAsyncProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/SleuthAsyncProperties.java index eb35abacd..5cf8b2872 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/SleuthAsyncProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/SleuthAsyncProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspect.java index 126238e91..dff566a8a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspect.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; + import org.springframework.cloud.sleuth.SpanNamer; import org.springframework.cloud.sleuth.util.SpanNameUtil; import org.springframework.util.ReflectionUtils; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutor.java index 77c191fd2..7186bb9ae 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.Future; import brave.Tracing; + import org.springframework.core.task.AsyncListenableTaskExecutor; import org.springframework.util.concurrent.ListenableFuture; @@ -27,8 +28,8 @@ import org.springframework.util.concurrent.ListenableFuture; * AsyncListenableTaskExecutor that wraps all Runnable / Callable tasks into their trace * related representation. * - * @since 1.0.0 * @author Marcin Grzejszczak + * @since 1.0.0 * @see brave.propagation.CurrentTraceContext#wrap(Runnable) * @see brave.propagation.CurrentTraceContext#wrap(Callable) */ diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceCallable.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceCallable.java index 415ca1d21..bfe659cbf 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceCallable.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceCallable.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,15 +22,16 @@ import brave.ScopedSpan; import brave.Tracer; import brave.Tracing; import brave.propagation.TraceContext; + import org.springframework.cloud.sleuth.SpanNamer; /** * Callable that passes Span between threads. The Span name is taken either from the * passed value or from the {@link SpanNamer} interface. * + * @param - return type from callable * @author Spencer Gibb * @author Marcin Grzejszczak - * @param - return type from callable * @since 1.0.0 */ public class TraceCallable implements Callable { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnable.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnable.java index b5f5a65b3..3d4f0f931 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnable.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import brave.ScopedSpan; import brave.Tracer; import brave.Tracing; import brave.propagation.TraceContext; + import org.springframework.cloud.sleuth.SpanNamer; /** @@ -33,7 +34,8 @@ import org.springframework.cloud.sleuth.SpanNamer; public class TraceRunnable implements Runnable { /** - * Since we don't know the exact operation name we provide a default name for the Span + * Since we don't know the exact operation name we provide a default name for the + * Span. */ private static final String DEFAULT_SPAN_NAME = "async"; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java index f646729a7..1665c01f4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.async; import java.util.ArrayList; @@ -31,7 +32,7 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.sleuth.SpanNamer; /** - * A decorator class for {@link ExecutorService} to support tracing in Executors + * A decorator class for {@link ExecutorService} to support tracing in Executors. * * @author Gaurav Rai Mazra * @since 1.0.0 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorService.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorService.java index a0e015ddf..33334d600 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorService.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.BeanFactory; /** - * A decorator class for {@link ScheduledExecutorService} to support tracing in Executors + * A decorator class for {@link ScheduledExecutorService} to support tracing in Executors. * * @author Gaurav Rai Mazra * @since 1.0.0 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcManagedChannelBuilderCustomizer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcManagedChannelBuilderCustomizer.java index 37c428f28..8e16b9bff 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcManagedChannelBuilderCustomizer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcManagedChannelBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,14 @@ import io.grpc.ManagedChannelBuilder; * Callback interface that can be implemented by beans wishing to further customize the * {@link io.grpc.ManagedChannelBuilder} via the {@link SpringAwareManagedChannelBuilder}. * - * @author tyler.vangorder + * @author Tyler Van Gorder */ public interface GrpcManagedChannelBuilderCustomizer { + /** + * Customizes the channel builder. + * @param managedChannelBuilder the builder to customize + */ void customize(ManagedChannelBuilder managedChannelBuilder); } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/SpringAwareManagedChannelBuilder.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/SpringAwareManagedChannelBuilder.java index cc186465e..7d46bad4e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/SpringAwareManagedChannelBuilder.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/SpringAwareManagedChannelBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import io.grpc.inprocess.InProcessChannelBuilder; * grpc-spring-boot-starter or a new project could be created * "spring-grpc"/"spring-cloud-grpc"? * - * @author tyler.vangorder + * @author Tyler Van Gorder */ public class SpringAwareManagedChannelBuilder { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TraceGrpcAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TraceGrpcAutoConfiguration.java index 4d686fd83..75e45ae7d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TraceGrpcAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TraceGrpcAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ import org.springframework.context.annotation.Bean; * This configuration is only enabled when both grpc-spring-boot-starter and * brave-instrumentation-grpc are on the classpath. * - * @author tyler.vangorder + * @author Tyler Van Gorder */ @ConditionalOnClass({ GrpcTracing.class, GRpcGlobalInterceptor.class }) @ConditionalOnProperty(value = "spring.sleuth.grpc.enabled", matchIfMissing = true) diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TracingManagedChannelBuilderCustomizer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TracingManagedChannelBuilderCustomizer.java index cb94ac11e..6b66501d1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TracingManagedChannelBuilderCustomizer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/grpc/TracingManagedChannelBuilderCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import brave.grpc.GrpcTracing; import io.grpc.ManagedChannelBuilder; /** - * @author tyler.vangorder + * @author Tyler Van Gorder */ public class TracingManagedChannelBuilderCustomizer implements GrpcManagedChannelBuilderCustomizer { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixAutoConfiguration.java index bad0a6875..d692df9f2 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.hystrix; import brave.Tracing; import com.netflix.hystrix.HystrixCommand; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategy.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategy.java index f83e5be27..e1e839abe 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategy.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy; import com.netflix.hystrix.strategy.properties.HystrixProperty; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.cloud.sleuth.SpanNamer; import org.springframework.cloud.sleuth.instrument.async.TraceCallable; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommand.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommand.java index 69a0e3baf..bf348456c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommand.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation.java index ce8f098ed..c9fa10931 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import java.util.Map; import brave.propagation.Propagation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.messaging.support.MessageHeaderAccessor; import org.springframework.messaging.support.NativeMessageHeaderAccessor; import org.springframework.util.LinkedMultiValueMap; @@ -121,8 +122,9 @@ enum MessageHeaderPropagation Object nativeHeaders = accessor .getHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS); if (nativeHeaders == null) { + nativeHeaders = new LinkedMultiValueMap<>(); accessor.setHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS, - nativeHeaders = new LinkedMultiValueMap<>()); + nativeHeaders); } if (nativeHeaders instanceof Map) { ((Map) nativeHeaders).put(key, Collections.singletonList(value)); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/OnMessagingEnabled.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/OnMessagingEnabled.java index 4b4127999..28451f527 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/OnMessagingEnabled.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/OnMessagingEnabled.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/SleuthMessagingProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/SleuthMessagingProperties.java index dd534bede..a0a217e77 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/SleuthMessagingProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/SleuthMessagingProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Properties for messaging + * Properties for messaging. * * @author Marcin Grzejszczak * @since 2.0.0 @@ -48,7 +48,7 @@ public class SleuthMessagingProperties { } /** - * Properties for Spring Integration + * Properties for Spring Integration. * * @author Marcin Grzejszczak */ @@ -56,7 +56,7 @@ public class SleuthMessagingProperties { /** * An array of patterns against which channel names will be matched. - * @see org.springframework.integration.config.GlobalChannelInterceptor#patterns(). + * @see org.springframework.integration.config.GlobalChannelInterceptor#patterns() * Defaults to any channel name not matching the Hystrix Stream channel name. */ private String[] patterns = new String[] { "!hystrixStreamOutput*", "*" }; @@ -145,6 +145,9 @@ public class SleuthMessagingProperties { } + /** + * RabbitMQ configuration. + */ public static class Rabbit { private boolean enabled; @@ -169,6 +172,9 @@ public class SleuthMessagingProperties { } + /** + * Kafka configuration. + */ public static class Kafka { private boolean enabled; @@ -193,6 +199,9 @@ public class SleuthMessagingProperties { } + /** + * JMS configuration. + */ public static class Jms { private boolean enabled; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessageHeaders.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessageHeaders.java index 473794b5a..8c44741da 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessageHeaders.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessageHeaders.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,18 +24,36 @@ package org.springframework.cloud.sleuth.instrument.messaging; * @author Marcin Grzejszczak * @since 1.0.4 */ -public class TraceMessageHeaders { +public final class TraceMessageHeaders { + /** + * Span ID message header name. + */ public static final String SPAN_ID_NAME = "spanId"; + /** + * Span sampled message header name. + */ public static final String SAMPLED_NAME = "spanSampled"; + /** + * Parent span ID message header name. + */ public static final String PARENT_ID_NAME = "spanParentSpanId"; + /** + * Trace ID message header name. + */ public static final String TRACE_ID_NAME = "spanTraceId"; + /** + * Span name message header name. + */ public static final String SPAN_NAME_NAME = "spanName"; + /** + * Span flags message header name. + */ public static final String SPAN_FLAGS_NAME = "spanFlags"; private TraceMessageHeaders() { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfiguration.java index b52108db5..762c5d74e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; + import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.aop.framework.ProxyFactoryBean; @@ -148,7 +149,7 @@ public class TraceMessagingAutoConfiguration { return new TracingConnectionFactoryBeanPostProcessor(beanFactory); } - /** Setup the tracing endpoint registry */ + // Setup the tracing endpoint registry. @Bean JmsListenerConfigurer configureTracing(JmsTracing jmsTracing, CurrentTraceContext current) { @@ -312,8 +313,9 @@ class MessageListenerMethodInterceptor } catch (RuntimeException | Error e) { String message = e.getMessage(); - if (message == null) + if (message == null) { message = e.getClass().getSimpleName(); + } span.tag("error", message); throw e; } @@ -322,4 +324,4 @@ class MessageListenerMethodInterceptor } } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java index 0512b09e8..c54eff54e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.messaging; import brave.Tracing; import brave.propagation.Propagation; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java index e8c720a0b..a8ef63337 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import brave.propagation.TraceContext; import brave.propagation.TraceContextOrSamplingFlags; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.sleuth.util.SpanNameUtil; @@ -55,10 +56,18 @@ import org.springframework.util.ClassUtils; * This implementation uses {@link ThreadLocalSpan} to propagate context between * callbacks. This is an alternative to {@code ThreadStatePropagationChannelInterceptor} * which is less sensitive to message manipulation by other interceptors. + * + * @author Marcin Grzejszczak */ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter implements ExecutorChannelInterceptor { + /** + * Name of the class in Spring Cloud Stream that is a direct channel. + */ + public static final String STREAM_DIRECT_CHANNEL = "org.springframework." + + "cloud.stream.messaging.DirectWithAttributesChannel"; + private static final Log log = LogFactory.getLog(TracingChannelInterceptor.class); /** @@ -81,8 +90,6 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter */ private static final String REMOTE_SERVICE_NAME = "broker"; - public static final String STREAM_DIRECT_CHANNEL = "org.springframework.cloud.stream.messaging.DirectWithAttributesChannel"; - final Tracing tracing; final Tracer tracer; @@ -134,6 +141,8 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter *

* This creates a child from identifiers extracted from the message headers, or a new * span if one couldn't be extracted. + * @param message message to use for span creation + * @return span to be created */ public Span nextSpan(Message message) { MessageHeaderAccessor headers = mutableHeaderAccessor(message); @@ -329,7 +338,10 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter } /** - * When an upstream context was not present, lookup keys are unlikely added + * When an upstream context was not present, lookup keys are unlikely added. + * @param message a message to append tags to + * @param result span to customize + * @param channel channel to which a message was sent */ void addTags(Message message, SpanCustomizer result, MessageChannel channel) { // TODO topic etc @@ -360,12 +372,14 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter void finishSpan(Exception error) { Span span = this.threadLocalSpan.remove(); - if (span == null || span.isNoop()) + if (span == null || span.isNoop()) { return; + } if (error != null) { // an error occurred, adding error to span String message = error.getMessage(); - if (message == null) + if (message == null) { message = error.getClass().getSimpleName(); + } span.tag("error", message); } span.finish(); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java index 9943ff9e6..718a3209e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,7 @@ import org.springframework.jms.listener.endpoint.JmsMessageEndpointManager; import org.springframework.lang.Nullable; /** - * {@link BeanPostProcessor} wrapping around JMS {@link ConnectionFactory} + * {@link BeanPostProcessor} wrapping around JMS {@link ConnectionFactory}. * * @author Adrian Cole * @since 2.1.0 @@ -134,14 +134,16 @@ class LazyXAConnectionFactory implements XAConnectionFactory { if (this.jmsTracing != null) { return this.jmsTracing; } - return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + return this.jmsTracing; } private XAConnectionFactory wrappedDelegate() { if (this.wrappedDelegate != null) { return this.wrappedDelegate; } - return this.wrappedDelegate = jmsTracing().xaConnectionFactory(this.delegate); + this.wrappedDelegate = jmsTracing().xaConnectionFactory(this.delegate); + return this.wrappedDelegate; } } @@ -195,14 +197,16 @@ class LazyConnectionFactory implements ConnectionFactory { if (this.jmsTracing != null) { return this.jmsTracing; } - return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + return this.jmsTracing; } private ConnectionFactory wrappedDelegate() { if (this.wrappedDelegate != null) { return this.wrappedDelegate; } - return this.wrappedDelegate = jmsTracing().connectionFactory(this.delegate); + this.wrappedDelegate = jmsTracing().connectionFactory(this.delegate); + return this.wrappedDelegate; } } @@ -229,7 +233,8 @@ class LazyMessageListener implements MessageListener { if (this.jmsTracing != null) { return this.jmsTracing; } - return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + this.jmsTracing = this.beanFactory.getBean(JmsTracing.class); + return this.jmsTracing; } private MessageListener wrappedDelegate() { @@ -242,7 +247,7 @@ class LazyMessageListener implements MessageListener { /** * This ensures listeners end up continuing the trace from - * {@link MessageConsumer#receive()} + * {@link MessageConsumer#receive()}. */ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry { @@ -295,11 +300,14 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry { /** * This wraps the {@link SimpleJmsListenerEndpoint#getMessageListener()} delegate in a * new span. + * @param source jms endpoint + * @return wrapped endpoint */ SimpleJmsListenerEndpoint trace(SimpleJmsListenerEndpoint source) { MessageListener delegate = source.getMessageListener(); - if (delegate == null) + if (delegate == null) { return source; + } source.setMessageListener(this.jmsTracing.messageListener(delegate, false)); return source; } @@ -315,6 +323,8 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry { * subtype could hold state we aren't aware of, or change behavior. We can consider * checking that input is not a subtype, and most conservatively leaving unknown * subtypes untraced. + * @param source jms endpoint + * @return wrapped endpoint */ MethodJmsListenerEndpoint trace(MethodJmsListenerEndpoint source) { // Skip out rather than incompletely copying the source @@ -360,7 +370,7 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry { } /** - * This wraps the message listener in a child span + * This wraps the message listener in a child span. */ final class TracingMessagingMessageListenerAdapter extends MessagingMessageListenerAdapter { @@ -390,4 +400,4 @@ final class TracingMessagingMessageListenerAdapter } } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java index 076f9b9f4..ae590df42 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.messaging.websocket; import brave.Tracing; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -68,4 +69,4 @@ public class TraceWebSocketAutoConfiguration registration.setInterceptors(TracingChannelInterceptor.create(this.tracing)); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java index 5961db938..fd0017066 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.opentracing; import brave.Tracing; import brave.opentracing.BraveTracer; import io.opentracing.Tracer; + import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java index c4d157944..bbf7401eb 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java index 6634ae69e..ef477834e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java index 82b5840b3..114bb33ef 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,15 +24,15 @@ import brave.Tracing; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.reactivestreams.Publisher; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.ConfigurableApplicationContext; - import reactor.core.CoreSubscriber; import reactor.core.Fuseable; import reactor.core.Scannable; import reactor.core.publisher.Operators; import reactor.util.context.Context; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.ConfigurableApplicationContext; + /** * Reactive Span pointcuts factories. * diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java index fc9b02d67..7f5a5b4be 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.springframework.cloud.sleuth.instrument.reactor; import javax.annotation.Nullable; import brave.Span; -import brave.Tracer; import brave.Tracing; import brave.propagation.CurrentTraceContext; import brave.propagation.TraceContext; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java index 20b3ac634..76ab5ee3d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java index 8bad7e2dd..85dd4b050 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java index ce412d26e..1c7b81072 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ import reactor.core.Fuseable; * (implementing {@link reactor.core.Fuseable.QueueSubscription} with default no-op * methods and always negotiating fusion to be {@link Fuseable#NONE}). * + * @param - type of the subscription * @author Marcin Grzejszczak - * @param - type of the subsciption */ interface SpanSubscription extends Subscription, CoreSubscriber, Fuseable.QueueSubscription { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java index d2a13ac8b..5e013cfc4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,10 @@ import brave.Tracing; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.reactivestreams.Subscriber; -import org.springframework.beans.factory.BeanFactory; import reactor.util.context.Context; +import org.springframework.beans.factory.BeanFactory; + /** * Supplier to lazily start a {@link SpanSubscription}. * diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java index 7b0a1b23a..035dbe3eb 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,11 +62,11 @@ public class TraceReactorAutoConfiguration { @ConditionalOnBean(Tracing.class) static class TraceReactorConfiguration { - private static final Log log = LogFactory.getLog(TraceReactorConfiguration.class); - static final String SLEUTH_TRACE_REACTOR_KEY = TraceReactorConfiguration.class .getName(); + private static final Log log = LogFactory.getLog(TraceReactorConfiguration.class); + @Bean // for tests @ConditionalOnMissingBean @@ -131,4 +131,4 @@ class HookRegisteringBeanDefinitionRegistryPostProcessor }; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java index e95016566..b7fbd44cb 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ import java.util.Arrays; import brave.Tracer; import brave.Tracing; +import rx.plugins.RxJavaSchedulersHook; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -28,7 +30,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import rx.plugins.RxJavaSchedulersHook; /** * {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java index 8125822cd..a498528d9 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java index a58424008..167019f45 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java index d546d2b37..d91de8e64 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java index 6ff3d0139..22c3f51a4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import brave.Tracing; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; + import org.springframework.cloud.sleuth.util.SpanNameUtil; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java index bb9190c66..dd3e81f44 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.util.regex.Pattern; import brave.Tracer; import brave.Tracing; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java index c4c125715..cd21a8c1e 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java index 69105cbab..c0f80cab3 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java index 16389185e..e0f1cccfe 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java index 0809e0704..2f0859128 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java index eeb9821b5..280be6adc 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java index 8607798ab..6acae125a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java index ff72da893..aa710a265 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.net.URI; import brave.SpanCustomizer; import brave.http.HttpAdapter; import brave.http.HttpClientParser; + import org.springframework.cloud.sleuth.util.SpanNameUtil; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java index c6ccc6fc0..3052a74a9 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java index 5bf2937ae..adc7a1258 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java index 134afd662..2f7deced1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java index d283db9a6..ed8401ab1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,4 +84,4 @@ class SleuthHttpServerParser extends HttpServerParser { error(httpStatus, error, customizer); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java index 7ccc2df77..545705a08 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,8 @@ public class SleuthWebProperties { /** * Default set of skip patterns. */ - public static final String DEFAULT_SKIP_PATTERN = "/api-docs.*|/swagger.*|.*\\.png|.*\\.css|.*\\.js|.*\\.html|/favicon.ico|/hystrix.stream"; + public static final String DEFAULT_SKIP_PATTERN = "/api-docs.*|/swagger.*|" + + ".*\\.png|.*\\.css|.*\\.js|.*\\.html|/favicon.ico|/hystrix.stream"; /** * When true enables instrumentation for web applications. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java index aceef1673..7962ef898 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import brave.http.HttpClientParser; import brave.http.HttpSampler; import brave.http.HttpServerParser; import brave.http.HttpTracing; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java index 303316a81..c970ea320 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java index 8378b135f..dd5c48b63 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest; import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.context.ApplicationContext; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java index d3ecceaaa..1eca40f2b 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; + import org.springframework.cloud.sleuth.SpanNamer; import org.springframework.cloud.sleuth.instrument.async.TraceCallable; import org.springframework.web.context.request.async.WebAsyncTask; @@ -74,7 +75,7 @@ public class TraceWebAspect { @Pointcut("@within(org.springframework.web.bind.annotation.RestController)") private void anyRestControllerAnnotated() { - }// NOSONAR + } // NOSONAR @Pointcut("@within(org.springframework.stereotype.Controller)") private void anyControllerAnnotated() { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java index 15088cb21..bc43135d8 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.web; import java.util.ArrayList; @@ -23,6 +24,7 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import brave.Tracing; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; @@ -74,9 +76,10 @@ public class TraceWebAutoConfiguration { protected static class ManagementSkipPatternProviderConfig { /** - * Sets or appends - * {@link ManagementServerProperties#getServlet()#getContextPath()} to the skip + * Sets or appends {@link ManagementServerProperties#getServlet()} to the skip * pattern. If neither is available then sets the default one + * @param managementServerProperties properties + * @return optional skip pattern */ static Optional getPatternForManagementServerProperties( ManagementServerProperties managementServerProperties) { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java index 164a29c41..9b1cd4329 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,6 +147,11 @@ public final class TraceWebFilter implements WebFilter, Ordered { return new MonoWebFilterTrace(chain.filter(exchange), exchange, this); } + @Override + public int getOrder() { + return sleuthWebProperties().getFilterOrder(); + } + private static class MonoWebFilterTrace extends MonoOperator { final ServerWebExchange exchange; @@ -176,6 +181,37 @@ public final class TraceWebFilter implements WebFilter, Ordered { findOrCreateSpan(context), this)); } + private Span findOrCreateSpan(Context c) { + Span span; + if (c.hasKey(Span.class)) { + Span parent = c.get(Span.class); + span = this.tracer + .nextSpan(TraceContextOrSamplingFlags.create(parent.context())) + .start(); + if (log.isDebugEnabled()) { + log.debug("Found span in reactor context" + span); + } + } + else { + if (this.attrSpan != null) { + span = this.attrSpan; + if (log.isDebugEnabled()) { + log.debug("Found span in attribute " + span); + } + } + else { + span = this.handler.handleReceive(this.extractor, + this.exchange.getRequest().getHeaders(), + this.exchange.getRequest()); + if (log.isDebugEnabled()) { + log.debug("Handled receive of span " + span); + } + } + this.exchange.getAttributes().put(TRACE_REQUEST_ATTR, span); + } + return span; + } + static final class WebFilterTraceSubscriber implements CoreSubscriber { final CoreSubscriber actual; @@ -288,47 +324,13 @@ public final class TraceWebFilter implements WebFilter, Ordered { } - private Span findOrCreateSpan(Context c) { - Span span; - if (c.hasKey(Span.class)) { - Span parent = c.get(Span.class); - span = this.tracer - .nextSpan(TraceContextOrSamplingFlags.create(parent.context())) - .start(); - if (log.isDebugEnabled()) { - log.debug("Found span in reactor context" + span); - } - } - else { - if (this.attrSpan != null) { - span = this.attrSpan; - if (log.isDebugEnabled()) { - log.debug("Found span in attribute " + span); - } - } - else { - span = this.handler.handleReceive(this.extractor, - this.exchange.getRequest().getHeaders(), - this.exchange.getRequest()); - if (log.isDebugEnabled()) { - log.debug("Handled receive of span " + span); - } - } - this.exchange.getAttributes().put(TRACE_REQUEST_ATTR, span); - } - return span; - } - - } - - @Override - public int getOrder() { - return sleuthWebProperties().getFilterOrder(); } static final class DecoratedServerHttpResponse extends ServerHttpResponseDecorator { - final String method, httpRoute; + final String method; + + final String httpRoute; DecoratedServerHttpResponse(ServerHttpResponse delegate, String method, String httpRoute) { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java index 1ed70c4ee..d0fcb93e8 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.web; import brave.Tracing; + import org.springframework.beans.factory.BeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java index f26fda9ec..60348b3ce 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web; import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; @@ -25,7 +26,7 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** - * MVC Adapter that adds the {@link SpanCustomizingAsyncHandlerInterceptor} + * MVC Adapter that adds the {@link SpanCustomizingAsyncHandlerInterceptor}. * * @author Marcin Grzejszczak * @since 1.0.3 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java index f8c4bec3a..0adab6616 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import brave.Tracing; import brave.http.HttpTracing; import brave.servlet.TracingFilter; import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor; + import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java index f25cd9a76..c76421739 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.web.client; import java.util.concurrent.atomic.AtomicReference; @@ -118,6 +119,10 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor { this.beanFactory = beanFactory; } + static TracingDoOnRequest create(BeanFactory beanFactory) { + return new TracingDoOnRequest(beanFactory); + } + private HttpTracing httpTracing() { if (this.httpTracing == null) { this.httpTracing = this.beanFactory.getBean(HttpTracing.class); @@ -146,10 +151,6 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor { return this.handler; } - static TracingDoOnRequest create(BeanFactory beanFactory) { - return new TracingDoOnRequest(beanFactory); - } - @Override public void accept(HttpClientRequest req, Connection connection) { if (propagation().keys().stream() @@ -285,4 +286,4 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java index 444445eae..1a23bc4a7 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java index 76ec6f2a8..ec613fa79 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.web.client; import brave.Span; @@ -30,18 +31,18 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.web.server.ServerWebExchange; -class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter { +final class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter { private static final Log log = LogFactory.getLog(TraceRequestHttpHeadersFilter.class); - static HttpHeadersFilter create(HttpTracing httpTracing) { - return new TraceRequestHttpHeadersFilter(httpTracing); - } - private TraceRequestHttpHeadersFilter(HttpTracing httpTracing) { super(httpTracing); } + static HttpHeadersFilter create(HttpTracing httpTracing) { + return new TraceRequestHttpHeadersFilter(httpTracing); + } + @Override public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) { if (log.isDebugEnabled()) { @@ -68,19 +69,19 @@ class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter { } -class TraceResponseHttpHeadersFilter extends AbstractHttpHeadersFilter { +final class TraceResponseHttpHeadersFilter extends AbstractHttpHeadersFilter { private static final Log log = LogFactory .getLog(TraceResponseHttpHeadersFilter.class); - static HttpHeadersFilter create(HttpTracing httpTracing) { - return new TraceResponseHttpHeadersFilter(httpTracing); - } - private TraceResponseHttpHeadersFilter(HttpTracing httpTracing) { super(httpTracing); } + static HttpHeadersFilter create(HttpTracing httpTracing) { + return new TraceResponseHttpHeadersFilter(httpTracing); + } + @Override public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) { Object storedSpan = exchange.getAttribute(SPAN_ATTRIBUTE); @@ -162,4 +163,4 @@ abstract class AbstractHttpHeadersFilter implements HttpHeadersFilter { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java index 1b550d531..a9a08daa4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import javax.annotation.PostConstruct; import brave.http.HttpTracing; import brave.spring.web.TracingAsyncClientHttpRequestInterceptor; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -39,7 +40,7 @@ import org.springframework.web.client.AsyncRestTemplate; /** * {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration * Auto-configuration} enables span information propagation for - * {@link AsyncClientHttpRequestFactory} and {@link AsyncRestTemplate} + * {@link AsyncClientHttpRequestFactory} and {@link AsyncRestTemplate}. * * @author Marcin Grzejszczak * @since 1.0.0 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java index b440e63b7..33305ec45 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ import org.springframework.web.reactive.function.client.WebClient; /** * {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration * Auto-configuration} enables span information propagation when using - * {@link RestTemplate} + * {@link RestTemplate}. * * @author Marcin Grzejszczak * @since 1.0.0 @@ -296,7 +296,7 @@ class LazyTracingClientHttpRequestInterceptor implements ClientHttpRequestInterc private TracingClientHttpRequestInterceptor interceptor; - public LazyTracingClientHttpRequestInterceptor(BeanFactory beanFactory) { + LazyTracingClientHttpRequestInterceptor(BeanFactory beanFactory) { this.beanFactory = beanFactory; } @@ -342,4 +342,4 @@ class TraceUserInfoRestTemplateCustomizer implements UserInfoRestTemplateCustomi } } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java index 015e5f96b..1c841fbc2 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ import org.springframework.web.reactive.function.client.WebClient; /** * {@link BeanPostProcessor} to wrap a {@link WebClient} instance into its trace - * representation + * representation. * * @author Marcin Grzejszczak * @since 2.0.0 @@ -99,11 +99,6 @@ final class TraceWebClientBeanPostProcessor implements BeanPostProcessor { final class TraceExchangeFilterFunction implements ExchangeFilterFunction { private static final Log log = LogFactory.getLog(TraceExchangeFilterFunction.class); - - private static final String CLIENT_SPAN_KEY = "sleuth.webclient.clientSpan"; - - private static final String CANCELLED_SUBSCRIPTION_ERROR = "CANCELLED"; - static final Propagation.Setter SETTER = new Propagation.Setter() { @Override public void put(ClientRequest.Builder carrier, String key, String value) { @@ -122,9 +117,9 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction { } }; - public static ExchangeFilterFunction create(BeanFactory beanFactory) { - return new TraceExchangeFilterFunction(beanFactory); - } + private static final String CLIENT_SPAN_KEY = "sleuth.webclient.clientSpan"; + + private static final String CANCELLED_SUBSCRIPTION_ERROR = "CANCELLED"; final BeanFactory beanFactory; @@ -144,6 +139,10 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction { .scopePassingSpanOperator(beanFactory); } + public static ExchangeFilterFunction create(BeanFactory beanFactory) { + return new TraceExchangeFilterFunction(beanFactory); + } + @Override public Mono filter(ClientRequest request, ExchangeFunction next) { ClientRequest.Builder builder = ClientRequest.from(request); @@ -159,6 +158,38 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction { return new MonoWebClientTrace(next, builder.build(), this, span); } + @SuppressWarnings("unchecked") + HttpClientHandler handler() { + if (this.handler == null) { + this.handler = HttpClientHandler.create( + this.beanFactory.getBean(HttpTracing.class), + new TraceExchangeFilterFunction.HttpAdapter()); + } + return this.handler; + } + + Tracer tracer() { + if (this.tracer == null) { + this.tracer = httpTracing().tracing().tracer(); + } + return this.tracer; + } + + HttpTracing httpTracing() { + if (this.httpTracing == null) { + this.httpTracing = this.beanFactory.getBean(HttpTracing.class); + } + return this.httpTracing; + } + + TraceContext.Injector injector() { + if (this.injector == null) { + this.injector = this.beanFactory.getBean(HttpTracing.class).tracing() + .propagation().injector(SETTER); + } + return this.injector; + } + private static final class MonoWebClientTrace extends Mono { final ExchangeFunction next; @@ -343,38 +374,6 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction { } - @SuppressWarnings("unchecked") - HttpClientHandler handler() { - if (this.handler == null) { - this.handler = HttpClientHandler.create( - this.beanFactory.getBean(HttpTracing.class), - new TraceExchangeFilterFunction.HttpAdapter()); - } - return this.handler; - } - - Tracer tracer() { - if (this.tracer == null) { - this.tracer = httpTracing().tracing().tracer(); - } - return this.tracer; - } - - HttpTracing httpTracing() { - if (this.httpTracing == null) { - this.httpTracing = this.beanFactory.getBean(HttpTracing.class); - } - return this.httpTracing; - } - - TraceContext.Injector injector() { - if (this.injector == null) { - this.injector = this.beanFactory.getBean(HttpTracing.class).tracing() - .propagation().injector(SETTER); - } - return this.injector; - } - static final class HttpAdapter extends brave.http.HttpClientAdapter { @@ -401,4 +400,4 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java index 1efd61f46..735998d93 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java index f050f714a..c7e9441e5 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.io.IOException; import feign.Client; import feign.Request; import feign.Response; + import org.springframework.beans.factory.BeanFactory; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java index 1bee39d8f..057ecbcde 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import feign.Request; import feign.Response; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.BeanFactory; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java index 3c6f2115e..cf63dccf6 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java index f7b155e2d..3d519b102 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web.client.feign; import feign.Client; import feign.okhttp.OkHttpClient; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.BeanPostProcessor; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java index b25207b8f..fa8cb3032 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import brave.http.HttpTracing; import feign.Client; import feign.Feign; import feign.Retryer; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java index f538a8294..2493772ad 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java index 9ec11f609..1df7ca06c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import feign.Client; import feign.Feign; import feign.Retryer; import feign.hystrix.HystrixFeign; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java index 1af56b3f6..7efb611a2 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; + import org.springframework.beans.factory.BeanFactory; /** diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java index 28b4d805f..81acda472 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import brave.http.HttpTracing; import feign.Client; import feign.Feign; import feign.okhttp.OkHttpClient; + import org.springframework.beans.factory.BeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java index d0eb6ace8..bafacb781 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java index 20fd3e278..0ac890ac1 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web.client.feign; import feign.Client; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.netflix.ribbon.SpringClientFactory; import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory; @@ -24,7 +25,7 @@ import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient; import org.springframework.util.ClassUtils; /** - * Class that wraps Feign related classes into their Trace representative + * Class that wraps Feign related classes into their Trace representative. * * @author Marcin Grzejszczak * @since 1.0.1 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java index b9d28e215..bb54dac20 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import feign.Request; import feign.Response; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.netflix.ribbon.SpringClientFactory; import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java index 4b64ff696..51db2d67f 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * Feign client wrapper + * Feign client wrapper. * * @author Marcin Grzejsczak * @since 2.0.0 @@ -97,8 +97,8 @@ final class TracingFeignClient implements Client { Response response = null; Throwable error = null; try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span)) { - return response = this.delegate.execute(modifiedRequest(request, headers), - options); + response = this.delegate.execute(modifiedRequest(request, headers), options); + return response; } catch (IOException | RuntimeException | Error e) { error = e; @@ -160,4 +160,4 @@ final class TracingFeignClient implements Client { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java index 545067a7a..d7fc7d3da 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,11 @@ import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.http.HttpStatus; /** - * A post request {@link ZuulFilter} + * A post request {@link ZuulFilter}. * * @author Dave Syer * @since 1.0.0 diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java index 86736c3ee..8bb7ce7ab 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.zuul; import brave.http.HttpTracing; import com.netflix.zuul.ZuulFilter; + import org.springframework.beans.factory.BeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java index 7f9a5d4bd..b7e6aa98c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.lang.invoke.MethodHandles; import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.BeanPostProcessor; @@ -39,7 +40,7 @@ class TraceZuulHandlerMappingBeanPostProcessor implements BeanPostProcessor { private final BeanFactory beanFactory; - public TraceZuulHandlerMappingBeanPostProcessor(BeanFactory beanFactory) { + TraceZuulHandlerMappingBeanPostProcessor(BeanFactory beanFactory) { this.beanFactory = beanFactory; } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java index f27e44991..091d9d21d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.log; import brave.propagation.CurrentTraceContext; import org.slf4j.MDC; + import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -43,7 +44,7 @@ import org.springframework.context.annotation.Configuration; public class SleuthLogAutoConfiguration { /** - * Configuration for Slfj4 + * Configuration for Slfj4. */ @Configuration @ConditionalOnClass(MDC.class) diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java index b4eccab3c..9781948c4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java index afb9af85e..29cb3ed0b 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,15 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext { private static final Logger log = LoggerFactory .getLogger(Slf4jCurrentTraceContext.class); + final CurrentTraceContext delegate; + + Slf4jCurrentTraceContext(CurrentTraceContext delegate) { + if (delegate == null) { + throw new NullPointerException("delegate == null"); + } + this.delegate = delegate; + } + public static Slf4jCurrentTraceContext create() { return create(CurrentTraceContext.Default.inheritable()); } @@ -62,13 +71,13 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext { return new Slf4jCurrentTraceContext(delegate); } - final CurrentTraceContext delegate; - - Slf4jCurrentTraceContext(CurrentTraceContext delegate) { - if (delegate == null) { - throw new NullPointerException("delegate == null"); + static void replace(String key, @Nullable String value) { + if (value != null) { + MDC.put(key, value); + } + else { + MDC.remove(key); } - this.delegate = delegate; } @Override @@ -155,13 +164,4 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext { } } - static void replace(String key, @Nullable String value) { - if (value != null) { - MDC.put(key, value); - } - else { - MDC.remove(key); - } - } - } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java index 4419b941b..806fb5552 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import brave.propagation.TraceContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; + import org.springframework.cloud.sleuth.autoconfig.SleuthProperties; import org.springframework.util.StringUtils; @@ -65,6 +66,15 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator { this.sleuthSlf4jProperties = sleuthSlf4jProperties; } + static void replace(String key, @Nullable String value) { + if (value != null) { + MDC.put(key, value); + } + else { + MDC.remove(key); + } + } + @Override public CurrentTraceContext.Scope decorateScope(TraceContext currentSpan, CurrentTraceContext.Scope scope) { @@ -181,13 +191,4 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator { } } - static void replace(String key, @Nullable String value) { - if (value != null) { - MDC.put(key, value); - } - else { - MDC.remove(key); - } - } - } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java index 7fb1d0108..88e524cf9 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.propagation; import brave.handler.FinishedSpanHandler; + import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -40,7 +41,7 @@ public class SleuthTagPropagationAutoConfiguration { protected static class TagPropagationConfiguration { @Bean - @ConditionalOnProperty(value = "spring.sleuth.propagation.tag.whitelisted-keys") + @ConditionalOnProperty("spring.sleuth.propagation.tag.whitelisted-keys") public FinishedSpanHandler finishedSpanHandler(SleuthProperties sleuthProperties, SleuthTagPropagationProperties tagPropagationProperties) { return new TagPropagationFinishedSpanHandler(sleuthProperties, diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java index c81319e90..43836a9d7 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java index a2e975c7d..938f016c0 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java index 3abdec633..94c911e5c 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,8 @@ import brave.sampler.Sampler; *

Implementation

* *

- * Taken from Zipkin - * project + * Taken from Zipkin project *

* *

@@ -58,31 +57,13 @@ public class ProbabilityBasedSampler extends Sampler { this.configuration = configuration; } - @Override - public boolean isSampled(long traceId) { - if (this.configuration.getProbability() == 0) { - return false; - } - else if (this.configuration.getProbability() == 1.0f) { - return true; - } - synchronized (this) { - final int i = this.counter.getAndIncrement(); - boolean result = this.sampleDecisions.get(i); - if (i == 99) { - this.counter.set(0); - } - return result; - } - } - /** * Reservoir sampling algorithm borrowed from Stack Overflow. * * http://stackoverflow.com/questions/12817946/generate-a-random-bitset-with-n-1s - * @param size - * @param cardinality - * @param rnd + * @param size size of the bit set + * @param cardinality cardinality of the bit set + * @param rnd random generator * @return a random bitset */ static BitSet randomBitSet(int size, int cardinality, Random rnd) { @@ -104,4 +85,22 @@ public class ProbabilityBasedSampler extends Sampler { return result; } + @Override + public boolean isSampled(long traceId) { + if (this.configuration.getProbability() == 0) { + return false; + } + else if (this.configuration.getProbability() == 1.0f) { + return true; + } + synchronized (this) { + final int i = this.counter.getAndIncrement(); + boolean result = this.sampleDecisions.get(i); + if (i == 99) { + this.counter.set(0); + } + return result; + } + } + } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java index b7c18c8da..288d8c3d8 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ class RateLimitingSampler extends Sampler { private final Sampler sampler; - public RateLimitingSampler(SamplerProperties configuration) { + RateLimitingSampler(SamplerProperties configuration) { this.sampler = brave.sampler.RateLimitingSampler.create(rateLimit(configuration)); } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java index 4e226a74f..267a7a4b9 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.sampler; import brave.sampler.Sampler; @@ -37,6 +38,13 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(SamplerProperties.class) public class SamplerAutoConfiguration { + static Sampler samplerFromProps(SamplerProperties config) { + if (config.getRate() != null) { + return new RateLimitingSampler(config); + } + return new ProbabilityBasedSampler(config); + } + @Configuration @ConditionalOnBean(type = "org.springframework.cloud.context.scope.refresh.RefreshScope") protected static class RefreshScopedSamplerConfiguration { @@ -62,11 +70,4 @@ public class SamplerAutoConfiguration { } - static Sampler samplerFromProps(SamplerProperties config) { - if (config.getRate() != null) { - return new RateLimitingSampler(config); - } - return new ProbabilityBasedSampler(config); - } - } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java index 07e78228f..fc21ef4bf 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java index 7b3d0e117..ff2d8f356 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java index 6bf043af1..0e4ad950f 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 63b54b3fa..8c3f68828 100644 --- a/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,56 +1,58 @@ -{"properties": [ - { - "name": "spring.sleuth.integration.enabled", - "type": "java.lang.Boolean", - "description": "Enable Spring Integration sleuth instrumentation.", - "defaultValue": true - }, - { - "name": "spring.sleuth.integration.websockets.enabled", - "type": "java.lang.Boolean", - "description": "Enable tracing for WebSockets.", - "defaultValue": true - }, - { - "name": "spring.sleuth.async.enabled", - "type": "java.lang.Boolean", - "description": "Enable instrumenting async related components so that the tracing information is passed between threads.", - "defaultValue": true - }, - { - "name": "spring.sleuth.async.configurer.enabled", - "type": "java.lang.Boolean", - "description": "Enable default AsyncConfigurer.", - "defaultValue": true - }, - { - "name": "spring.sleuth.hystrix.strategy.enabled", - "type": "java.lang.Boolean", - "description": "Enable custom HystrixConcurrencyStrategy that wraps all Callable instances into their Sleuth representative - the TraceCallable.", - "defaultValue": true - }, - { - "name": "spring.sleuth.feign.enabled", - "type": "java.lang.Boolean", - "description": "Enable span information propagation when using Feign.", - "defaultValue": true - }, - { - "name": "spring.sleuth.feign.processor.enabled", - "type": "java.lang.Boolean", - "description": "Enable post processor that wraps Feign Context in its tracing representations.", - "defaultValue": true - }, - { - "name": "spring.sleuth.zuul.enabled", - "type": "java.lang.Boolean", - "description": "Enable span information propagation when using Zuul.", - "defaultValue": true - }, - { - "name": "spring.sleuth.grpc.enabled", - "type": "java.lang.Boolean", - "description": "Enable span information propagation when using GRPC.", - "defaultValue": true - } -]} \ No newline at end of file +{ + "properties": [ + { + "name": "spring.sleuth.integration.enabled", + "type": "java.lang.Boolean", + "description": "Enable Spring Integration sleuth instrumentation.", + "defaultValue": true + }, + { + "name": "spring.sleuth.integration.websockets.enabled", + "type": "java.lang.Boolean", + "description": "Enable tracing for WebSockets.", + "defaultValue": true + }, + { + "name": "spring.sleuth.async.enabled", + "type": "java.lang.Boolean", + "description": "Enable instrumenting async related components so that the tracing information is passed between threads.", + "defaultValue": true + }, + { + "name": "spring.sleuth.async.configurer.enabled", + "type": "java.lang.Boolean", + "description": "Enable default AsyncConfigurer.", + "defaultValue": true + }, + { + "name": "spring.sleuth.hystrix.strategy.enabled", + "type": "java.lang.Boolean", + "description": "Enable custom HystrixConcurrencyStrategy that wraps all Callable instances into their Sleuth representative - the TraceCallable.", + "defaultValue": true + }, + { + "name": "spring.sleuth.feign.enabled", + "type": "java.lang.Boolean", + "description": "Enable span information propagation when using Feign.", + "defaultValue": true + }, + { + "name": "spring.sleuth.feign.processor.enabled", + "type": "java.lang.Boolean", + "description": "Enable post processor that wraps Feign Context in its tracing representations.", + "defaultValue": true + }, + { + "name": "spring.sleuth.zuul.enabled", + "type": "java.lang.Boolean", + "description": "Enable span information propagation when using Zuul.", + "defaultValue": true + }, + { + "name": "spring.sleuth.grpc.enabled", + "type": "java.lang.Boolean", + "description": "Enable span information propagation when using GRPC.", + "defaultValue": true + } + ] +} diff --git a/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories b/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories index 28f45d8c5..db0e76446 100644 --- a/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories +++ b/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories @@ -25,7 +25,6 @@ org.springframework.cloud.sleuth.instrument.messaging.TraceMessagingAutoConfigur org.springframework.cloud.sleuth.instrument.messaging.TraceSpringIntegrationAutoConfiguration,\ org.springframework.cloud.sleuth.instrument.messaging.websocket.TraceWebSocketAutoConfiguration,\ org.springframework.cloud.sleuth.instrument.opentracing.OpentracingAutoConfiguration - # Environment Post Processor org.springframework.boot.env.EnvironmentPostProcessor=\ org.springframework.cloud.sleuth.autoconfig.TraceEnvironmentPostProcessor diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java index 59dc47460..176500829 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java index fd3d579d8..b59a29dd3 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java index 417bbf8a6..a168644ed 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,8 @@ import brave.sampler.Sampler; import org.assertj.core.api.BDDAssertions; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration; @@ -33,13 +35,14 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.junit4.SpringRunner; -import zipkin2.reporter.Reporter; + +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE; /** * @author Marcin Grzejszczak */ @RunWith(SpringRunner.class) -@SpringBootTest(classes = FinishedSpanHandlerTests.FinishedSpanHandlerAspectTestsConfig.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) +@SpringBootTest(classes = FinishedSpanHandlerTests.FinishedSpanHandlerAspectTestsConfig.class, webEnvironment = NONE) public class FinishedSpanHandlerTests { @Autowired @@ -98,4 +101,4 @@ public class FinishedSpanHandlerTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java index d395bce77..fe9eb2289 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,4 +32,4 @@ public class PermitAllServletConfiguration extends WebSecurityConfigurerAdapter http.authorizeRequests().antMatchers("/*").permitAll(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java index 0c4e8b10c..30526b3dd 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,4 +31,4 @@ public class PermitAllWebFluxSecurityConfiguration { .build(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java index f6125e883..c7bc2b733 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java index e1ad49ede..cbd4389ec 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import brave.sampler.Sampler; import org.assertj.core.api.BDDAssertions; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration; @@ -30,7 +32,6 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.junit4.SpringRunner; -import zipkin2.reporter.Reporter; /** * @author Marcin Grzejszczak @@ -83,4 +84,4 @@ public class SpanAdjusterTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java index aa7dd19f6..f5ace13df 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,4 +30,4 @@ public class NoOpTagValueResolverTests { then(new NoOpTagValueResolver().resolve("")).isNull(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java index d49986b67..1c165f20e 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.annotation; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java index 33ae0d816..47437c866 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.annotation; import brave.Tracing; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java index 720331509..d15b80cdf 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,6 +62,25 @@ public class SleuthSpanCreatorAspectFluxTests { @Autowired ArrayListSpanReporter reporter; + private static String toHexString(Long value) { + then(value).isNotNull(); + return StringUtils.leftPad(Long.toHexString(value), 16, '0'); + } + + protected static Long id(Tracer tracer) { + if (tracer.currentSpan() == null) { + throw new IllegalStateException("Current Span is supposed to have a value!"); + } + return tracer.currentSpan().context().spanId(); + } + + protected static Long id(Context context, Tracer tracer) { + if (context.hasKey(Span.class)) { + return context.get(Span.class).context().spanId(); + } + return id(tracer); + } + @Before public void setup() { this.reporter.clear(); @@ -388,11 +407,6 @@ public class SleuthSpanCreatorAspectFluxTests { }); } - private static String toHexString(Long value) { - then(value).isNotNull(); - return StringUtils.leftPad(Long.toHexString(value), 16, '0'); - } - private void verifyNoSpansUntilFluxComplete(Flux flux) { Iterator iterator = flux.toIterable().iterator(); @@ -442,7 +456,7 @@ public class SleuthSpanCreatorAspectFluxTests { Flux testMethod9(String param); @ContinueSpan(log = "customTest") - Flux testMethod10(@SpanTag(value = "testTag10") String param); + Flux testMethod10(@SpanTag("testTag10") String param); @ContinueSpan(log = "customTest") Flux testMethod10_v2(@SpanTag(key = "testTag10") String param); @@ -554,8 +568,7 @@ public class SleuthSpanCreatorAspectFluxTests { } @Override - public Flux testMethod10( - @SpanTag(value = "customTestTag10") String param) { + public Flux testMethod10(@SpanTag("customTestTag10") String param) { return this.testFlux; } @@ -601,20 +614,6 @@ public class SleuthSpanCreatorAspectFluxTests { } - protected static Long id(Tracer tracer) { - if (tracer.currentSpan() == null) { - throw new IllegalStateException("Current Span is supposed to have a value!"); - } - return tracer.currentSpan().context().spanId(); - } - - protected static Long id(Context context, Tracer tracer) { - if (context.hasKey(Span.class)) { - return context.get(Span.class).context().spanId(); - } - return id(tracer); - } - @Configuration @EnableAutoConfiguration protected static class TestConfiguration { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java index 027133e3f..b5107f6ed 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,6 +64,17 @@ public class SleuthSpanCreatorAspectMonoTests { @Autowired ArrayListSpanReporter reporter; + private static String toHexString(long value) { + return StringUtils.leftPad(Long.toHexString(value), 16, '0'); + } + + protected static Long id(Tracer tracer) { + if (tracer.currentSpan() == null) { + throw new IllegalStateException("Current Span is supposed to have a value!"); + } + return tracer.currentSpan().context().spanId(); + } + @Before public void setup() { this.reporter.clear(); @@ -467,10 +478,6 @@ public class SleuthSpanCreatorAspectMonoTests { }); } - private static String toHexString(long value) { - return StringUtils.leftPad(Long.toHexString(value), 16, '0'); - } - protected interface TestBeanInterface { // tag::annotated_method[] @@ -504,7 +511,7 @@ public class SleuthSpanCreatorAspectMonoTests { Mono testMethod9(String param); @ContinueSpan(log = "customTest") - Mono testMethod10(@SpanTag(value = "testTag10") String param); + Mono testMethod10(@SpanTag("testTag10") String param); @ContinueSpan(log = "customTest") Mono testMethod10_v2(@SpanTag(key = "testTag10") String param); @@ -592,8 +599,7 @@ public class SleuthSpanCreatorAspectMonoTests { } @Override - public Mono testMethod10( - @SpanTag(value = "customTestTag10") String param) { + public Mono testMethod10(@SpanTag("customTestTag10") String param) { return TEST_MONO; } @@ -664,13 +670,6 @@ public class SleuthSpanCreatorAspectMonoTests { } - protected static Long id(Tracer tracer) { - if (tracer.currentSpan() == null) { - throw new IllegalStateException("Current Span is supposed to have a value!"); - } - return tracer.currentSpan().context().spanId(); - } - @Configuration @EnableAutoConfiguration protected static class TestConfiguration { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java index 27af6fccd..84a2cc290 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,12 @@ package org.springframework.cloud.sleuth.annotation; import java.util.List; import brave.sampler.Sampler; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -74,14 +75,6 @@ public class SleuthSpanCreatorAspectNegativeTests { } - protected static class NotAnnotatedTestBean implements NotAnnotatedTestBeanInterface { - - @Override - public void testMethod() { - } - - } - protected interface TestBeanInterface { @NewSpan @@ -103,6 +96,14 @@ public class SleuthSpanCreatorAspectNegativeTests { } + protected static class NotAnnotatedTestBean implements NotAnnotatedTestBeanInterface { + + @Override + public void testMethod() { + } + + } + protected static class TestBean implements TestBeanInterface { @Override diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java index 0212fe4f3..ee76c08fb 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,12 @@ import java.util.stream.Collectors; import brave.Span; import brave.Tracer; import brave.sampler.Sampler; -import zipkin2.Annotation; -import zipkin2.reporter.Reporter; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Annotation; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -322,10 +323,10 @@ public class SleuthSpanCreatorAspectTests { void testMethod9(String param); @ContinueSpan(log = "customTest") - void testMethod10(@SpanTag(value = "testTag10") String param); + void testMethod10(@SpanTag("testTag10") String param); @ContinueSpan(log = "customTest") - void testMethod10_v2(@SpanTag(key = "testTag10") String param); + void testMethod10_v2(@SpanTag("testTag10") String param); // tag::continue_span[] @ContinueSpan(log = "testMethod11") @@ -388,7 +389,7 @@ public class SleuthSpanCreatorAspectTests { } @Override - public void testMethod10(@SpanTag(value = "customTestTag10") String param) { + public void testMethod10(@SpanTag("customTestTag10") String param) { } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java index b1c8cf4a2..34e97b006 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.annotation; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -78,4 +80,4 @@ public class SleuthSpanCreatorCircularDependencyTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java index 94a613f97..f4b21ece6 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import brave.sampler.Sampler; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -99,6 +100,24 @@ public class SpanTagAnnotationHandlerTests { } } + @Configuration + @EnableAutoConfiguration + protected static class TestConfiguration { + + // tag::custom_resolver[] + @Bean(name = "myCustomTagValueResolver") + public TagValueResolver tagValueResolver() { + return parameter -> "Value from myCustomTagValueResolver"; + } + // end::custom_resolver[] + + @Bean + Sampler alwaysSampler() { + return Sampler.ALWAYS_SAMPLE; + } + + } + protected class AnnotationMockClass { // tag::resolver_bean[] @@ -123,22 +142,4 @@ public class SpanTagAnnotationHandlerTests { } - @Configuration - @EnableAutoConfiguration - protected static class TestConfiguration { - - // tag::custom_resolver[] - @Bean(name = "myCustomTagValueResolver") - public TagValueResolver tagValueResolver() { - return parameter -> "Value from myCustomTagValueResolver"; - } - // end::custom_resolver[] - - @Bean - Sampler alwaysSampler() { - return Sampler.ALWAYS_SAMPLE; - } - - } - } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java index 3f36324b9..dee3fd7cf 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,12 +36,6 @@ public class SpelTagValueExpressionResolverTests { then(resolved).isEqualTo("hello world"); } - public static class MyObject { - - public String name; - - } - @Test public void should_use_to_string_if_expression_is_not_analyzed_properly() throws Exception { @@ -52,6 +46,12 @@ public class SpelTagValueExpressionResolverTests { then(resolved).isEqualTo("BAR"); } + public static class MyObject { + + public String name; + + } + } class Foo { @@ -61,4 +61,4 @@ class Foo { return "BAR"; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java index a6a373575..b60220651 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.autoconfig; import brave.propagation.B3Propagation; @@ -6,6 +22,7 @@ import brave.propagation.ExtraFieldPropagation; import brave.propagation.Propagation; import org.assertj.core.api.BDDAssertions; import org.junit.Test; + import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java index e3c6db5b5..b72ca5e08 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.autoconfig; import java.security.SecureRandom; @@ -24,6 +25,7 @@ import org.assertj.core.api.BDDAssertions; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java index bbadd7fc6..d28a05587 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import brave.sampler.Sampler; import org.assertj.core.api.BDDAssertions; import org.junit.Before; import org.junit.Test; + import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanName; import org.springframework.cloud.sleuth.SpanNamer; @@ -46,7 +47,7 @@ import static org.assertj.core.api.BDDAssertions.then; /** * Test class to be embedded in the - * {@code docs/src/main/asciidoc/spring-cloud-sleuth.adoc} file + * {@code docs/src/main/asciidoc/spring-cloud-sleuth.adoc} file. * * @author Marcin Grzejszczak */ @@ -66,30 +67,6 @@ public class SpringCloudSleuthDocTests { this.reporter.clear(); } - @Configuration - public class SamplingConfiguration { - - // tag::always_sampler[] - @Bean - public Sampler defaultSampler() { - return Sampler.ALWAYS_SAMPLE; - } - // end::always_sampler[] - - } - - // tag::span_name_annotation[] - @SpanName("calculateTax") - class TaxCountingRunnable implements Runnable { - - @Override - public void run() { - // perform logic - } - - } - // end::span_name_annotation[] - @Test public void should_set_runnable_name_to_annotated_value() throws ExecutionException, InterruptedException { @@ -137,6 +114,7 @@ public class SpringCloudSleuthDocTests { then(spans.get(0).name()).isEqualTo("calculatetax"); executorService.shutdown(); } + // end::span_name_annotation[] @Test public void should_create_a_span_with_tracer() { @@ -305,4 +283,27 @@ public class SpringCloudSleuthDocTests { return "some logic"; } + @Configuration + public class SamplingConfiguration { + + // tag::always_sampler[] + @Bean + public Sampler defaultSampler() { + return Sampler.ALWAYS_SAMPLE; + } + // end::always_sampler[] + + } + + // tag::span_name_annotation[] + @SpanName("calculateTax") + class TaxCountingRunnable implements Runnable { + + @Override + public void run() { + // perform logic + } + + } + } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java index 652dfc9ec..38ac509dc 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java index 523ddd2c6..bedb92092 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.async; import org.junit.Test; + import org.springframework.scheduling.annotation.AsyncConfigurer; import static org.assertj.core.api.BDDAssertions.then; @@ -48,4 +49,4 @@ public class AsyncCustomAutoConfigurationTest { then(bean).isInstanceOf(LazyTraceAsyncCustomizer.class); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java index 5c9905470..bfaee0a31 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java @@ -13,15 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.instrument.async; import org.springframework.beans.factory.BeanFactory; -public class ContextRefreshedListenerAccessor { +public final class ContextRefreshedListenerAccessor { + + private ContextRefreshedListenerAccessor() { + throw new IllegalStateException("Can't instantiate a utility class"); + } public static void set(BeanFactory beanFactory, boolean refreshed) { ContextRefreshedListener.CACHE.put(beanFactory, new ContextRefreshedListener(refreshed)); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java index 138c2583f..2b473adb8 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,15 +85,6 @@ public class ExecutorBeanPostProcessorTests { then(ClassUtils.isCglibProxy(o)).isTrue(); } - class Foo implements Executor { - - @Override - public void execute(Runnable command) { - - } - - } - @Test public void should_fallback_to_sleuth_implementation_when_cglib_cannot_be_created() throws Exception { @@ -135,10 +126,6 @@ public class ExecutorBeanPostProcessorTests { then(ClassUtils.isCglibProxy(o)).isTrue(); } - class FooThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { - - } - @Test public void should_throw_exception_when_it_is_not_possible_to_create_any_proxy_for_ThreadPoolTaskExecutor() throws Exception { @@ -302,6 +289,19 @@ public class ExecutorBeanPostProcessorTests { })).isInstanceOf(RejectedExecutionException.class).hasMessage("rejected"); } + class Foo implements Executor { + + @Override + public void execute(Runnable command) { + + } + + } + + class FooThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { + + } + class RejectedExecutionExecutor implements Executor { @Override @@ -311,4 +311,4 @@ public class ExecutorBeanPostProcessorTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java index c6fc6f8b8..338b612db 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.scheduling.annotation.AsyncConfigurer; import static org.assertj.core.api.BDDAssertions.then; @@ -50,4 +51,4 @@ public class LazyTraceAsyncCustomizerTest { then(executor).isExactlyInstanceOf(LazyTraceExecutor.class); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java index 29648f764..07507096c 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.async; import brave.Tracing; @@ -10,6 +26,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.BDDMockito; import org.mockito.Mockito; + import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -55,4 +72,4 @@ public class TraceAsyncAspectTest { BDDAssertions.then(this.reporter.getSpans().get(0).timestamp()).isPositive(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java index def16c789..b2e073acf 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java @@ -1,6 +1,5 @@ - /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +28,7 @@ import org.awaitility.Awaitility; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.sleuth.SpanName; @@ -211,10 +211,10 @@ public class TraceAsyncIntegrationTests { static class ClassPerformingAsyncLogic { - AtomicReference span = new AtomicReference<>(); - private final Tracer tracer; + AtomicReference span = new AtomicReference<>(); + ClassPerformingAsyncLogic(Tracer tracer) { this.tracer = tracer; } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java index ce1f3a399..d717b413d 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import brave.propagation.ThreadLocalCurrentTraceContext; import org.assertj.core.api.BDDAssertions; import org.awaitility.Awaitility; import org.junit.Test; + import org.springframework.core.task.AsyncListenableTaskExecutor; import org.springframework.core.task.SimpleAsyncTaskExecutor; @@ -161,4 +162,4 @@ public class TraceAsyncListenableTaskExecutorTest { return () -> tracing.tracer().currentSpan(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java index c38a5aab6..4e6e8c0c8 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanName; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -162,4 +163,4 @@ public class TraceCallableTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java index 29207c411..5c6dabe48 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanName; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -170,4 +171,4 @@ public class TraceRunnableTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java index b75696bbb..9951d5131 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ import org.mockito.BDDMockito; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanNamer; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java index 2fdf8364c..f46eeae02 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import org.mockito.BDDMockito; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.sleuth.DefaultSpanNamer; import org.springframework.cloud.sleuth.SpanNamer; @@ -184,4 +185,4 @@ public class TraceableScheduledExecutorServiceTest { return this.beanFactory; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java index 79d0c875d..ec8dec6a8 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.awaitility.Awaitility; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -76,7 +77,7 @@ public class Issue410Tests { RestTemplate restTemplate; /** - * Related to issue #445 + * Related to issue #445. */ @Autowired Application.MyService executorService; @@ -126,7 +127,7 @@ public class Issue410Tests { } /** - * Related to issue #423 + * Related to issue #423. */ @Test public void should_pass_tracing_info_for_completable_futures_with_executor() { @@ -151,7 +152,7 @@ public class Issue410Tests { } /** - * Related to issue #423 + * Related to issue #423. */ @Test public void should_pass_tracing_info_for_completable_futures_with_task_scheduler() { @@ -209,8 +210,6 @@ class AsyncTask { private static final Log log = LogFactory.getLog(AsyncTask.class); - private AtomicReference span = new AtomicReference<>(); - @Autowired Tracer tracer; @@ -225,6 +224,8 @@ class AsyncTask { @Autowired BeanFactory beanFactory; + private AtomicReference span = new AtomicReference<>(); + @Async("poolTaskExecutor") public void runWithPool() { log.info("This task is running with a pool."); @@ -335,7 +336,8 @@ class Application { } /** - * Related to issue #445 + * Related to issue #445. + * @return service bean */ @Bean public MyService executorService() { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java index 21555fc30..7c7763e57 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -85,21 +86,21 @@ class Controller { private final Tracing tracer; - public Controller(AsyncRestTemplate traceAsyncRestTemplate, Tracing tracer) { + @Value("${server.port}") + private String port; + + Controller(AsyncRestTemplate traceAsyncRestTemplate, Tracing tracer) { this.traceAsyncRestTemplate = traceAsyncRestTemplate; this.tracer = tracer; } - @Value("${server.port}") - private String port; - - @RequestMapping(value = "/bean") + @RequestMapping("/bean") public HogeBean bean() { log.info("(/bean) I got a request!"); return new HogeBean("test", 18); } - @RequestMapping(value = "/trace-async-rest-template") + @RequestMapping("/trace-async-rest-template") public void asyncTest(@RequestParam(required = false) boolean isSleep) throws InterruptedException { log.info("(/trace-async-rest-template) I got a request!"); @@ -132,7 +133,7 @@ class HogeBean { private int age; - public HogeBean(String name, int age) { + HogeBean(String name, int age) { this.name = name; this.age = age; } @@ -153,4 +154,4 @@ class HogeBean { this.age = age; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java index 46f3a006d..8a0e7198d 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat; * This class uses stubs and skeletons that were generated originally by the gRPC maven * plugin and copied into a "stubs" sub-package. * - * @author tyler.vangorder + * @author Tyler Van Gorder */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = GrpcTracingIntegrationTests.TestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { @@ -123,6 +123,12 @@ public class GrpcTracingIntegrationTests { assertThat(clientInterceptors).hasSize(1); } + public interface HelloServiceClient { + + String sayHello(String name) throws Exception; + + } + @Configuration @EnableAutoConfiguration @Import(HelloGrpcService.class) @@ -172,12 +178,6 @@ public class GrpcTracingIntegrationTests { } - public static interface HelloServiceClient { - - String sayHello(String name) throws Exception; - - } - public static class HelloServiceGrpcClient implements HelloServiceClient { private ManagedChannel managedChannel; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java index 6e3968e58..0d6d64632 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 the original author or authors. + * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,17 +18,41 @@ package org.springframework.cloud.sleuth.instrument.grpc.stubs; /** *

- * The response message containing the greetings
+ * The response message containing the greetings.
  * 
* * Protobuf type {@code HelloReply} + * + * @author Tyler Van Gorder */ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:HelloReply) HelloReplyOrBuilder { + public static final int MESSAGE_FIELD_NUMBER = 1; + private static final long serialVersionUID = 0L; + // @@protoc_insertion_point(class_scope:HelloReply) + private static final HelloReply DEFAULT_INSTANCE; + + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @Override + public HelloReply parsePartialFrom(com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HelloReply(input, extensionRegistry); + } + }; + + static { + DEFAULT_INSTANCE = new HelloReply(); + } + + private volatile java.lang.Object message_; + + private byte memoizedIsInitialized = -1; + // Use HelloReply.newBuilder() to construct. private HelloReply(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); @@ -38,11 +62,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp this.message_ = ""; } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - private HelloReply(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -61,20 +80,17 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp case 0: done = true; break; - default: { + default: if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } break; - } - case 10: { - java.lang.String s = input.readStringRequireUtf8(); - + case 10: + String s = input.readStringRequireUtf8(); this.message_ = s; break; } - } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -94,123 +110,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor; } - @Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable - .ensureFieldAccessorsInitialized(HelloReply.class, - HelloReply.Builder.class); - } - - public static final int MESSAGE_FIELD_NUMBER = 1; - - private volatile java.lang.Object message_; - - /** - * string message = 1; - */ - @Override - public java.lang.String getMessage() { - java.lang.Object ref = this.message_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } - else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - this.message_ = s; - return s; - } - } - - /** - * string message = 1; - */ - @Override - public com.google.protobuf.ByteString getMessageBytes() { - java.lang.Object ref = this.message_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString - .copyFromUtf8((java.lang.String) ref); - this.message_ = b; - return b; - } - else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @Override - public final boolean isInitialized() { - byte isInitialized = this.memoizedIsInitialized; - if (isInitialized == 1) { - return true; - } - if (isInitialized == 0) { - return false; - } - - this.memoizedIsInitialized = 1; - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getMessageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.message_); - } - this.unknownFields.writeTo(output); - } - - @Override - public int getSerializedSize() { - int size = this.memoizedSize; - if (size != -1) { - return size; - } - - size = 0; - if (!getMessageBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, - this.message_); - } - size += this.unknownFields.getSerializedSize(); - this.memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof HelloReply)) { - return super.equals(obj); - } - HelloReply other = (HelloReply) obj; - - boolean result = true; - result = result && getMessage().equals(other.getMessage()); - result = result && this.unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (this.memoizedHashCode != 0) { - return this.memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + MESSAGE_FIELD_NUMBER; - hash = (53 * hash) + getMessage().hashCode(); - hash = (29 * hash) + this.unknownFields.hashCode(); - this.memoizedHashCode = hash; - return hash; - } - public static HelloReply parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); @@ -281,11 +180,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp extensionRegistry); } - @Override - public Builder newBuilderForType() { - return newBuilder(); - } - public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } @@ -294,6 +188,135 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + public static HelloReply getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + @Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { + return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable + .ensureFieldAccessorsInitialized(HelloReply.class, + HelloReply.Builder.class); + } + + /** + * string message = 1; + */ + @Override + public java.lang.String getMessage() { + java.lang.Object ref = this.message_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } + else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + this.message_ = s; + return s; + } + } + + /** + * string message = 1; + */ + @Override + public com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = this.message_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = com.google.protobuf.ByteString + .copyFromUtf8((java.lang.String) ref); + this.message_ = b; + return b; + } + else { + return (com.google.protobuf.ByteString) ref; + } + } + + @Override + public final boolean isInitialized() { + byte isInitialized = this.memoizedIsInitialized; + if (isInitialized == 1) { + return true; + } + if (isInitialized == 0) { + return false; + } + + this.memoizedIsInitialized = 1; + return true; + } + + @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.message_); + } + this.unknownFields.writeTo(output); + } + + @Override + public int getSerializedSize() { + int size = this.memoizedSize; + if (size != -1) { + return size; + } + + size = 0; + if (!getMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, + this.message_); + } + size += this.unknownFields.getSerializedSize(); + this.memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof HelloReply)) { + return super.equals(obj); + } + HelloReply other = (HelloReply) obj; + + boolean result = true; + result = result && getMessage().equals(other.getMessage()); + result = result && this.unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (this.memoizedHashCode != 0) { + return this.memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getMessage().hashCode(); + hash = (29 * hash) + this.unknownFields.hashCode(); + this.memoizedHashCode = hash; + return hash; + } + + @Override + public Builder newBuilderForType() { + return newBuilder(); + } + @Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -306,6 +329,16 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp return builder; } + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @Override + public HelloReply getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + /** *
 	 * The response message containing the greetings
@@ -318,16 +351,7 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 			// @@protoc_insertion_point(builder_implements:HelloReply)
 			HelloReplyOrBuilder {
 
-		public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
-			return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor;
-		}
-
-		@Override
-		protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
-			return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
-					.ensureFieldAccessorsInitialized(HelloReply.class,
-							HelloReply.Builder.class);
-		}
+		private java.lang.Object message_ = "";
 
 		// Construct using HelloReply.newBuilder()
 		private Builder() {
@@ -339,6 +363,17 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 			maybeForceBuilderInitialization();
 		}
 
+		public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+			return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor;
+		}
+
+		@Override
+		protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+			return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
+					.ensureFieldAccessorsInitialized(HelloReply.class,
+							HelloReply.Builder.class);
+		}
+
 		private void maybeForceBuilderInitialization() {
 			if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
 			}
@@ -463,8 +498,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 			return this;
 		}
 
-		private java.lang.Object message_ = "";
-
 		/**
 		 * string message = 1;
 		 */
@@ -482,6 +515,19 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 			}
 		}
 
+		/**
+		 * string message = 1;
+		 */
+		public Builder setMessage(java.lang.String value) {
+			if (value == null) {
+				throw new NullPointerException();
+			}
+
+			this.message_ = value;
+			onChanged();
+			return this;
+		}
+
 		/**
 		 * string message = 1;
 		 */
@@ -502,10 +548,11 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 		/**
 		 * string message = 1;
 		 */
-		public Builder setMessage(java.lang.String value) {
+		public Builder setMessageBytes(com.google.protobuf.ByteString value) {
 			if (value == null) {
 				throw new NullPointerException();
 			}
+			checkByteStringIsUtf8(value);
 
 			this.message_ = value;
 			onChanged();
@@ -522,20 +569,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 			return this;
 		}
 
-		/**
-		 * string message = 1;
-		 */
-		public Builder setMessageBytes(com.google.protobuf.ByteString value) {
-			if (value == null) {
-				throw new NullPointerException();
-			}
-			checkByteStringIsUtf8(value);
-
-			this.message_ = value;
-			onChanged();
-			return this;
-		}
-
 		@Override
 		public final Builder setUnknownFields(
 				final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -552,37 +585,4 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
 
 	}
 
-	// @@protoc_insertion_point(class_scope:HelloReply)
-	private static final HelloReply DEFAULT_INSTANCE;
-	static {
-		DEFAULT_INSTANCE = new HelloReply();
-	}
-
-	public static HelloReply getDefaultInstance() {
-		return DEFAULT_INSTANCE;
-	}
-
-	private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
-		@Override
-		public HelloReply parsePartialFrom(com.google.protobuf.CodedInputStream input,
-				com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-				throws com.google.protobuf.InvalidProtocolBufferException {
-			return new HelloReply(input, extensionRegistry);
-		}
-	};
-
-	public static com.google.protobuf.Parser parser() {
-		return PARSER;
-	}
-
-	@java.lang.Override
-	public com.google.protobuf.Parser getParserForType() {
-		return PARSER;
-	}
-
-	@Override
-	public HelloReply getDefaultInstanceForType() {
-		return DEFAULT_INSTANCE;
-	}
-
 }
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
index 71f62c257..a06a65cae 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
index 4384dd4f0..ed55091e6 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,8 +27,30 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		// @@protoc_insertion_point(message_implements:HelloRequest)
 		HelloRequestOrBuilder {
 
+	public static final int NAME_FIELD_NUMBER = 1;
+
 	private static final long serialVersionUID = 0L;
 
+	// @@protoc_insertion_point(class_scope:HelloRequest)
+	private static final HelloRequest DEFAULT_INSTANCE;
+
+	private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
+		@Override
+		public HelloRequest parsePartialFrom(com.google.protobuf.CodedInputStream input,
+				com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+				throws com.google.protobuf.InvalidProtocolBufferException {
+			return new HelloRequest(input, extensionRegistry);
+		}
+	};
+
+	static {
+		DEFAULT_INSTANCE = new HelloRequest();
+	}
+
+	private volatile java.lang.Object name_;
+
+	private byte memoizedIsInitialized = -1;
+
 	// Use HelloRequest.newBuilder() to construct.
 	private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) {
 		super(builder);
@@ -38,11 +60,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		this.name_ = "";
 	}
 
-	@java.lang.Override
-	public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
-		return this.unknownFields;
-	}
-
 	private HelloRequest(com.google.protobuf.CodedInputStream input,
 			com.google.protobuf.ExtensionRegistryLite extensionRegistry)
 			throws com.google.protobuf.InvalidProtocolBufferException {
@@ -61,20 +78,18 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 				case 0:
 					done = true;
 					break;
-				default: {
+				default:
 					if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry,
 							tag)) {
 						done = true;
 					}
 					break;
-				}
-				case 10: {
-					java.lang.String s = input.readStringRequireUtf8();
+				case 10:
+					String s = input.readStringRequireUtf8();
 
 					this.name_ = s;
 					break;
 				}
-				}
 			}
 		}
 		catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -94,123 +109,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
 	}
 
-	@Override
-	protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
-		return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
-				.ensureFieldAccessorsInitialized(HelloRequest.class,
-						HelloRequest.Builder.class);
-	}
-
-	public static final int NAME_FIELD_NUMBER = 1;
-
-	private volatile java.lang.Object name_;
-
-	/**
-	 * string name = 1;
-	 */
-	@Override
-	public java.lang.String getName() {
-		java.lang.Object ref = this.name_;
-		if (ref instanceof java.lang.String) {
-			return (java.lang.String) ref;
-		}
-		else {
-			com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
-			java.lang.String s = bs.toStringUtf8();
-			this.name_ = s;
-			return s;
-		}
-	}
-
-	/**
-	 * string name = 1;
-	 */
-	@Override
-	public com.google.protobuf.ByteString getNameBytes() {
-		java.lang.Object ref = this.name_;
-		if (ref instanceof java.lang.String) {
-			com.google.protobuf.ByteString b = com.google.protobuf.ByteString
-					.copyFromUtf8((java.lang.String) ref);
-			this.name_ = b;
-			return b;
-		}
-		else {
-			return (com.google.protobuf.ByteString) ref;
-		}
-	}
-
-	private byte memoizedIsInitialized = -1;
-
-	@Override
-	public final boolean isInitialized() {
-		byte isInitialized = this.memoizedIsInitialized;
-		if (isInitialized == 1) {
-			return true;
-		}
-		if (isInitialized == 0) {
-			return false;
-		}
-
-		this.memoizedIsInitialized = 1;
-		return true;
-	}
-
-	@Override
-	public void writeTo(com.google.protobuf.CodedOutputStream output)
-			throws java.io.IOException {
-		if (!getNameBytes().isEmpty()) {
-			com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.name_);
-		}
-		this.unknownFields.writeTo(output);
-	}
-
-	@Override
-	public int getSerializedSize() {
-		int size = this.memoizedSize;
-		if (size != -1) {
-			return size;
-		}
-
-		size = 0;
-		if (!getNameBytes().isEmpty()) {
-			size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
-					this.name_);
-		}
-		size += this.unknownFields.getSerializedSize();
-		this.memoizedSize = size;
-		return size;
-	}
-
-	@java.lang.Override
-	public boolean equals(final java.lang.Object obj) {
-		if (obj == this) {
-			return true;
-		}
-		if (!(obj instanceof HelloRequest)) {
-			return super.equals(obj);
-		}
-		HelloRequest other = (HelloRequest) obj;
-
-		boolean result = true;
-		result = result && getName().equals(other.getName());
-		result = result && this.unknownFields.equals(other.unknownFields);
-		return result;
-	}
-
-	@java.lang.Override
-	public int hashCode() {
-		if (this.memoizedHashCode != 0) {
-			return this.memoizedHashCode;
-		}
-		int hash = 41;
-		hash = (19 * hash) + getDescriptor().hashCode();
-		hash = (37 * hash) + NAME_FIELD_NUMBER;
-		hash = (53 * hash) + getName().hashCode();
-		hash = (29 * hash) + this.unknownFields.hashCode();
-		this.memoizedHashCode = hash;
-		return hash;
-	}
-
 	public static HelloRequest parseFrom(java.nio.ByteBuffer data)
 			throws com.google.protobuf.InvalidProtocolBufferException {
 		return PARSER.parseFrom(data);
@@ -281,11 +179,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 				extensionRegistry);
 	}
 
-	@Override
-	public Builder newBuilderForType() {
-		return newBuilder();
-	}
-
 	public static Builder newBuilder() {
 		return DEFAULT_INSTANCE.toBuilder();
 	}
@@ -294,6 +187,135 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
 	}
 
+	public static HelloRequest getDefaultInstance() {
+		return DEFAULT_INSTANCE;
+	}
+
+	public static com.google.protobuf.Parser parser() {
+		return PARSER;
+	}
+
+	@java.lang.Override
+	public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
+		return this.unknownFields;
+	}
+
+	@Override
+	protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+		return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
+				.ensureFieldAccessorsInitialized(HelloRequest.class,
+						HelloRequest.Builder.class);
+	}
+
+	/**
+	 * string name = 1;
+	 */
+	@Override
+	public java.lang.String getName() {
+		java.lang.Object ref = this.name_;
+		if (ref instanceof java.lang.String) {
+			return (java.lang.String) ref;
+		}
+		else {
+			com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+			java.lang.String s = bs.toStringUtf8();
+			this.name_ = s;
+			return s;
+		}
+	}
+
+	/**
+	 * string name = 1;
+	 */
+	@Override
+	public com.google.protobuf.ByteString getNameBytes() {
+		java.lang.Object ref = this.name_;
+		if (ref instanceof java.lang.String) {
+			com.google.protobuf.ByteString b = com.google.protobuf.ByteString
+					.copyFromUtf8((java.lang.String) ref);
+			this.name_ = b;
+			return b;
+		}
+		else {
+			return (com.google.protobuf.ByteString) ref;
+		}
+	}
+
+	@Override
+	public final boolean isInitialized() {
+		byte isInitialized = this.memoizedIsInitialized;
+		if (isInitialized == 1) {
+			return true;
+		}
+		if (isInitialized == 0) {
+			return false;
+		}
+
+		this.memoizedIsInitialized = 1;
+		return true;
+	}
+
+	@Override
+	public void writeTo(com.google.protobuf.CodedOutputStream output)
+			throws java.io.IOException {
+		if (!getNameBytes().isEmpty()) {
+			com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.name_);
+		}
+		this.unknownFields.writeTo(output);
+	}
+
+	@Override
+	public int getSerializedSize() {
+		int size = this.memoizedSize;
+		if (size != -1) {
+			return size;
+		}
+
+		size = 0;
+		if (!getNameBytes().isEmpty()) {
+			size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
+					this.name_);
+		}
+		size += this.unknownFields.getSerializedSize();
+		this.memoizedSize = size;
+		return size;
+	}
+
+	@java.lang.Override
+	public boolean equals(final java.lang.Object obj) {
+		if (obj == this) {
+			return true;
+		}
+		if (!(obj instanceof HelloRequest)) {
+			return super.equals(obj);
+		}
+		HelloRequest other = (HelloRequest) obj;
+
+		boolean result = true;
+		result = result && getName().equals(other.getName());
+		result = result && this.unknownFields.equals(other.unknownFields);
+		return result;
+	}
+
+	@java.lang.Override
+	public int hashCode() {
+		if (this.memoizedHashCode != 0) {
+			return this.memoizedHashCode;
+		}
+		int hash = 41;
+		hash = (19 * hash) + getDescriptor().hashCode();
+		hash = (37 * hash) + NAME_FIELD_NUMBER;
+		hash = (53 * hash) + getName().hashCode();
+		hash = (29 * hash) + this.unknownFields.hashCode();
+		this.memoizedHashCode = hash;
+		return hash;
+	}
+
+	@Override
+	public Builder newBuilderForType() {
+		return newBuilder();
+	}
+
 	@Override
 	public Builder toBuilder() {
 		return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
@@ -306,6 +328,16 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		return builder;
 	}
 
+	@java.lang.Override
+	public com.google.protobuf.Parser getParserForType() {
+		return PARSER;
+	}
+
+	@Override
+	public HelloRequest getDefaultInstanceForType() {
+		return DEFAULT_INSTANCE;
+	}
+
 	/**
 	 * 
 	 * The request message containing the user's name.
@@ -318,16 +350,7 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 			// @@protoc_insertion_point(builder_implements:HelloRequest)
 			HelloRequestOrBuilder {
 
-		public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
-			return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
-		}
-
-		@Override
-		protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
-			return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
-					.ensureFieldAccessorsInitialized(HelloRequest.class,
-							HelloRequest.Builder.class);
-		}
+		private java.lang.Object name_ = "";
 
 		// Construct using HelloRequest.newBuilder()
 		private Builder() {
@@ -339,6 +362,17 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 			maybeForceBuilderInitialization();
 		}
 
+		public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+			return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
+		}
+
+		@Override
+		protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+			return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
+					.ensureFieldAccessorsInitialized(HelloRequest.class,
+							HelloRequest.Builder.class);
+		}
+
 		private void maybeForceBuilderInitialization() {
 			if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
 			}
@@ -463,8 +497,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 			return this;
 		}
 
-		private java.lang.Object name_ = "";
-
 		/**
 		 * string name = 1;
 		 */
@@ -482,6 +514,19 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 			}
 		}
 
+		/**
+		 * string name = 1;
+		 */
+		public Builder setName(java.lang.String value) {
+			if (value == null) {
+				throw new NullPointerException();
+			}
+
+			this.name_ = value;
+			onChanged();
+			return this;
+		}
+
 		/**
 		 * string name = 1;
 		 */
@@ -502,10 +547,11 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 		/**
 		 * string name = 1;
 		 */
-		public Builder setName(java.lang.String value) {
+		public Builder setNameBytes(com.google.protobuf.ByteString value) {
 			if (value == null) {
 				throw new NullPointerException();
 			}
+			checkByteStringIsUtf8(value);
 
 			this.name_ = value;
 			onChanged();
@@ -522,20 +568,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 			return this;
 		}
 
-		/**
-		 * string name = 1;
-		 */
-		public Builder setNameBytes(com.google.protobuf.ByteString value) {
-			if (value == null) {
-				throw new NullPointerException();
-			}
-			checkByteStringIsUtf8(value);
-
-			this.name_ = value;
-			onChanged();
-			return this;
-		}
-
 		@Override
 		public final Builder setUnknownFields(
 				final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -552,37 +584,4 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
 
 	}
 
-	// @@protoc_insertion_point(class_scope:HelloRequest)
-	private static final HelloRequest DEFAULT_INSTANCE;
-	static {
-		DEFAULT_INSTANCE = new HelloRequest();
-	}
-
-	public static HelloRequest getDefaultInstance() {
-		return DEFAULT_INSTANCE;
-	}
-
-	private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
-		@Override
-		public HelloRequest parsePartialFrom(com.google.protobuf.CodedInputStream input,
-				com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-				throws com.google.protobuf.InvalidProtocolBufferException {
-			return new HelloRequest(input, extensionRegistry);
-		}
-	};
-
-	public static com.google.protobuf.Parser parser() {
-		return PARSER;
-	}
-
-	@java.lang.Override
-	public com.google.protobuf.Parser getParserForType() {
-		return PARSER;
-	}
-
-	@Override
-	public HelloRequest getDefaultInstanceForType() {
-		return DEFAULT_INSTANCE;
-	}
-
 }
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
index 272583fdc..483d71cbd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
index 7e4437c6a..2dac5608a 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,14 +31,18 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
 @javax.annotation.Generated(value = "by gRPC proto compiler (version 1.15.1)", comments = "Source: HelloService.proto")
 public final class HelloServiceGrpc {
 
-	private HelloServiceGrpc() {
-	}
-
 	public static final String SERVICE_NAME = "HelloService";
 
+	private static final int METHODID_SAY_HELLO = 0;
+
 	// Static method descriptors that strictly reflect the proto.
 	private static volatile io.grpc.MethodDescriptor getSayHelloMethod;
 
+	private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+	private HelloServiceGrpc() {
+	}
+
 	@io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/'
 			+ "SayHello", requestType = HelloRequest.class, responseType = HelloReply.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
 	public static io.grpc.MethodDescriptor getSayHelloMethod() {
@@ -87,6 +91,22 @@ public final class HelloServiceGrpc {
 		return new HelloServiceFutureStub(channel);
 	}
 
+	public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+		io.grpc.ServiceDescriptor result = serviceDescriptor;
+		if (result == null) {
+			synchronized (HelloServiceGrpc.class) {
+				result = serviceDescriptor;
+				if (result == null) {
+					serviceDescriptor = result = io.grpc.ServiceDescriptor
+							.newBuilder(SERVICE_NAME)
+							.setSchemaDescriptor(new HelloServiceFileDescriptorSupplier())
+							.addMethod(getSayHelloMethod()).build();
+				}
+			}
+		}
+		return result;
+	}
+
 	/**
 	 * 
 	 * The Hello service definition.
@@ -222,8 +242,6 @@ public final class HelloServiceGrpc {
 
 	}
 
-	private static final int METHODID_SAY_HELLO = 0;
-
 	private static final class MethodHandlers
 			implements io.grpc.stub.ServerCalls.UnaryMethod,
 			io.grpc.stub.ServerCalls.ServerStreamingMethod,
@@ -309,22 +327,4 @@ public final class HelloServiceGrpc {
 
 	}
 
-	private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
-
-	public static io.grpc.ServiceDescriptor getServiceDescriptor() {
-		io.grpc.ServiceDescriptor result = serviceDescriptor;
-		if (result == null) {
-			synchronized (HelloServiceGrpc.class) {
-				result = serviceDescriptor;
-				if (result == null) {
-					serviceDescriptor = result = io.grpc.ServiceDescriptor
-							.newBuilder(SERVICE_NAME)
-							.setSchemaDescriptor(new HelloServiceFileDescriptorSupplier())
-							.addMethod(getSayHelloMethod()).build();
-				}
-			}
-		}
-		return result;
-	}
-
 }
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
index 3e6e6b798..40bb478f2 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,28 +18,13 @@ package org.springframework.cloud.sleuth.instrument.grpc.stubs;
 
 public final class HelloServiceOuterClass {
 
-	private HelloServiceOuterClass() {
-	}
-
-	public static void registerAllExtensions(
-			com.google.protobuf.ExtensionRegistryLite registry) {
-	}
-
-	public static void registerAllExtensions(
-			com.google.protobuf.ExtensionRegistry registry) {
-		registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
-	}
-
 	static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloRequest_descriptor;
 	static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_sample_grpc_HelloRequest_fieldAccessorTable;
 	static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloReply_descriptor;
 	static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_sample_grpc_HelloReply_fieldAccessorTable;
 
-	public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
-		return descriptor;
-	}
-
 	private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
+
 	static {
 		java.lang.String[] descriptorData = {
 				"\n\022HelloService.proto\022\013sample.grpc\"\034\n\014Hel"
@@ -70,6 +55,22 @@ public final class HelloServiceOuterClass {
 				new java.lang.String[] { "Message", });
 	}
 
+	private HelloServiceOuterClass() {
+	}
+
+	public static void registerAllExtensions(
+			com.google.protobuf.ExtensionRegistryLite registry) {
+	}
+
+	public static void registerAllExtensions(
+			com.google.protobuf.ExtensionRegistry registry) {
+		registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
+	}
+
+	public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+		return descriptor;
+	}
+
 	// @@protoc_insertion_point(outer_class_scope)
 
 }
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
index f81eda831..b188acedc 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,23 +21,23 @@ import java.util.concurrent.atomic.AtomicReference;
 import brave.Span;
 import brave.Tracing;
 import brave.sampler.Sampler;
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
+import com.netflix.hystrix.strategy.HystrixPlugins;
 import org.awaitility.Awaitility;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
 import org.springframework.cloud.netflix.hystrix.EnableHystrix;
+import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.netflix.hystrix.strategy.HystrixPlugins;
-
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.assertj.core.api.BDDAssertions.then;
 
@@ -103,10 +103,10 @@ public class HystrixAnnotationsIntegrationTests {
 
 	public static class HystrixCommandInvocationSpanCatcher {
 
-		AtomicReference spanCaughtFromHystrixThread;
-
 		private final Tracing tracing;
 
+		AtomicReference spanCaughtFromHystrixThread;
+
 		public HystrixCommandInvocationSpanCatcher(Tracing tracing) {
 			this.tracing = tracing;
 		}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
index 8290d7227..7eea66d8e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,15 +23,6 @@ import java.util.concurrent.TimeUnit;
 import brave.Tracing;
 import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.BDDMockito;
-import org.mockito.Mockito;
-import org.springframework.cloud.sleuth.DefaultSpanNamer;
-import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
-
 import com.netflix.hystrix.HystrixThreadPoolKey;
 import com.netflix.hystrix.HystrixThreadPoolProperties;
 import com.netflix.hystrix.strategy.HystrixPlugins;
@@ -42,6 +33,15 @@ import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
 import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
 import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
 import com.netflix.hystrix.strategy.properties.HystrixProperty;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.BDDMockito;
+import org.mockito.Mockito;
+
+import org.springframework.cloud.sleuth.DefaultSpanNamer;
+import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
+import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
 
 import static org.assertj.core.api.BDDAssertions.then;
 
@@ -182,4 +182,4 @@ public class SleuthHystrixConcurrencyStrategyTest {
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
index c114c4b9d..99cfd3a69 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@ import java.util.concurrent.atomic.AtomicReference;
 import brave.Span;
 import brave.Tracer;
 import brave.Tracing;
-import brave.sampler.Sampler;
 import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
+import brave.sampler.Sampler;
 import com.netflix.hystrix.HystrixCommand;
 import com.netflix.hystrix.HystrixCommandKey;
 import com.netflix.hystrix.HystrixCommandProperties;
@@ -33,6 +33,7 @@ import com.netflix.hystrix.strategy.HystrixPlugins;
 import org.assertj.core.api.BDDAssertions;
 import org.junit.Before;
 import org.junit.Test;
+
 import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
 
 import static com.netflix.hystrix.HystrixCommand.Setter.withGroupKey;
@@ -194,4 +195,4 @@ public class TraceCommandTests {
 
 class FooException extends RuntimeException {
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
index c16f72980..77d376f02 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+
 import javax.annotation.PreDestroy;
 
 import brave.Span;
@@ -31,6 +32,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -53,6 +55,8 @@ import static org.assertj.core.api.Assertions.assertThat;
  * Ported from
  * org.springframework.cloud.sleuth.instrument.messaging.TraceChannelInterceptorTest to
  * allow sleuth to decommission its implementation.
+ *
+ * @author Marcin Grzejszczak
  */
 @SpringBootTest(classes = ITTracingChannelInterceptor.App.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
 @RunWith(SpringRunner.class)
@@ -141,6 +145,8 @@ public class ITTracingChannelInterceptor implements MessageHandler {
 	@EnableAutoConfiguration
 	static class App {
 
+		ExecutorService service = Executors.newSingleThreadExecutor();
+
 		@Bean
 		List spans() {
 			return new ArrayList<>();
@@ -159,8 +165,6 @@ public class ITTracingChannelInterceptor implements MessageHandler {
 			return tracing().tracer();
 		}
 
-		ExecutorService service = Executors.newSingleThreadExecutor();
-
 		@Bean
 		ExecutorChannel executorChannel() {
 			return new ExecutorChannel(this.service);
@@ -183,4 +187,4 @@ public class ITTracingChannelInterceptor implements MessageHandler {
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
index 53caff3d3..fa2f33001 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -78,6 +78,38 @@ public class JmsTracingConfigurationTest {
 							JcaJmsListenerConfiguration.class,
 							JmsTestTracingConfiguration.class));
 
+	static void clearSpans(AssertableApplicationContext ctx) throws JMSException {
+		ctx.getBean(JmsTestTracingConfiguration.class).clearSpan();
+	}
+
+	static void checkConnection(AssertableApplicationContext ctx) throws JMSException {
+		// Not using try-with-resources as that doesn't exist in JMS 1.1
+		Connection con = ctx.getBean(ConnectionFactory.class).createConnection();
+		try {
+			con.setExceptionListener(exception -> {
+			});
+			assertThat(con.getExceptionListener().getClass().getName())
+					.startsWith("brave.jms.TracingExceptionListener");
+		}
+		finally {
+			con.close();
+		}
+	}
+
+	static void checkXAConnection(AssertableApplicationContext ctx) throws JMSException {
+		// Not using try-with-resources as that doesn't exist in JMS 1.1
+		XAConnection con = ctx.getBean(XAConnectionFactory.class).createXAConnection();
+		try {
+			con.setExceptionListener(exception -> {
+			});
+			assertThat(con.getExceptionListener().getClass().getName())
+					.startsWith("brave.jms.TracingExceptionListener");
+		}
+		finally {
+			con.close();
+		}
+	}
+
 	@Test
 	public void tracesConnectionFactory() {
 		this.contextRunner.run(JmsTracingConfigurationTest::checkConnection);
@@ -92,16 +124,6 @@ public class JmsTracingConfigurationTest {
 		});
 	}
 
-	@AutoConfigureBefore(ActiveMQAutoConfiguration.class)
-	static class XAConfiguration {
-
-		@Bean
-		XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
-			return connectionFactory -> (ConnectionFactory) connectionFactory;
-		}
-
-	}
-
 	@Test
 	public void tracesListener_jmsMessageListener() {
 		this.contextRunner.withUserConfiguration(SimpleJmsListenerConfiguration.class)
@@ -120,6 +142,52 @@ public class JmsTracingConfigurationTest {
 				});
 	}
 
+	@Test
+	public void tracesListener_annotationMessageListener() {
+		this.contextRunner.withUserConfiguration(AnnotationJmsListenerConfiguration.class)
+				.run(ctx -> {
+					clearSpans(ctx);
+					ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
+
+					Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
+					List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
+							takeSpan.call());
+
+					assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
+							.isEqualTo(trace.get(0).traceId()));
+					assertThat(trace).extracting(Span::name)
+							.containsExactlyInAnyOrder("send", "receive", "on-message");
+				});
+	}
+
+	@Test
+	public void tracesListener_jcaMessageListener() {
+		this.contextRunner.withUserConfiguration(JcaJmsListenerConfiguration.class)
+				.run(ctx -> {
+					clearSpans(ctx);
+					ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
+
+					Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
+					List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
+							takeSpan.call());
+
+					assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
+							.isEqualTo(trace.get(0).traceId()));
+					assertThat(trace).extracting(Span::name)
+							.containsExactlyInAnyOrder("send", "receive", "on-message");
+				});
+	}
+
+	@AutoConfigureBefore(ActiveMQAutoConfiguration.class)
+	static class XAConfiguration {
+
+		@Bean
+		XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
+			return connectionFactory -> (ConnectionFactory) connectionFactory;
+		}
+
+	}
+
 	@Configuration
 	@EnableJms
 	static class SimpleJmsListenerConfiguration implements JmsListenerConfigurer {
@@ -147,24 +215,6 @@ public class JmsTracingConfigurationTest {
 
 	}
 
-	@Test
-	public void tracesListener_annotationMessageListener() {
-		this.contextRunner.withUserConfiguration(AnnotationJmsListenerConfiguration.class)
-				.run(ctx -> {
-					clearSpans(ctx);
-					ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
-
-					Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
-					List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
-							takeSpan.call());
-
-					assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
-							.isEqualTo(trace.get(0).traceId()));
-					assertThat(trace).extracting(Span::name)
-							.containsExactlyInAnyOrder("send", "receive", "on-message");
-				});
-	}
-
 	@Configuration
 	@EnableJms
 	static class AnnotationJmsListenerConfiguration {
@@ -180,24 +230,6 @@ public class JmsTracingConfigurationTest {
 
 	}
 
-	@Test
-	public void tracesListener_jcaMessageListener() {
-		this.contextRunner.withUserConfiguration(JcaJmsListenerConfiguration.class)
-				.run(ctx -> {
-					clearSpans(ctx);
-					ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
-
-					Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
-					List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
-							takeSpan.call());
-
-					assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
-							.isEqualTo(trace.get(0).traceId()));
-					assertThat(trace).extracting(Span::name)
-							.containsExactlyInAnyOrder("send", "receive", "on-message");
-				});
-	}
-
 	@Configuration
 	static class JcaJmsListenerConfiguration {
 
@@ -241,38 +273,6 @@ public class JmsTracingConfigurationTest {
 
 	}
 
-	static void clearSpans(AssertableApplicationContext ctx) throws JMSException {
-		ctx.getBean(JmsTestTracingConfiguration.class).clearSpan();
-	}
-
-	static void checkConnection(AssertableApplicationContext ctx) throws JMSException {
-		// Not using try-with-resources as that doesn't exist in JMS 1.1
-		Connection con = ctx.getBean(ConnectionFactory.class).createConnection();
-		try {
-			con.setExceptionListener(exception -> {
-			});
-			assertThat(con.getExceptionListener().getClass().getName())
-					.startsWith("brave.jms.TracingExceptionListener");
-		}
-		finally {
-			con.close();
-		}
-	}
-
-	static void checkXAConnection(AssertableApplicationContext ctx) throws JMSException {
-		// Not using try-with-resources as that doesn't exist in JMS 1.1
-		XAConnection con = ctx.getBean(XAConnectionFactory.class).createXAConnection();
-		try {
-			con.setExceptionListener(exception -> {
-			});
-			assertThat(con.getExceptionListener().getClass().getName())
-					.startsWith("brave.jms.TracingExceptionListener");
-		}
-		finally {
-			con.close();
-		}
-	}
-
 }
 
 @Configuration
@@ -295,7 +295,8 @@ class JmsTestTracingConfiguration {
 	}
 
 	/**
-	 * Call this to block until a span was reported
+	 * Call this to block until a span was reported.
+	 * @return span from queue
 	 */
 	@Bean
 	Callable takeSpan() {
@@ -332,4 +333,4 @@ class JmsTestTracingConfiguration {
 		}).currentTraceContext(currentTraceContext).build();
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
index 2c19c87ac..1a9554ae8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,10 +20,11 @@ import java.util.Collections;
 
 import brave.propagation.Propagation;
 import org.junit.Test;
+
 import org.springframework.messaging.support.MessageHeaderAccessor;
 import org.springframework.messaging.support.NativeMessageHeaderAccessor;
 
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.assertThat;
 
 public class MessageHeaderPropagationTest
 		extends PropagationSetterTest {
@@ -58,7 +59,7 @@ public class MessageHeaderPropagationTest
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb6124".getBytes());
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb6124000000".getBytes());
 		String value = MessageHeaderPropagation.INSTANCE.get(carrier, "X-B3-TraceId");
-		assertEquals("48485a3953bb6124000000", value);
+		assertThat(value).isEqualTo("48485a3953bb6124000000");
 	}
 
 	@Test
@@ -67,7 +68,7 @@ public class MessageHeaderPropagationTest
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb6124");
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb61240000000");
 		String value = MessageHeaderPropagation.INSTANCE.get(carrier, "X-B3-TraceId");
-		assertEquals("48485a3953bb61240000000", value);
+		assertThat(value).isEqualTo("48485a3953bb61240000000");
 	}
 
 	@Test
@@ -76,7 +77,7 @@ public class MessageHeaderPropagationTest
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb6124");
 		carrier.setHeader("X-B3-TraceId", "48485a3953bb61240000000");
 		String value = MessageHeaderPropagation.INSTANCE.get(carrier, "non existent key");
-		assertNull(value);
+		assertThat(value).isNull();
 	}
 
 	@Test
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
index f20fd7234..1e1b29a4c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,11 +17,14 @@
 package org.springframework.cloud.sleuth.instrument.messaging;
 
 import brave.propagation.Propagation;
+
 import org.springframework.messaging.support.MessageHeaderAccessor;
 import org.springframework.messaging.support.NativeMessageHeaderAccessor;
 
 /**
- * Tests that native headers are redundantly added
+ * Tests that native headers are redundantly added.
+ *
+ * @author Marcin Grzejszczak
  */
 public class MessageHeaderPropagation_NativeTest
 		extends PropagationSetterTest {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
index 2531e0b75..48c36f865 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +22,11 @@ import org.junit.Test;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
- * Taken from Brave
+ * Taken from Brave.
+ *
+ * @param  carrier type
+ * @param  key type
+ * @author Marcin Grzejszczak
  */
 public abstract class PropagationSetterTest {
 
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
index 515bb0f34..01b1f3897 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.sampler.Sampler;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -38,9 +39,7 @@ import org.springframework.messaging.PollableChannel;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Spencer Gibb
@@ -77,20 +76,21 @@ public class TraceContextPropagationChannelInterceptorTests {
 		}
 
 		Message message = this.channel.receive(0);
-		assertNotNull("message was null", message);
+		assertThat(message).as("message was null").isNotNull();
 
 		String spanId = message.getHeaders().get(TraceMessageHeaders.SPAN_ID_NAME,
 				String.class);
-		assertNotEquals("spanId was equal to parent's id", expectedSpanId, spanId);
+		assertThat(spanId).as("spanId was equal to parent's id")
+				.isNotEqualTo(expectedSpanId);
 
 		String traceId = message.getHeaders().get(TraceMessageHeaders.TRACE_ID_NAME,
 				String.class);
-		assertNotNull("traceId was null", traceId);
+		assertThat(traceId).as("traceId was null").isNotNull();
 
 		String parentId = message.getHeaders().get(TraceMessageHeaders.PARENT_ID_NAME,
 				String.class);
-		assertEquals("parentId was not equal to parent's id",
-				this.reporter.getSpans().get(0).id(), parentId);
+		assertThat(parentId).as("parentId was not equal to parent's id")
+				.isEqualTo(this.reporter.getSpans().get(0).id());
 
 	}
 
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
index 66cfae806..0e2420636 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mockito;
+
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
@@ -199,4 +200,4 @@ class TestSleuthJmsBeanPostProcessor extends TracingConnectionFactoryBeanPostPro
 		return super.postProcessAfterInitialization(bean, beanName);
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
index 4e75aaae6..c5ca297ed 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging;
 import brave.Tracing;
 import org.junit.After;
 import org.junit.Test;
+
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -26,16 +27,6 @@ import org.springframework.messaging.support.ChannelInterceptor;
 
 public class TracingChannelInterceptorAutowireTest {
 
-	@Configuration
-	static class TracingConfiguration {
-
-		@Bean
-		Tracing tracing() {
-			return Tracing.newBuilder().build();
-		}
-
-	}
-
 	@Test
 	public void autowiredWithBeanConfig() {
 		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
@@ -51,4 +42,14 @@ public class TracingChannelInterceptorAutowireTest {
 		Tracing.current().close();
 	}
 
+	@Configuration
+	static class TracingConfiguration {
+
+		@Bean
+		Tracing tracing() {
+			return Tracing.newBuilder().build();
+		}
+
+	}
+
 }
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
index 649c0bdea..7bdd4f90c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
 import org.junit.After;
 import org.junit.Test;
+import zipkin2.Span;
+
 import org.springframework.integration.channel.DirectChannel;
 import org.springframework.integration.channel.QueueChannel;
 import org.springframework.messaging.Message;
@@ -41,7 +43,6 @@ import org.springframework.messaging.support.ExecutorChannelInterceptor;
 import org.springframework.messaging.support.ExecutorSubscribableChannel;
 import org.springframework.messaging.support.MessageBuilder;
 import org.springframework.messaging.support.NativeMessageHeaderAccessor;
-import zipkin2.Span;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.springframework.messaging.support.NativeMessageHeaderAccessor.NATIVE_HEADERS;
@@ -151,7 +152,7 @@ public class TracingChannelInterceptorTest {
 
 	/**
 	 * We have to inject headers on a polling receive as any future processor will come
-	 * later
+	 * later.
 	 */
 	@Test
 	public void pollingReceive_injectsConsumerSpan() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
index 3f9188a87..df4c1c136 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,4 +46,4 @@ public class CustomExecutorConfig extends AsyncConfigurerSupport {
 		return new LazyTraceExecutor(this.beanFactory, executor);
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
index 4e0c65cd8..70adffd15 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 package org.springframework.cloud.sleuth.instrument.messaging.issues.issue_943;
 
 import brave.sampler.Sampler;
+
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
index 3b25d1c20..e0f818182 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
index 786f0e2ed..a15f14f3a 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.List;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.http.HttpStatus;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
index 79b1cccda..7a4545bcd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
 import brave.Span;
 import brave.Tracer;
 import org.junit.Test;
+
 import org.springframework.boot.SpringApplication;
 import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
 import org.springframework.context.ConfigurableApplicationContext;
@@ -29,7 +30,9 @@ import org.springframework.web.client.RestTemplate;
 import static org.assertj.core.api.BDDAssertions.then;
 
 /**
- * Example taken from https://github.com/spring-cloud/spring-cloud-sleuth/issues/943
+ * Example taken from https://github.com/spring-cloud/spring-cloud-sleuth/issues/943 .
+ *
+ * @author Marcin Grzejszczak
  */
 public class Issue943Tests {
 
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
index 8c39b98d8..58843c787 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
index 317b63362..60cc22c56 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging.websocket;
 import brave.sampler.Sampler;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -80,4 +81,4 @@ public class TraceWebSocketAutoConfigurationTests {
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
index 6c9bd2b74..9d734b20d 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.Span;
 import brave.Tracer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.integration.annotation.Aggregator;
@@ -38,6 +39,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+@MessagingGateway(name = "greeter")
+interface Sender {
+
+	@Gateway(requestChannel = "greetings")
+	void send(String message);
+
+}
+
 @RestController
 @MessageEndpoint
 @IntegrationComponentScan
@@ -108,14 +117,6 @@ public class DemoApplication {
 
 }
 
-@MessagingGateway(name = "greeter")
-interface Sender {
-
-	@Gateway(requestChannel = "greetings")
-	void send(String message);
-
-}
-
 class Greeting {
 
 	private String message;
@@ -123,7 +124,7 @@ class Greeting {
 	Greeting() {
 	}
 
-	public Greeting(String message) {
+	Greeting(String message) {
 		super();
 		this.message = message;
 	}
@@ -136,4 +137,4 @@ class Greeting {
 		this.message = message;
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
index 8cf42cafd..6f2203f52 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import brave.sampler.Sampler;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
@@ -50,11 +51,12 @@ import static java.util.concurrent.TimeUnit.SECONDS;
 import static java.util.stream.Collectors.toList;
 import static org.assertj.core.api.BDDAssertions.then;
 import static org.awaitility.Awaitility.await;
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @TestPropertySource(properties = { "spring.application.name=multiplehopsintegrationtests",
 		"spring.sleuth.http.legacy.enabled=true" })
-@SpringBootTest(classes = MultipleHopsIntegrationTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = MultipleHopsIntegrationTests.Config.class, webEnvironment = RANDOM_PORT)
 @ActiveProfiles("baggage")
 public class MultipleHopsIntegrationTests {
 
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
index 1a1b9cf63..fee4f60af 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.springframework.cloud.sleuth.instrument.opentracing;
 
 import java.util.LinkedHashMap;
@@ -33,6 +34,8 @@ import io.opentracing.propagation.TextMapInjectAdapter;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import zipkin2.Annotation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -40,11 +43,10 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.Annotation;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.data.MapEntry.entry;
-import static org.junit.Assert.assertEquals;
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
 
 /**
  * This shows how one might make an OpenTracing adapter for Brave, and how to navigate in
@@ -52,9 +54,11 @@ import static org.junit.Assert.assertEquals;
  *
  * Adopted from:
  * https://github.com/openzipkin-contrib/brave-opentracing/tree/master/src/test/java/brave/opentracing
+ *
+ * @author Marcin Grzejszczak
  */
 @RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = "spring.sleuth.baggage-keys=country-code,user-id")
+@SpringBootTest(webEnvironment = NONE, properties = "spring.sleuth.baggage-keys=country-code,user-id")
 public class BraveTracerTest {
 
 	@Autowired
@@ -66,6 +70,10 @@ public class BraveTracerTest {
 	@Autowired
 	BraveTracer opentracing;
 
+	private static TraceContext getTraceContext(Scope scope) {
+		return ((BraveSpanContext) scope.span().context()).unwrap();
+	}
+
 	@Test
 	public void startWithOpenTracingAndFinishWithBrave() {
 		io.opentracing.Span openTracingSpan = this.opentracing.buildSpan("encode")
@@ -188,12 +196,16 @@ public class BraveTracerTest {
 			}
 		}
 
-		assertEquals("SpanA should have been active again after closing B", idOfSpanA,
-				shouldBeIdOfSpanA);
-		assertEquals("SpanB should have been active prior to its closure", idOfSpanB,
-				shouldBeIdOfSpanB);
-		assertEquals("SpanB's parent should be SpanA", idOfSpanA, parentIdOfSpanB);
-		assertEquals("SpanC's parent should be SpanA", idOfSpanA, parentIdOfSpanC);
+		assertThat(shouldBeIdOfSpanA)
+				.as("SpanA should have been active again after closing B")
+				.isEqualTo(idOfSpanA);
+		assertThat(shouldBeIdOfSpanB)
+				.as("SpanB should have been active prior to its closure")
+				.isEqualTo(idOfSpanB);
+		assertThat(parentIdOfSpanB).as("SpanB's parent should be SpanA")
+				.isEqualTo(idOfSpanA);
+		assertThat(parentIdOfSpanC).as("SpanC's parent should be SpanA")
+				.isEqualTo(idOfSpanA);
 	}
 
 	@Test
@@ -239,12 +251,16 @@ public class BraveTracerTest {
 			spanA.finish();
 		}
 
-		assertEquals("SpanA should have been active again after closing B", idOfSpanA,
-				shouldBeIdOfSpanA);
-		assertEquals("SpanB should have been active prior to its closure", idOfSpanB,
-				shouldBeIdOfSpanB);
-		assertEquals("SpanB's parent should be SpanA", idOfSpanA, parentIdOfSpanB);
-		assertEquals("SpanC's parent should be SpanA", idOfSpanA, parentIdOfSpanC);
+		assertThat(shouldBeIdOfSpanA)
+				.as("SpanA should have been active again after closing B")
+				.isEqualTo(idOfSpanA);
+		assertThat(shouldBeIdOfSpanB)
+				.as("SpanB should have been active prior to its closure")
+				.isEqualTo(idOfSpanB);
+		assertThat(parentIdOfSpanB).as("SpanB's parent should be SpanA")
+				.isEqualTo(idOfSpanA);
+		assertThat(parentIdOfSpanC).as("SpanC's parent should be SpanA")
+				.isEqualTo(idOfSpanA);
 	}
 
 	@Test
@@ -299,10 +315,6 @@ public class BraveTracerTest {
 		assertThat(this.spans.getSpans().get(0).tags()).isEmpty();
 	}
 
-	private static TraceContext getTraceContext(Scope scope) {
-		return ((BraveSpanContext) scope.span().context()).unwrap();
-	}
-
 	@Before
 	public void clear() {
 		this.spans.clear();
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
index 73438d971..5c8abf781 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
index 68e559af6..0a2fd71a5 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -66,4 +66,4 @@ public class ScopePassingSpanSubscriberTests {
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
index 36a63cee4..a53685190 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -308,4 +308,4 @@ public class SpanSubscriberTests {
 
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
index fa66082e6..11d6dc3cb 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.springframework.cloud.sleuth.instrument.reactor;
 
 import org.apache.commons.logging.Log;
@@ -8,7 +24,11 @@ import reactor.core.scheduler.Schedulers;
 /**
  * @author Marcin Grzejszczak
  */
-public class TraceReactorAutoConfigurationAccessorConfiguration {
+public final class TraceReactorAutoConfigurationAccessorConfiguration {
+
+	private TraceReactorAutoConfigurationAccessorConfiguration() {
+		throw new IllegalStateException("Can't instantiate a utility class");
+	}
 
 	private static final Log log = LogFactory
 			.getLog(TraceReactorAutoConfigurationAccessorConfiguration.class);
@@ -23,4 +43,4 @@ public class TraceReactorAutoConfigurationAccessorConfiguration {
 		Schedulers.resetFactory();
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
index 51f7ac94d..3f0ccb4b7 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,6 +29,12 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Hooks;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
+import zipkin2.Span;
+
 import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -44,11 +50,6 @@ import org.springframework.web.reactive.function.client.ClientResponse;
 import org.springframework.web.reactive.function.client.WebClient;
 import org.springframework.web.reactive.function.server.RouterFunction;
 import org.springframework.web.reactive.function.server.ServerResponse;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Hooks;
-import reactor.core.publisher.Mono;
-import reactor.core.scheduler.Schedulers;
-import zipkin2.Span;
 
 import static org.assertj.core.api.BDDAssertions.then;
 import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
@@ -59,6 +60,9 @@ public class FlatMapTests {
 
 	private static final Logger LOGGER = LoggerFactory.getLogger(FlatMapTests.class);
 
+	@Rule
+	public OutputCapture capture = new OutputCapture();
+
 	@BeforeClass
 	public static void setup() {
 		Hooks.resetOnLastOperator();
@@ -71,9 +75,6 @@ public class FlatMapTests {
 		Issue866Configuration.hook = null;
 	}
 
-	@Rule
-	public OutputCapture capture = new OutputCapture();
-
 	@Test
 	public void should_work_with_flat_maps() {
 		// given
@@ -229,4 +230,4 @@ class FactoryUser {
 		this.wasSchedulerWrapped = hook != null && hook.executed;
 	}
 
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
index b43400e8b..790fa29c4 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@ import brave.Span;
 import brave.Tracer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpMethod;
-import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
+import org.springframework.http.HttpMethod;
+import org.springframework.web.reactive.function.client.WebClient;
+
 class RequestSender {
 
 	private static final Logger LOGGER = LoggerFactory.getLogger(RequestSender.class);
@@ -37,7 +38,7 @@ class RequestSender {
 
 	Span span;
 
-	public RequestSender(WebClient webClient, Tracer tracer) {
+	RequestSender(WebClient webClient, Tracer tracer) {
 		this.webClient = webClient;
 		this.tracer = tracer;
 	}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
index 1fbdaf76a..9419f74b9 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,14 +30,15 @@ import brave.Tracer;
 import brave.Tracing;
 import brave.propagation.StrictScopeDecorator;
 import brave.propagation.ThreadLocalCurrentTraceContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import rx.functions.Action0;
 import rx.plugins.RxJavaErrorHandler;
 import rx.plugins.RxJavaObservableExecutionHook;
 import rx.plugins.RxJavaPlugins;
 import rx.plugins.RxJavaSchedulersHook;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+
 import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
 
 import static org.assertj.core.api.BDDAssertions.then;
@@ -47,6 +48,8 @@ import static org.assertj.core.api.BDDAssertions.then;
  */
 public class SleuthRxJavaSchedulersHookTests {
 
+	private static StringBuilder caller;
+
 	List threadsToIgnore = new ArrayList<>();
 
 	ArrayListSpanReporter reporter = new ArrayListSpanReporter();
@@ -64,8 +67,6 @@ public class SleuthRxJavaSchedulersHookTests {
 		this.reporter.clear();
 	}
 
-	private static StringBuilder caller;
-
 	@Before
 	@After
 	public void setup() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
index 2b1ddfd5f..769c59dd5 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,11 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import rx.Observable;
+import rx.functions.Action0;
+import rx.plugins.RxJavaPlugins;
+import rx.schedulers.Schedulers;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -32,10 +37,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
-import rx.Observable;
-import rx.functions.Action0;
-import rx.plugins.RxJavaPlugins;
-import rx.schedulers.Schedulers;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.assertj.core.api.BDDAssertions.then;
@@ -54,17 +55,17 @@ public class SleuthRxJavaTests {
 
 	StringBuffer caller = new StringBuffer();
 
-	@Before
-	public void clean() {
-		this.reporter.clear();
-	}
-
 	@BeforeClass
 	@AfterClass
 	public static void cleanUp() {
 		RxJavaPlugins.getInstance().reset();
 	}
 
+	@Before
+	public void clean() {
+		this.reporter.clear();
+	}
+
 	@Test
 	public void should_create_new_span_when_rx_java_action_is_executed_and_there_was_no_span() {
 		Observable
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
index b7ea48a38..50f4db38e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import org.apache.commons.logging.LogFactory;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import zipkin2.reporter.Reporter;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
@@ -37,7 +39,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.reporter.Reporter;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.assertj.core.api.BDDAssertions.then;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
index 4a314d9ec..cb091ee78 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web;
 
 import brave.Tracing;
 import org.junit.Before;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cloud.sleuth.autoconfig.SleuthProperties;
 import org.springframework.context.ApplicationContext;
@@ -34,7 +35,7 @@ import org.springframework.web.context.WebApplicationContext;
  *
  * @see WebApplicationContext
  * @see ApplicationContext
- * @author 4financeIT
+ * @author 4finance IT
  */
 @WebAppConfiguration
 public abstract class AbstractMvcIntegrationTest {
@@ -62,6 +63,7 @@ public abstract class AbstractMvcIntegrationTest {
 	 * Override in a subclass to modify mockMvcBuilder configuration (e.g. add filter).
 	 * 

* The method from super class should be called. + * @param mockMvcBuilder builder to configure */ protected void configureMockMvcBuilder(DefaultMockMvcBuilder mockMvcBuilder) { } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java index c91c0220a..67d1e9ddf 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,10 @@ public class CompositeHttpSamplerTests { HttpAdapter adapter; @Mock - HttpSampler left, right; + HttpSampler left; + + @Mock + HttpSampler right; HttpSampler sampler; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java index 3555d784b..ec51a3ae7 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,13 @@ package org.springframework.cloud.sleuth.instrument.web; +import brave.Tracer; +import brave.sampler.Sampler; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; @@ -30,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import brave.Tracer; -import brave.sampler.Sampler; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @@ -118,4 +118,4 @@ public class IgnoreAutoConfiguredSkipPatternsIntegrationTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java index 4421490d8..2805608b5 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; @@ -102,4 +103,4 @@ public class SkipEndPointsIntegrationTestsWithContextPathWithBasePath { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java index 18c648024..9ed8bea41 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java @@ -1,5 +1,28 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.web; +import brave.Tracer; +import brave.sampler.Sampler; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; @@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import brave.Tracer; -import brave.sampler.Sampler; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @@ -31,15 +47,15 @@ import static org.assertj.core.api.BDDAssertions.then; "management.endpoints.web.base-path:/" }) public class SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath { + @LocalServerPort + int port; + @Autowired private ArrayListSpanReporter spanReporter; @Autowired private Tracer tracer; - @LocalServerPort - int port; - @Before @After public void clearSpans() { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java index 6f2d88b6d..c44dbc68c 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java @@ -1,5 +1,28 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.web; +import brave.Tracer; +import brave.sampler.Sampler; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; @@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import brave.Tracer; -import brave.sampler.Sampler; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @@ -29,15 +45,15 @@ import static org.assertj.core.api.BDDAssertions.then; "spring.sleuth.http.legacy.enabled:true" }) public class SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath { + @LocalServerPort + int port; + @Autowired private ArrayListSpanReporter spanReporter; @Autowired private Tracer tracer; - @LocalServerPort - int port; - @Before @After public void clearSpans() { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java index 9c74496f1..9933d8ffa 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java @@ -1,5 +1,28 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.web; +import brave.Tracer; +import brave.sampler.Sampler; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; @@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import brave.Tracer; -import brave.sampler.Sampler; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - import static org.assertj.core.api.BDDAssertions.then; @RunWith(SpringRunner.class) @@ -30,15 +46,15 @@ import static org.assertj.core.api.BDDAssertions.then; "management.endpoints.web.base-path:/" }) public class SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath { + @LocalServerPort + int port; + @Autowired private ArrayListSpanReporter spanReporter; @Autowired private Tracer tracer; - @LocalServerPort - int port; - @Before @After public void clearSpans() { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java index bd5e3466d..6dbab83f2 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,4 +227,4 @@ public class SkipPatternProviderConfigTest { }; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java index 72f1a409d..706ab38c7 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,19 @@ package org.springframework.cloud.sleuth.instrument.web; -import static org.assertj.core.api.BDDAssertions.then; - import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.junit.Test; - import brave.SpanCustomizer; import brave.http.HttpClientAdapter; +import org.junit.Test; + +import static org.assertj.core.api.BDDAssertions.then; /** - * Test case for HttpTraceKeysInjector + * Test case for HttpTraceKeysInjector. * * @author Sven Zethelius */ @@ -103,4 +102,4 @@ class TestSpanCustomizer implements SpanCustomizer { return this; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java index c7496631e..1eab4e34d 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,11 @@ import brave.http.HttpServerParser; * @author Marcin Grzejszczak * @since */ -public class SleuthHttpParserAccessor { +public final class SleuthHttpParserAccessor { + + private SleuthHttpParserAccessor() { + throw new IllegalStateException("Can't instantiate a utility class"); + } public static HttpClientParser getClient() { return new SleuthHttpClientParser(new TraceKeys()); diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java index d4b72658b..d94b926dd 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,4 +54,4 @@ public class SleuthHttpSamplerTests { then(sampler.trySample(this.adapter, new Object())).isFalse(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java index 2f29d79a5..479587e75 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,11 @@ import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.Assertions.tuple; import static org.assertj.core.api.BDDAssertions.then; +@RepositoryRestResource +interface ReservationRepository extends JpaRepository { + +} + /** * @author Marcin Grzejszczak */ @@ -146,7 +151,7 @@ class SampleRecords { private final ReservationRepository reservationRepository; - public SampleRecords(ReservationRepository reservationRepository) { + SampleRecords(ReservationRepository reservationRepository) { this.reservationRepository = reservationRepository; } @@ -160,11 +165,6 @@ class SampleRecords { } -@RepositoryRestResource -interface ReservationRepository extends JpaRepository { - -} - @Entity class Reservation { @@ -174,6 +174,14 @@ class Reservation { private String reservationName; // reservation_name + Reservation() { // why JPA why??? + } + + Reservation(String reservationName) { + + this.reservationName = reservationName; + } + public Long getId() { return this.id; } @@ -188,12 +196,4 @@ class Reservation { + this.reservationName + '\'' + '}'; } - Reservation() {// why JPA why??? - } - - public Reservation(String reservationName) { - - this.reservationName = reservationName; - } - } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java index ee8c58c00..4226d749f 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java @@ -1,6 +1,5 @@ - /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +26,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.sleuth.SpanName; @@ -193,10 +193,10 @@ public class TraceAsyncIntegrationTests { static class ClassPerformingAsyncLogic { - AtomicReference span = new AtomicReference<>(); - private final Tracer tracer; + AtomicReference span = new AtomicReference<>(); + ClassPerformingAsyncLogic(Tracer tracer) { this.tracer = tracer; } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java index 48bd3e9b3..30358bdb2 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,22 @@ package org.springframework.cloud.sleuth.instrument.web; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + import brave.Span; import brave.http.HttpTracing; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -50,9 +52,10 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.filter.GenericFilterBean; import static org.assertj.core.api.BDDAssertions.then; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; @RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = TraceCustomFilterResponseInjectorTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = TraceCustomFilterResponseInjectorTests.Config.class, webEnvironment = RANDOM_PORT) @DirtiesContext public class TraceCustomFilterResponseInjectorTests { @@ -119,7 +122,7 @@ public class TraceCustomFilterResponseInjectorTests { private final HttpTracing httpTracing; - public HttpResponseInjectingTraceFilter(HttpTracing httpTracing) { + HttpResponseInjectingTraceFilter(HttpTracing httpTracing) { this.httpTracing = httpTracing; } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java index 746220b48..8938a7e23 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,17 @@ package org.springframework.cloud.sleuth.instrument.web; +import java.io.IOException; +import java.util.Optional; +import java.util.Random; +import java.util.concurrent.CompletableFuture; + import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Optional; -import java.util.Random; -import java.util.concurrent.CompletableFuture; import brave.Span; import brave.Tracer; @@ -38,6 +39,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.MDC; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.test.context.SpringBootTest; @@ -76,6 +78,8 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest { private static Log logger = LogFactory.getLog(TraceFilterIntegrationTests.class); + private static Span span; + @Autowired TracingFilter traceFilter; @@ -88,8 +92,6 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest { @Autowired Tracer tracer; - private static Span span; - @Before @After public void clearSpans() { @@ -319,6 +321,22 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest { private static final Log log = LogFactory.getLog(Config.class); + @Bean + public ArrayListSpanReporter testSpanReporter() { + return new ArrayListSpanReporter(); + } + + @Bean + Sampler alwaysSampler() { + return Sampler.ALWAYS_SAMPLE; + } + + @Bean + @Order(TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER + 1) + Filter myFilter(Tracer tracer) { + return new MyFilter(tracer); + } + @RestController public static class TestController { @@ -369,22 +387,6 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest { } - @Bean - public ArrayListSpanReporter testSpanReporter() { - return new ArrayListSpanReporter(); - } - - @Bean - Sampler alwaysSampler() { - return Sampler.ALWAYS_SAMPLE; - } - - @Bean - @Order(TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER + 1) - Filter myFilter(Tracer tracer) { - return new MyFilter(tracer); - } - } } @@ -417,4 +419,4 @@ class MyFilter extends GenericFilterBean { } } -// end::response_headers[] \ No newline at end of file +// end::response_headers[] diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java index e18f177e2..49206b0bc 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; + import javax.servlet.Filter; import brave.ErrorParser; @@ -32,6 +33,7 @@ import brave.servlet.TracingFilter; import org.junit.After; import org.junit.Before; import org.junit.Test; + import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.sleuth.util.SpanUtil; import org.springframework.http.HttpMethod; @@ -43,8 +45,8 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.BDDAssertions.then; -import static org.junit.Assert.assertEquals; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; /** @@ -296,7 +298,7 @@ public class TraceFilterTests { this.filter.doFilter(this.request, this.response, this.filterChain); } catch (RuntimeException e) { - assertEquals("Planned", e.getMessage()); + assertThat(e.getMessage()).isEqualTo("Planned"); } then(Tracing.current().tracer().currentSpan()).isNull(); @@ -460,6 +462,7 @@ public class TraceFilterTests { /** * Shows the expansion of {@link import * org.springframework.cloud.sleuth.instrument.TraceKeys}. + * @param status http status */ public void verifyParentSpanHttpTags(HttpStatus status) { then(this.reporter.getSpans().size()).isGreaterThan(0); diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java index de746335e..35b0d2b0e 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicReference; + import javax.annotation.PreDestroy; import javax.servlet.FilterChain; import javax.servlet.ServletException; @@ -32,6 +33,7 @@ import brave.Tracing; import brave.sampler.Sampler; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -161,10 +163,10 @@ public class TraceFilterWebIntegrationMultipleFiltersTests { static class MyFilter extends GenericFilterBean { - AtomicReference span = new AtomicReference<>(); - private final Tracing tracer; + AtomicReference span = new AtomicReference<>(); + MyFilter(Tracing tracer) { this.tracer = tracer; } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java index 0e0fbd5a2..5d6380779 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -49,7 +51,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; -import zipkin2.Span; import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.BDDAssertions.then; @@ -61,6 +62,9 @@ import static org.assertj.core.api.BDDAssertions.then; @SpringBootTest(classes = TraceFilterWebIntegrationTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.sleuth.http.legacy.enabled=true") public class TraceFilterWebIntegrationTests { + @Rule + public OutputCapture capture = new OutputCapture(); + @Autowired Tracing tracer; @@ -74,9 +78,6 @@ public class TraceFilterWebIntegrationTests { @Autowired Environment environment; - @Rule - public OutputCapture capture = new OutputCapture(); - @Before @After public void cleanup() { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java index 15bc56588..2272cd987 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web; import org.junit.Test; + import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java index 831f547e8..686619a72 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,15 @@ import brave.Span; import brave.Tracer; import brave.Tracing; import brave.http.HttpTracing; -import brave.sampler.Sampler; import brave.propagation.StrictScopeDecorator; import brave.propagation.ThreadLocalCurrentTraceContext; +import brave.sampler.Sampler; import brave.spring.web.TracingClientHttpRequestInterceptor; import org.apache.commons.lang3.StringUtils; import org.junit.After; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; + import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.sleuth.util.SpanUtil; import org.springframework.http.HttpHeaders; @@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; +import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.BDDAssertions.then; /** @@ -54,14 +55,6 @@ import static org.assertj.core.api.BDDAssertions.then; */ public class TraceRestTemplateInterceptorTests { - private TestController testController = new TestController(); - - private MockMvc mockMvc = MockMvcBuilders.standaloneSetup(this.testController) - .build(); - - private RestTemplate template = new RestTemplate( - new MockMvcClientHttpRequestFactory(this.mockMvc)); - ArrayListSpanReporter reporter = new ArrayListSpanReporter(); Tracing tracing = Tracing.newBuilder() @@ -73,6 +66,14 @@ public class TraceRestTemplateInterceptorTests { TraceKeys traceKeys = new TraceKeys(); + private TestController testController = new TestController(); + + private MockMvc mockMvc = MockMvcBuilders.standaloneSetup(this.testController) + .build(); + + private RestTemplate template = new RestTemplate( + new MockMvcClientHttpRequestFactory(this.mockMvc)); + @Before public void setup() { setInterceptors(HttpTracing.create(this.tracing)); @@ -167,7 +168,7 @@ public class TraceRestTemplateInterceptorTests { try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) { this.template.getForEntity("/exception", Map.class).getBody(); - Assert.fail("should throw an exception"); + fail("should throw an exception"); } catch (RuntimeException e) { then(e).hasMessage("500 Internal Server Error"); diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java index 91d7e3c75..698bbaa2b 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java index 748d746d1..03b8c890f 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -254,10 +254,10 @@ public class TraceWebFluxTests { @RestController static class Controller2 { - Span span; - private final Tracer tracer; + Span span; + Controller2(Tracer tracer) { this.tracer = tracer; } @@ -339,6 +339,10 @@ class SleuthSpanCreatorAspectWebFlux { private final ArrayListSpanReporter reporter; + int port; + + private WebTestClient webClient; + SleuthSpanCreatorAspectWebFlux(Tracer tracer, AccessLoggingHttpTraceRepository repository, ArrayListSpanReporter reporter) { this.tracer = tracer; @@ -346,19 +350,15 @@ class SleuthSpanCreatorAspectWebFlux { this.reporter = reporter; } - private WebTestClient webClient; - - int port; - - void setPort(int port) { - this.port = port; - } - private static String toHexString(Long value) { BDDAssertions.then(value).isNotNull(); return StringUtils.leftPad(Long.toHexString(value), 16, '0'); } + void setPort(int port) { + this.port = port; + } + public void setup() { this.reporter.clear(); this.repository.clear(); @@ -558,4 +558,4 @@ class TestBean { () -> Mono.just(this.tracer.currentSpan().context().spanId()))); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java index 8baa570f1..426d4dfc9 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web; import org.junit.Test; + import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java index 09b8f9ec7..e952c6f6c 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java index 1b363b170..cf22a50cc 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web.client; import javax.annotation.PostConstruct; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -31,6 +31,8 @@ import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(classes = GH846Tests.App.class, webEnvironment = WebEnvironment.NONE) @RunWith(SpringRunner.class) public class GH846Tests { @@ -41,9 +43,9 @@ public class GH846Tests { @Test public void doit() throws Exception { int count = this.myBean.listAndCount(); - Assert.assertEquals( - "Change detected in RestTemplate interceptor *after* @PostConstruct", - count, this.myBean.getCountAtPostConstruct()); + assertThat(this.myBean.getCountAtPostConstruct()) + .as("Change detected in RestTemplate interceptor *after* @PostConstruct") + .isEqualTo(count); } @EnableAutoConfiguration @@ -67,7 +69,9 @@ public class GH846Tests { @Autowired private RestTemplate restTemplate; - /** Number of interceptors registered in the RestTemplate during @PostConstruct */ + /** + * Number of interceptors registered in the RestTemplate during @PostConstruct. + */ private int countAtPostConstruct; @PostConstruct diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java index 59de1a03c..5d6fce48b 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,7 +239,7 @@ class CustomAsyncClientHttpRequestFactory implements AsyncClientHttpRequestFacto private final SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - public CustomAsyncClientHttpRequestFactory() { + CustomAsyncClientHttpRequestFactory() { this.factory.setTaskExecutor(new SimpleAsyncTaskExecutor()); } @@ -265,4 +265,4 @@ class MyRestController { return this.tracer.currentSpan().context().traceIdString(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java index 77c4b6266..64ce0ca1c 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,12 @@ import java.util.stream.Collectors; import brave.Tracing; import brave.sampler.Sampler; import brave.spring.web.TracingAsyncClientHttpRequestInterceptor; -import zipkin2.Span; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java index 211f002e0..bcffdc52a 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.web.client; import java.util.Collections; @@ -85,4 +101,4 @@ public class TraceRequestHttpHeadersFilterTests { return headers; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java index 6386b2170..144624190 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.instrument.web.client; import brave.Tracing; @@ -58,4 +74,4 @@ public class TraceResponseHttpHeadersFilterTests { BDDAssertions.then(this.reporter.getSpans()).isNotEmpty(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java index 283f12be3..5dd313f16 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,18 +20,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.Map; -import org.assertj.core.api.BDDAssertions; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; -import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - import brave.Span; import brave.Tracer; import brave.Tracing; @@ -42,6 +30,19 @@ import brave.spring.web.TracingClientHttpRequestInterceptor; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.SocketPolicy; +import org.assertj.core.api.BDDAssertions; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import static org.assertj.core.api.Assertions.fail; /** * @author Marcin Grzejszczak @@ -51,8 +52,6 @@ public class TraceRestTemplateInterceptorIntegrationTests { @Rule public final MockWebServer mockWebServer = new MockWebServer(); - private RestTemplate template = new RestTemplate(clientHttpRequestFactory()); - ArrayListSpanReporter reporter = new ArrayListSpanReporter(); Tracing tracing = Tracing.newBuilder() @@ -62,6 +61,8 @@ public class TraceRestTemplateInterceptorIntegrationTests { Tracer tracer = this.tracing.tracer(); + private RestTemplate template = new RestTemplate(clientHttpRequestFactory()); + @Before public void setup() { this.template.setInterceptors(Arrays @@ -85,7 +86,7 @@ public class TraceRestTemplateInterceptorIntegrationTests { this.template.getForEntity( "http://localhost:" + this.mockWebServer.getPort() + "/exception", Map.class).getBody(); - Assert.fail("should throw an exception"); + fail("should throw an exception"); } catch (RuntimeException e) { BDDAssertions.then(e).hasRootCauseInstanceOf(IOException.class); diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java index 0022de023..909dda85c 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,16 +23,17 @@ import java.util.concurrent.TimeUnit; import brave.Tracer; import brave.Tracing; import brave.sampler.Sampler; -import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; -import zipkin2.Span; import org.assertj.core.api.BDDAssertions; import org.awaitility.Awaitility; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -172,4 +173,4 @@ public class TraceWebAsyncClientAutoConfigurationTests { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java index 6d6bc4674..e825f95a8 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import java.util.List; import brave.spring.web.TracingClientHttpRequestInterceptor; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -156,4 +157,4 @@ class MySecondClientHttpRequestInterceptor implements ClientHttpRequestIntercept return execution.execute(request, body); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java index 1b04f158c..fcad994ee 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.cloud.sleuth.instrument.web.client; -import java.net.URI; - -import brave.propagation.Propagation; import org.assertj.core.api.BDDAssertions; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,8 +23,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.beans.factory.BeanFactory; -import org.springframework.http.HttpMethod; -import org.springframework.web.reactive.function.client.ClientRequest; import org.springframework.web.reactive.function.client.WebClient; /** @@ -73,4 +68,4 @@ public class TraceWebClientBeanPostProcessorTest { }); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java index 7af568704..bb2c88b97 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,22 +23,23 @@ import java.util.Map; import brave.Span; import brave.Tracer; import brave.sampler.Sampler; -import zipkin2.reporter.Reporter; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration; +import org.springframework.cloud.netflix.ribbon.RibbonClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.cloud.netflix.ribbon.RibbonClient; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.ResponseEntity; @@ -121,6 +122,13 @@ public class WebClientDiscoveryExceptionTests { } + @FunctionalInterface + interface ResponseEntityProvider { + + ResponseEntity get(WebClientDiscoveryExceptionTests webClientTests); + + } + @Configuration @EnableAutoConfiguration(exclude = { EurekaClientAutoConfiguration.class, TraceWebServletAutoConfiguration.class }) @@ -147,11 +155,4 @@ public class WebClientDiscoveryExceptionTests { } - @FunctionalInterface - interface ResponseEntityProvider { - - ResponseEntity get(WebClientDiscoveryExceptionTests webClientTests); - - } - } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java index 37f1775f9..e20067f60 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,25 +25,28 @@ import brave.Span; import brave.Tracer; import brave.Tracing; import brave.sampler.Sampler; +import com.netflix.loadbalancer.BaseLoadBalancer; +import com.netflix.loadbalancer.ILoadBalancer; +import com.netflix.loadbalancer.Server; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.rule.OutputCapture; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.cloud.netflix.ribbon.RibbonClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.cloud.netflix.ribbon.RibbonClient; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.ResponseEntity; @@ -54,10 +57,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.client.RestTemplate; -import com.netflix.loadbalancer.BaseLoadBalancer; -import com.netflix.loadbalancer.ILoadBalancer; -import com.netflix.loadbalancer.Server; - +import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.BDDAssertions.then; @RunWith(JUnitParamsRunner.class) @@ -67,12 +67,12 @@ import static org.assertj.core.api.BDDAssertions.then; "spring.application.name=exceptionservice" }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class WebClientExceptionTests { - private static final Log log = LogFactory - .getLog(MethodHandles.lookup().lookupClass()); - @ClassRule public static final SpringClassRule SCR = new SpringClassRule(); + private static final Log log = LogFactory + .getLog(MethodHandles.lookup().lookupClass()); + @Rule public final SpringMethodRule springMethodRule = new SpringMethodRule(); @@ -107,7 +107,7 @@ public class WebClientExceptionTests { try (Tracer.SpanInScope ws = this.tracer.tracer().withSpanInScope(span)) { log.info("Started new span " + span); provider.get(this); - Assert.fail("should throw an exception"); + fail("should throw an exception"); } catch (RuntimeException e) { // SleuthAssertions.then(e).hasRootCauseInstanceOf(IOException.class); @@ -137,6 +137,13 @@ public class WebClientExceptionTests { } + @FunctionalInterface + interface ResponseEntityProvider { + + ResponseEntity get(WebClientExceptionTests webClientTests); + + } + @Configuration @EnableAutoConfiguration @EnableFeignClients @@ -177,11 +184,4 @@ public class WebClientExceptionTests { } - @FunctionalInterface - interface ResponseEntityProvider { - - ResponseEntity get(WebClientExceptionTests webClientTests); - - } - } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java index 55283b778..a4e1d2885 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web.client.exceptionresolver; import java.time.Instant; + import javax.servlet.http.HttpServletRequest; import brave.Span; @@ -27,6 +28,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; @@ -114,7 +116,7 @@ class CustomExceptionHandler extends ResponseEntityExceptionHandler { @Autowired private Tracing tracer; - @ExceptionHandler(value = { Exception.class }) + @ExceptionHandler(Exception.class) protected ResponseEntity handleDefaultError(Exception ex, HttpServletRequest request) { ExceptionResponse exceptionResponse = new ExceptionResponse("ERR-01", @@ -195,4 +197,4 @@ class ExceptionResponse { this.epochTime = epochTime; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java index d878f455f..2a15054e9 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java index d3dfe9c55..ef217be34 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.sleuth.instrument.web.SleuthHttpParserAccessor; @@ -105,4 +106,4 @@ public class TraceFeignAspectTests { verify(this.pjp).proceed(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java index 2d2f778b6..5b03cce80 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import org.junit.runner.RunWith; import org.mockito.BDDMockito; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.beans.factory.BeanFactory; import org.springframework.cloud.sleuth.instrument.web.SleuthHttpParserAccessor; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -136,4 +137,4 @@ public class TracingFeignClientTests { return sb.toString(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java index 5f6cc53ef..7e1dd3885 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.beans.factory.BeanFactory; import static org.assertj.core.api.BDDAssertions.then; @@ -58,4 +59,4 @@ public class TracingFeignObjectWrapperTests { .isSameAs(notFeignRelatedObject); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java index e3741d521..0bec5c77e 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,11 @@ import java.util.ArrayList; import java.util.List; import brave.sampler.Sampler; +import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -40,7 +42,13 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; -import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; +@FeignClient("participants") +interface ParticipantsClient { + + @RequestMapping(method = RequestMethod.GET, value = "/races/{raceId}") + List getParticipants(@PathVariable("raceId") String raceId); + +} public class Issue307Tests { @@ -49,6 +57,7 @@ public class Issue307Tests { try (ConfigurableApplicationContext applicationContext = SpringApplication.run( SleuthSampleApplication.class, "--spring.jmx.enabled=false", "--server.port=0")) { + // code } } @@ -117,11 +126,3 @@ class ParticipantsBean { } } - -@FeignClient("participants") -interface ParticipantsClient { - - @RequestMapping(method = RequestMethod.GET, value = "/races/{raceId}") - List getParticipants(@PathVariable("raceId") String raceId); - -} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue350/Issue350Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue350/Issue350Tests.java index 58613b518..4bbe48936 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue350/Issue350Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue350/Issue350Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,18 +23,19 @@ import brave.Tracing; import brave.sampler.Sampler; import feign.Logger; import org.junit.Before; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @@ -46,6 +47,17 @@ import org.springframework.web.bind.annotation.RestController; import static org.assertj.core.api.BDDAssertions.then; +@FeignClient(name = "myFeignClient", url = "localhost:9988") +interface MyFeignClient { + + @RequestMapping("/service/ok") + String ok(); + + @RequestMapping("/service/not-ok") + String exp(); + +} + /** * @author Marcin Grzejszczak */ @@ -129,17 +141,6 @@ class ServiceTestController { } -@FeignClient(name = "myFeignClient", url = "localhost:9988") -interface MyFeignClient { - - @RequestMapping("/service/ok") - String ok(); - - @RequestMapping("/service/not-ok") - String exp(); - -} - @RestController @RequestMapping(path = "/sleuth") class SleuthTestController { diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue362/Issue362Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue362/Issue362Tests.java index ee9f52e7d..84ebb1abe 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue362/Issue362Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue362/Issue362Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,18 +33,19 @@ import feign.Response; import feign.RetryableException; import feign.Retryer; import feign.codec.ErrorDecoder; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @@ -59,6 +60,17 @@ import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.Assertions.fail; import static org.assertj.core.api.BDDAssertions.then; +@FeignClient(value = "myFeignClient", url = "http://localhost:9998", configuration = CustomConfig.class) +interface MyFeignClient { + + @RequestMapping("/service/ok") + String ok(); + + @RequestMapping("/service/not-ok") + String exp(); + +} + /** * @author Marcin Grzejszczak */ @@ -179,11 +191,16 @@ class CustomConfig { return new Retryer.Default(); } + @Bean + public Client client(FeignComponentAsserter feignComponentAsserter) { + return new CustomClient(feignComponentAsserter); + } + public static class CustomErrorDecoder extends ErrorDecoder.Default { private final FeignComponentAsserter feignComponentAsserter; - public CustomErrorDecoder(FeignComponentAsserter feignComponentAsserter) { + CustomErrorDecoder(FeignComponentAsserter feignComponentAsserter) { this.feignComponentAsserter = feignComponentAsserter; } @@ -201,16 +218,11 @@ class CustomConfig { } - @Bean - public Client client(FeignComponentAsserter feignComponentAsserter) { - return new CustomClient(feignComponentAsserter); - } - public static class CustomClient extends Client.Default { private final FeignComponentAsserter feignComponentAsserter; - public CustomClient(FeignComponentAsserter feignComponentAsserter) { + CustomClient(FeignComponentAsserter feignComponentAsserter) { super(null, null); this.feignComponentAsserter = feignComponentAsserter; } @@ -226,17 +238,6 @@ class CustomConfig { } -@FeignClient(value = "myFeignClient", url = "http://localhost:9998", configuration = CustomConfig.class) -interface MyFeignClient { - - @RequestMapping("/service/ok") - String ok(); - - @RequestMapping("/service/not-ok") - String exp(); - -} - @RestController @RequestMapping(path = "/service") class ServiceTestController { @@ -271,4 +272,4 @@ class SleuthTestController { return this.myFeignClient.exp(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue393/Issue393Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue393/Issue393Tests.java index 7bc22cfe5..71df1714e 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue393/Issue393Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue393/Issue393Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,19 +22,20 @@ import java.util.stream.Collectors; import brave.Tracing; import brave.sampler.Sampler; import feign.okhttp.OkHttpClient; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.ResponseEntity; @@ -48,6 +49,14 @@ import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.BDDAssertions.then; +@FeignClient(name = "no-name", url = "http://localhost:9978") +interface MyNameRemote { + + @RequestMapping(value = "/name/{id}", method = RequestMethod.GET) + String getName(@PathVariable("id") String id); + +} + /** * @author Marcin Grzejszczak */ @@ -120,29 +129,21 @@ class Application { } -@FeignClient(name = "no-name", url = "http://localhost:9978") -interface MyNameRemote { - - @RequestMapping(value = "/name/{id}", method = RequestMethod.GET) - String getName(@PathVariable("id") String id); - -} - @RestController class DemoController { private final MyNameRemote myNameRemote; - public DemoController(MyNameRemote myNameRemote) { + DemoController(MyNameRemote myNameRemote) { this.myNameRemote = myNameRemote; } - @RequestMapping(value = "/hello/{name}") + @RequestMapping("/hello/{name}") public String getHello(@PathVariable("name") String name) { return this.myNameRemote.getName(name) + " foo"; } - @RequestMapping(value = "/name/{name}") + @RequestMapping("/name/{name}") public String getName(@PathVariable("name") String name) { return name; } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue502/Issue502Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue502/Issue502Tests.java index 511d6ed54..a848aaf05 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue502/Issue502Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue502/Issue502Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,17 +26,18 @@ import brave.sampler.Sampler; import feign.Client; import feign.Request; import feign.Response; -import zipkin2.Span; -import zipkin2.reporter.Reporter; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.junit4.SpringRunner; @@ -45,6 +46,14 @@ import org.springframework.web.bind.annotation.RequestMethod; import static org.assertj.core.api.BDDAssertions.then; +@FeignClient(name = "foo", url = "http://non.existing.url") +interface MyNameRemote { + + @RequestMapping(value = "/", method = RequestMethod.GET) + String get(); + +} + /** * @author Marcin Grzejszczak */ @@ -106,14 +115,6 @@ class Application { } -@FeignClient(name = "foo", url = "http://non.existing.url") -interface MyNameRemote { - - @RequestMapping(value = "/", method = RequestMethod.GET) - String get(); - -} - class MyClient implements Client { boolean wasCalled; diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java index 5c1befd43..65891cfb9 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/integration/WebClientTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,6 +108,8 @@ import static org.assertj.core.api.BDDAssertions.then; @DirtiesContext public class WebClientTests { + @ClassRule + public static final SpringClassRule SCR = new SpringClassRule(); static final String TRACE_ID_NAME = "X-B3-TraceId"; static final String SPAN_ID_NAME = "X-B3-SpanId"; static final String SAMPLED_NAME = "X-B3-Sampled"; @@ -116,9 +118,6 @@ public class WebClientTests { private static final org.apache.commons.logging.Log log = LogFactory .getLog(MethodHandles.lookup().lookupClass()); - @ClassRule - public static final SpringClassRule SCR = new SpringClassRule(); - @Rule public final SpringMethodRule springMethodRule = new SpringMethodRule(); @@ -165,6 +164,12 @@ public class WebClientTests { @Autowired MyRestTemplateCustomizer customizer; + @BeforeClass + public static void cleanup() { + Hooks.resetOnLastOperator(); + Schedulers.resetFactory(); + } + @After public void close() { this.reporter.clear(); @@ -172,12 +177,6 @@ public class WebClientTests { this.fooController.clear(); } - @BeforeClass - public static void cleanup() { - Hooks.resetOnLastOperator(); - Schedulers.resetFactory(); - } - @Test @Parameters @SuppressWarnings("unchecked") @@ -533,6 +532,14 @@ public class WebClientTests { } + @FunctionalInterface + interface ResponseEntityProvider { + + @SuppressWarnings("rawtypes") + ResponseEntity get(WebClientTests webClientTests); + + } + @Configuration @EnableAutoConfiguration(exclude = { TraceWebServletAutoConfiguration.class, GatewayClassPathWarningAutoConfiguration.class, @@ -702,12 +709,4 @@ public class WebClientTests { } - @FunctionalInterface - interface ResponseEntityProvider { - - @SuppressWarnings("rawtypes") - ResponseEntity get(WebClientTests webClientTests); - - } - -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469.java index c92e0be76..df0692844 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.web.view; import brave.sampler.Sampler; + import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; @@ -43,4 +44,4 @@ public class Issue469 extends WebMvcConfigurerAdapter { return Sampler.ALWAYS_SAMPLE; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469Tests.java index e11281013..fc8b5830d 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/view/Issue469Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web.view; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -61,4 +62,4 @@ public class Issue469Tests { return this.environment.getProperty("local.server.port", Integer.class); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilterTests.java index ecbb34acb..585d5b295 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilterTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.cloud.sleuth.instrument.zuul; import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -36,6 +37,7 @@ import org.junit.runner.RunWith; import org.mockito.BDDMockito; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.cloud.netflix.zuul.metrics.EmptyTracerFactory; import org.springframework.cloud.sleuth.instrument.web.SleuthHttpParserAccessor; import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; @@ -66,10 +68,10 @@ public class TracePostZuulFilterTests { .clientParser(SleuthHttpParserAccessor.getClient()) .serverParser(SleuthHttpParserAccessor.getServer(new ErrorParser())).build(); - private TracePostZuulFilter filter = new TracePostZuulFilter(this.httpTracing); - RequestContext requestContext = new RequestContext(); + private TracePostZuulFilter filter = new TracePostZuulFilter(this.httpTracing); + @After public void clean() { RequestContext.getCurrentContext().unset(); @@ -120,4 +122,4 @@ public class TracePostZuulFilterTests { then(this.tracing.tracer().currentSpan()).isNull(); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulIntegrationTests.java index 28abd22a3..b9046db32 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulIntegrationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ import brave.Span; import brave.Tracer; import brave.Tracing; import brave.sampler.Sampler; +import com.netflix.loadbalancer.Server; +import com.netflix.loadbalancer.ServerList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.assertj.core.api.BDDAssertions; @@ -33,12 +35,12 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.netflix.ribbon.RibbonClient; import org.springframework.cloud.netflix.ribbon.StaticServerList; @@ -46,6 +48,7 @@ import org.springframework.cloud.netflix.zuul.EnableZuulProxy; import org.springframework.cloud.netflix.zuul.filters.RouteLocator; import org.springframework.cloud.netflix.zuul.filters.ZuulProperties; import org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpEntity; @@ -61,9 +64,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.RestTemplate; -import com.netflix.loadbalancer.Server; -import com.netflix.loadbalancer.ServerList; - import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; @@ -78,9 +78,6 @@ public class TraceZuulIntegrationTests { private static final Log log = LogFactory .getLog(MethodHandles.lookup().lookupClass()); - @Value("${local.server.port}") - private int port; - @Autowired Tracing tracing; @@ -90,6 +87,9 @@ public class TraceZuulIntegrationTests { @Autowired RestTemplate restTemplate; + @Value("${local.server.port}") + private int port; + @Before @After public void cleanup() { @@ -220,7 +220,7 @@ class SampleZuulProxyApplication { class MyRouteLocator extends DiscoveryClientRouteLocator { - public MyRouteLocator(String servletPath, DiscoveryClient discovery, + MyRouteLocator(String servletPath, DiscoveryClient discovery, ZuulProperties properties) { super(servletPath, discovery, properties); } diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/issues/issue634/Issue634Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/issues/issue634/Issue634Tests.java index 63d71c38c..2384d5ba0 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/issues/issue634/Issue634Tests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/zuul/issues/issue634/Issue634Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,26 +23,27 @@ import java.util.concurrent.ConcurrentHashMap; import brave.Tracing; import brave.http.HttpTracing; import brave.sampler.Sampler; +import com.netflix.zuul.ZuulFilter; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; +import org.springframework.cloud.sleuth.util.ArrayListSpanReporter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; -import com.netflix.zuul.ZuulFilter; - import static org.assertj.core.api.BDDAssertions.then; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; @RunWith(SpringRunner.class) -@SpringBootTest(classes = TestZuulApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { +@SpringBootTest(classes = TestZuulApplication.class, webEnvironment = RANDOM_PORT, properties = { "feign.hystrix.enabled=false", "zuul.routes.dp.path:/display/**", "zuul.routes.dp.path.url: http://localhost:9987/unknown" }) @DirtiesContext @@ -100,10 +101,10 @@ class TestZuulApplication { class TraceCheckingSpanFilter extends ZuulFilter { - private final Tracing tracer; - final Map counter = new ConcurrentHashMap<>(); + private final Tracing tracer; + TraceCheckingSpanFilter(Tracing tracer) { this.tracer = tracer; } @@ -131,4 +132,4 @@ class TraceCheckingSpanFilter extends ZuulFilter { return null; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/log/Slf4JSpanLoggerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/log/Slf4JSpanLoggerTest.java index 8e818d409..9892b9923 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/log/Slf4JSpanLoggerTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/log/Slf4JSpanLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.MDC; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -129,4 +130,4 @@ public class Slf4JSpanLoggerTest { assertThat(MDC.get("traceId")).isEqualTo("A"); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfigurationTests.java index cf393e44e..0998f2754 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.propagation; import org.junit.Test; + import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration; @@ -58,4 +60,4 @@ public class SleuthTagPropagationAutoConfigurationTests { }); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandlerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandlerTest.java index 83261dcbf..1b838556f 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandlerTest.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.cloud.sleuth.propagation; import java.util.List; @@ -101,4 +102,4 @@ public class TagPropagationFinishedSpanHandlerTest { } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSamplerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSamplerTests.java index 6896a0fa1..69389a6ef 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSamplerTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSamplerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ import static org.assertj.core.api.BDDAssertions.then; */ public class ProbabilityBasedSamplerTests { - SamplerProperties samplerConfiguration = new SamplerProperties(); - private static Random RANDOM = new Random(); + SamplerProperties samplerConfiguration = new SamplerProperties(); + @Test public void should_pass_all_samples_when_config_has_1_probability() throws Exception { this.samplerConfiguration.setProbability(1f); @@ -88,4 +88,4 @@ public class ProbabilityBasedSamplerTests { return passedCounter; } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfigurationTests.java index f477706a8..e8be893ef 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfigurationTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfigurationTests.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cloud.sleuth.sampler; import brave.sampler.Sampler; @@ -29,4 +45,4 @@ public class SamplerAutoConfigurationTests { BDDAssertions.then(sampler).isInstanceOf(ProbabilityBasedSampler.class); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanNameUtilTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanNameUtilTests.java index e85d87c26..6a607557f 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanNameUtilTests.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanNameUtilTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,4 +53,4 @@ public class SpanNameUtilTests { .isEqualTo(SpanNameUtil.MAX_NAME_LENGTH); } -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanUtil.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanUtil.java index 7f3d50a66..97135bfd4 100644 --- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanUtil.java +++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/util/SpanUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,18 +20,23 @@ package org.springframework.cloud.sleuth.util; * @author Marcin Grzejszczak * @since */ -public class SpanUtil { +public final class SpanUtil { - /** - * Represents given long id as 16-character lower-hex string - */ + private SpanUtil() { + throw new IllegalStateException("Can't instantiate a utility class"); + } + + static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + + // Represents given long id as 16-character lower-hex string public static String idToHex(long id) { char[] data = new char[16]; writeHexLong(data, 0, id); return new String(data); } - /** Inspired by {@code okio.Buffer.writeLong} */ + // Inspired by {@code okio.Buffer.writeLong} static void writeHexLong(char[] data, int pos, long v) { writeHexByte(data, pos + 0, (byte) ((v >>> 56L) & 0xff)); writeHexByte(data, pos + 2, (byte) ((v >>> 48L) & 0xff)); @@ -48,7 +53,4 @@ public class SpanUtil { data[pos + 1] = HEX_DIGITS[b & 0xf]; } - static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f' }; - } diff --git a/spring-cloud-sleuth-core/src/test/resources/application-baggage.yml b/spring-cloud-sleuth-core/src/test/resources/application-baggage.yml index a17ab80d6..1467d2326 100644 --- a/spring-cloud-sleuth-core/src/test/resources/application-baggage.yml +++ b/spring-cloud-sleuth-core/src/test/resources/application-baggage.yml @@ -4,4 +4,4 @@ spring.sleuth: - bizarrecase propagation-keys: - foo - - upper_case \ No newline at end of file + - upper_case diff --git a/spring-cloud-sleuth-core/src/test/resources/application-data.yml b/spring-cloud-sleuth-core/src/test/resources/application-data.yml index 81f6bf2a9..705c014ee 100644 --- a/spring-cloud-sleuth-core/src/test/resources/application-data.yml +++ b/spring-cloud-sleuth-core/src/test/resources/application-data.yml @@ -1,3 +1,3 @@ spring.autoconfigure.exclude: spring.data.jdbc.repositories.enabled: true -spring.data.jpa.repositories.enabled: true \ No newline at end of file +spring.data.jpa.repositories.enabled: true diff --git a/spring-cloud-sleuth-core/src/test/resources/application.yml b/spring-cloud-sleuth-core/src/test/resources/application.yml index 5ca3b2e2e..1f284518b 100644 --- a/spring-cloud-sleuth-core/src/test/resources/application.yml +++ b/spring-cloud-sleuth-core/src/test/resources/application.yml @@ -22,4 +22,4 @@ logging.level.org.springframework.cloud.sleuth.instrument.web.client.feign: TRAC #disable hibernate by default spring.autoconfigure.exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration, org.springframework.cloud.gateway.config.GatewayAutoConfiguration, org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration spring.data.jdbc.repositories.enabled: false -spring.data.jpa.repositories.enabled: false \ No newline at end of file +spring.data.jpa.repositories.enabled: false diff --git a/spring-cloud-sleuth-core/src/test/resources/beans/applicationContext.xml b/spring-cloud-sleuth-core/src/test/resources/beans/applicationContext.xml index ab148c220..ca38b9f35 100644 --- a/spring-cloud-sleuth-core/src/test/resources/beans/applicationContext.xml +++ b/spring-cloud-sleuth-core/src/test/resources/beans/applicationContext.xml @@ -15,69 +15,68 @@ ~ limitations under the License. --> - + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"> - + - - + + - + - + + method="invokeProcessor" + output-channel="messagingProcessedChannel" + ref="helloWorldImpl"> + task-executor="requestExecutor"/> + output-channel="messagingOutputChannel" + message-store="messageStore" + send-partial-result-on-expiry="true"> + task-executor="requestExecutor"/> + class="org.springframework.integration.store.SimpleMessageStore"/> - - + class="org.springframework.integration.store.MessageGroupStoreReaper"> + + + service-interface="org.springframework.cloud.sleuth.instrument.messaging.issues.issue_943.MessagingGateway" + default-request-channel="messagingChannel" default-reply-timeout="10000" + default-reply-channel="splitterOutChannel"/> - - - + + + - \ No newline at end of file + diff --git a/spring-cloud-sleuth-core/src/test/resources/bootstrap-disabled.yml b/spring-cloud-sleuth-core/src/test/resources/bootstrap-disabled.yml index 7d184ec44..a2d1a7bc3 100644 --- a/spring-cloud-sleuth-core/src/test/resources/bootstrap-disabled.yml +++ b/spring-cloud-sleuth-core/src/test/resources/bootstrap-disabled.yml @@ -2,4 +2,4 @@ spring: application: name: foo sleuth: - enabled: false \ No newline at end of file + enabled: false diff --git a/spring-cloud-sleuth-core/src/test/resources/logback.xml b/spring-cloud-sleuth-core/src/test/resources/logback.xml index 9a34582f5..ef14509c1 100644 --- a/spring-cloud-sleuth-core/src/test/resources/logback.xml +++ b/spring-cloud-sleuth-core/src/test/resources/logback.xml @@ -28,4 +28,4 @@ - \ No newline at end of file + diff --git a/spring-cloud-sleuth-dependencies/pom.xml b/spring-cloud-sleuth-dependencies/pom.xml index 0c7c3c7c8..38c96b1ea 100644 --- a/spring-cloud-sleuth-dependencies/pom.xml +++ b/spring-cloud-sleuth-dependencies/pom.xml @@ -15,14 +15,15 @@ ~ limitations under the License. --> - 4.0.0 spring-cloud-dependencies-parent org.springframework.cloud 2.1.3.BUILD-SNAPSHOT - + spring-cloud-sleuth-dependencies 2.1.1.BUILD-SNAPSHOT diff --git a/spring-cloud-sleuth-samples/pom.xml b/spring-cloud-sleuth-samples/pom.xml index 8f651edf0..2f27e64a9 100644 --- a/spring-cloud-sleuth-samples/pom.xml +++ b/spring-cloud-sleuth-samples/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml index 075043b7d..49b4489d3 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/pom.xml @@ -15,8 +15,9 @@ ~ limitations under the License. --> - + 4.0.0 spring-cloud-sleuth-sample-feign diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleController.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleController.java index 8e28f8733..a1327a8ee 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleController.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +@FeignClient("zipkin") +interface Zipkin { + + @RequestMapping(value = "/call", method = RequestMethod.GET) + String call(); + + @RequestMapping(value = "/hi2", method = RequestMethod.GET) + String hi2(); + +} + /** * @author Spencer Gibb * @author Dave Syer @@ -54,14 +65,3 @@ public class SampleController { } } - -@FeignClient("zipkin") -interface Zipkin { - - @RequestMapping(value = "/call", method = RequestMethod.GET) - String call(); - - @RequestMapping(value = "/hi2", method = RequestMethod.GET) - String hi2(); - -} \ No newline at end of file diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleFeignApplication.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleFeignApplication.java index 3c368e755..92213cd19 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleFeignApplication.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/java/sample/SampleFeignApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,15 +18,15 @@ package sample; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; -import zipkin2.Span; -import zipkin2.reporter.Reporter; - /** * @author Spencer Gibb */ diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/resources/application.yml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/resources/application.yml index 22384ba49..fe81ced75 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/resources/application.yml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/main/resources/application.yml @@ -9,4 +9,4 @@ sample: spring: application: - name: testSleuthFeign \ No newline at end of file + name: testSleuthFeign diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/test/java/sample/SampleFeignApplicationTests.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/test/java/sample/SampleFeignApplicationTests.java index c3dc8d9a9..da6caf43d 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/test/java/sample/SampleFeignApplicationTests.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-feign/src/test/java/sample/SampleFeignApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/pom.xml index 6ef35980b..a0683af37 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleBackground.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleBackground.java index 05a75c961..79fb2e077 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleBackground.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleBackground.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package sample; import java.util.Random; import brave.Tracer; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleMessagingApplication.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleMessagingApplication.java index 375dafe55..faf7ab40c 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleMessagingApplication.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleMessagingApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,10 @@ public class SampleMessagingApplication { @Autowired private SampleRequestResponse transformer; + public static void main(String[] args) { + SpringApplication.run(SampleMessagingApplication.class, args); + } + @RequestMapping("/") public String home() { String msg = "Hello"; @@ -65,8 +69,4 @@ public class SampleMessagingApplication { return new RestTemplate(); } - public static void main(String[] args) { - SpringApplication.run(SampleMessagingApplication.class, args); - } - } diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleRequestResponse.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleRequestResponse.java index a11626c30..0654f79cb 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleRequestResponse.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleRequestResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleService.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleService.java index c4c5b6b4d..5bc565624 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleService.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent; import org.springframework.context.ApplicationListener; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleSink.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleSink.java index 7a99b309f..314814626 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleSink.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleSink.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleTransformer.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleTransformer.java index 44816ac4e..a0478b202 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleTransformer.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/main/java/sample/SampleTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/IntegrationTestZipkinSpanReporter.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/IntegrationTestZipkinSpanReporter.java index f42866e73..e23e2bfd1 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/IntegrationTestZipkinSpanReporter.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/IntegrationTestZipkinSpanReporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package integration; import java.util.Collections; @@ -20,12 +21,11 @@ import java.util.LinkedList; import java.util.List; import org.apache.commons.logging.Log; - import zipkin2.Span; import zipkin2.reporter.Reporter; /** - * Span Collector that logs spans and adds Spans to a list + * Span Collector that logs spans and adds Spans to a list. * * @author Marcin Grzejszczak */ diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/MessagingApplicationTests.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/MessagingApplicationTests.java index 2ec3b8c4f..14c312a5b 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/MessagingApplicationTests.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/integration/MessagingApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package integration; import java.util.List; @@ -22,14 +23,15 @@ import java.util.stream.Collectors; import brave.sampler.Sampler; import integration.MessagingApplicationTests.IntegrationSpanCollectorConfig; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; import sample.SampleMessagingApplication; import tools.AbstractIntegrationTest; import tools.SpanUtil; import zipkin2.Span; import zipkin2.reporter.Reporter; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/sample/SampleMessagingApplicationTests.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/sample/SampleMessagingApplicationTests.java index 92a95b77d..b382457c2 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/sample/SampleMessagingApplicationTests.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-messaging/src/test/java/sample/SampleMessagingApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/pom.xml index bb4d50f2f..f07606e1b 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleController.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleController.java index 82cfd5dfd..c2270fc7c 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleController.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleRibbonApplication.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleRibbonApplication.java index a66528d15..01dcb83dc 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleRibbonApplication.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/main/java/sample/SampleRibbonApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,9 @@ package sample; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import zipkin2.Span; +import zipkin2.reporter.Reporter; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -26,9 +29,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.client.RestTemplate; -import zipkin2.Span; -import zipkin2.reporter.Reporter; - /** * @author Spencer Gibb */ diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/test/java/sample/SampleRibbonApplicationTests.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/test/java/sample/SampleRibbonApplicationTests.java index 2978d2c88..f6eb27ee5 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/test/java/sample/SampleRibbonApplicationTests.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-ribbon/src/test/java/sample/SampleRibbonApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/pom.xml index 23b566c28..89d46a315 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AbstractIntegrationTest.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AbstractIntegrationTest.java index 8dd2dd4df..7745f9e78 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AbstractIntegrationTest.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AbstractIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package tools; import java.lang.invoke.MethodHandles; @@ -21,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.awaitility.Awaitility; import org.awaitility.core.ConditionFactory; + import org.springframework.web.client.RestTemplate; import static java.util.concurrent.TimeUnit.SECONDS; @@ -39,6 +41,11 @@ public abstract class AbstractIntegrationTest { protected final RestTemplate restTemplate = new AssertingRestTemplate(); + public static ConditionFactory await() { + return Awaitility.await().pollInterval(POLL_INTERVAL, SECONDS).atMost(TIMEOUT, + SECONDS); + } + protected Runnable httpMessageWithTraceIdInHeadersIsSuccessfullySent(String endpoint, long traceId) { return new RequestSendingRunnable(this.restTemplate, endpoint, traceId, traceId); @@ -49,9 +56,4 @@ public abstract class AbstractIntegrationTest { return new RequestSendingRunnable(this.restTemplate, endpoint, traceId, spanId); } - public static ConditionFactory await() { - return Awaitility.await().pollInterval(POLL_INTERVAL, SECONDS).atMost(TIMEOUT, - SECONDS); - } - } diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AssertingRestTemplate.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AssertingRestTemplate.java index e1d74c00b..4f9273216 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AssertingRestTemplate.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/AssertingRestTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package tools; import java.io.IOException; @@ -20,6 +21,7 @@ import java.net.URI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.http.HttpMethod; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.DefaultResponseErrorHandler; @@ -31,7 +33,7 @@ import org.springframework.web.client.RestTemplate; /** * * RestTemplate that logs erroneous responses and throws AssertionsError on any connection - * issues + * issues. * * @author Marcin Grzejszczak */ diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/RequestSendingRunnable.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/RequestSendingRunnable.java index c358a1e64..af4b1aa5f 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/RequestSendingRunnable.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/RequestSendingRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package tools; import java.net.URI; @@ -20,6 +21,7 @@ import java.util.Random; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/SpanUtil.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/SpanUtil.java index e011d2995..2e63b95d2 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/SpanUtil.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-test-core/src/main/java/tools/SpanUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,23 @@ package tools; -public class SpanUtil { +public final class SpanUtil { - /** - * Represents given long id as 16-character lower-hex string - */ + private SpanUtil() { + throw new IllegalStateException("Can't instantiate a utility class"); + } + + static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + + // Represents given long id as 16-character lower-hex string public static String idToHex(long id) { char[] data = new char[16]; writeHexLong(data, 0, id); return new String(data); } - /** Inspired by {@code okio.Buffer.writeLong} */ + // Inspired by {@code okio.Buffer.writeLong} static void writeHexLong(char[] data, int pos, long v) { writeHexByte(data, pos + 0, (byte) ((v >>> 56L) & 0xff)); writeHexByte(data, pos + 2, (byte) ((v >>> 48L) & 0xff)); @@ -44,7 +49,4 @@ public class SpanUtil { data[pos + 1] = HEX_DIGITS[b & 0xf]; } - static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f' }; - -} \ No newline at end of file +} diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/pom.xml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/pom.xml index 64dbec203..f1f07ce15 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/pom.xml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/pom.xml @@ -15,8 +15,8 @@ ~ limitations under the License. --> - 4.0.0 diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/GreetingController.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/GreetingController.java index 288dc14ab..7697f48ed 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/GreetingController.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/GreetingController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package sample; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Controller; @@ -42,7 +43,7 @@ class Greeting { private String content; - public Greeting(String content) { + Greeting(String content) { this.content = content; } @@ -56,7 +57,7 @@ class HelloMessage { private String name; - public String getName() { + String getName() { return this.name; } diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/SampleWebsocketApplication.java b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/SampleWebsocketApplication.java index ef505e69a..f0f8689cd 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/SampleWebsocketApplication.java +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/java/sample/SampleWebsocketApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2018 the original author or authors. + * Copyright 2013-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,10 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry; @EnableWebSocketMessageBroker public class SampleWebsocketApplication extends AbstractWebSocketMessageBrokerConfigurer { + public static void main(String[] args) { + SpringApplication.run(SampleWebsocketApplication.class, args); + } + @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); @@ -38,8 +42,4 @@ public class SampleWebsocketApplication extends AbstractWebSocketMessageBrokerCo registry.addEndpoint("/hello").withSockJS(); } - public static void main(String[] args) { - SpringApplication.run(SampleWebsocketApplication.class, args); - } - } diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/resources/static/index.html b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/resources/static/index.html index dfe7019f0..92849123a 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/resources/static/index.html +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-websocket/src/main/resources/static/index.html @@ -22,26 +22,26 @@ -