From 0ce00291b6b5a4984109f24a05eb248fb7dde801 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 4 Jun 2020 15:52:32 +0200 Subject: [PATCH] Updated adocs --- README.adoc | 77 ++++++++++--------- docs/pom.xml | 2 - docs/src/main/asciidoc/features.adoc | 2 + docs/src/main/asciidoc/setup.adoc | 10 +-- .../main/asciidoc/spring-cloud-sleuth.adoc | 4 + 5 files changed, 51 insertions(+), 44 deletions(-) diff --git a/README.adoc b/README.adoc index d725f00a2..ee1effd51 100644 --- a/README.adoc +++ b/README.adoc @@ -4,6 +4,7 @@ Manual changes to this file will be lost when it is generated again. Edit the files in the src/main/asciidoc/ directory instead. //// + :jdkversion: 1.8 :github-tag: master :github-repo: spring-cloud/spring-cloud-sleuth @@ -146,8 +147,10 @@ message. Paste that into Zipkin to visualize the entire trace, regardless of how many services the first request ended up hitting. [source] +---- backend.log: 2020-04-09 17:45:40.516 ERROR [backend,5e8eeec48b08e26882aba313eb08f0a4,dcc1df555b5777b3,true] 97203 --- [nio-9000-exec-1] o.s.c.s.i.web.ExceptionLoggingFilter : Uncaught exception thrown frontend.log:2020-04-09 17:45:40.574 ERROR [frontend,5e8eeec48b08e26882aba313eb08f0a4,82aba313eb08f0a4,true] 97192 --- [nio-8081-exec-2] o.s.c.s.i.web.ExceptionLoggingFilter : Uncaught exception thrown +---- Above, you'll notice the trace ID is `5e8eeec48b08e26882aba313eb08f0a4`, for example. This log configuration was automatically setup by Sleuth. @@ -229,8 +232,8 @@ If you want both Sleuth and Zipkin, add the `spring-cloud-starter-zipkin` depend The following example shows how to do so for Maven: -[source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven +[source,xml,indent=0,subs="verbatim,attributes",role="primary"] ---- <1> @@ -254,8 +257,8 @@ The following example shows how to do so for Maven: The following example shows how to do so for Gradle: -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { @@ -289,8 +292,8 @@ dependencies. The following example shows how to do so for Gradle: -[source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven +[source,xml,indent=0,subs="verbatim,attributes",role="primary"] ---- <1> @@ -317,8 +320,8 @@ The following example shows how to do so for Gradle: <2> Add the dependency to `spring-cloud-starter-zipkin`. That way, all nested dependencies get downloaded. <3> To automatically configure RabbitMQ, add the `spring-rabbit` dependency. -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { @@ -348,46 +351,46 @@ To do this you can use respectively `ZipkinAutoConfiguration.REPORTER_BEAN_NAME` @Configuration protected static class MyConfig { - @Bean(ZipkinAutoConfiguration.REPORTER_BEAN_NAME) - Reporter myReporter() { - return AsyncReporter.create(mySender()); - } + @Bean(ZipkinAutoConfiguration.REPORTER_BEAN_NAME) + Reporter myReporter() { + return AsyncReporter.create(mySender()); + } - @Bean(ZipkinAutoConfiguration.SENDER_BEAN_NAME) - MySender mySender() { - return new MySender(); - } + @Bean(ZipkinAutoConfiguration.SENDER_BEAN_NAME) + MySender mySender() { + return new MySender(); + } - static class MySender extends Sender { + static class MySender extends Sender { - private boolean spanSent = false; + private boolean spanSent = false; - boolean isSpanSent() { - return this.spanSent; - } + boolean isSpanSent() { + return this.spanSent; + } - @Override - public Encoding encoding() { - return Encoding.JSON; - } + @Override + public Encoding encoding() { + return Encoding.JSON; + } - @Override - public int messageMaxBytes() { - return Integer.MAX_VALUE; - } + @Override + public int messageMaxBytes() { + return Integer.MAX_VALUE; + } - @Override - public int messageSizeInBytes(List encodedSpans) { - return encoding().listSizeInBytes(encodedSpans); - } + @Override + public int messageSizeInBytes(List encodedSpans) { + return encoding().listSizeInBytes(encodedSpans); + } - @Override - public Call sendSpans(List encodedSpans) { - this.spanSent = true; - return Call.create(null); - } + @Override + public Call sendSpans(List encodedSpans) { + this.spanSent = true; + return Call.create(null); + } - } + } } @@ -424,8 +427,8 @@ The following example shows how to add Sleuth with Maven: The following example shows how to add Sleuth with Gradle: -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { @@ -721,4 +724,4 @@ Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on t - `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL. - `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. -IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. \ No newline at end of file +IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. diff --git a/docs/pom.xml b/docs/pom.xml index 8803d7113..f73b816bb 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -30,8 +30,6 @@ Spring Sleuth Docs spring-cloud-sleuth - - 2.1.x,2.2.x ${basedir}/.. spring.sleuth.*|spring.zipkin.* deploy diff --git a/docs/src/main/asciidoc/features.adoc b/docs/src/main/asciidoc/features.adoc index 153e1a9ea..d77b06e58 100644 --- a/docs/src/main/asciidoc/features.adoc +++ b/docs/src/main/asciidoc/features.adoc @@ -43,8 +43,10 @@ message. Paste that into Zipkin to visualize the entire trace, regardless of how many services the first request ended up hitting. [source] +---- backend.log: 2020-04-09 17:45:40.516 ERROR [backend,5e8eeec48b08e26882aba313eb08f0a4,dcc1df555b5777b3,true] 97203 --- [nio-9000-exec-1] o.s.c.s.i.web.ExceptionLoggingFilter : Uncaught exception thrown frontend.log:2020-04-09 17:45:40.574 ERROR [frontend,5e8eeec48b08e26882aba313eb08f0a4,82aba313eb08f0a4,true] 97192 --- [nio-8081-exec-2] o.s.c.s.i.web.ExceptionLoggingFilter : Uncaught exception thrown +---- Above, you'll notice the trace ID is `5e8eeec48b08e26882aba313eb08f0a4`, for example. This log configuration was automatically setup by Sleuth. diff --git a/docs/src/main/asciidoc/setup.adoc b/docs/src/main/asciidoc/setup.adoc index 45afa9217..33feb2b06 100644 --- a/docs/src/main/asciidoc/setup.adoc +++ b/docs/src/main/asciidoc/setup.adoc @@ -13,8 +13,8 @@ If you want both Sleuth and Zipkin, add the `spring-cloud-starter-zipkin` depend The following example shows how to do so for Maven: -[source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven +[source,xml,indent=0,subs="verbatim,attributes",role="primary"] ---- <1> @@ -38,8 +38,8 @@ The following example shows how to do so for Maven: The following example shows how to do so for Gradle: -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { @@ -73,8 +73,8 @@ dependencies. The following example shows how to do so for Gradle: -[source,xml,indent=0,subs="verbatim,attributes",role="primary"] .Maven +[source,xml,indent=0,subs="verbatim,attributes",role="primary"] ---- <1> @@ -101,8 +101,8 @@ The following example shows how to do so for Gradle: <2> Add the dependency to `spring-cloud-starter-zipkin`. That way, all nested dependencies get downloaded. <3> To automatically configure RabbitMQ, add the `spring-rabbit` dependency. -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { @@ -162,8 +162,8 @@ The following example shows how to add Sleuth with Maven: The following example shows how to add Sleuth with Gradle: -[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] .Gradle +[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"] ---- dependencyManagement { <1> imports { diff --git a/docs/src/main/asciidoc/spring-cloud-sleuth.adoc b/docs/src/main/asciidoc/spring-cloud-sleuth.adoc index 2e5eb8bb9..0a1a5888b 100644 --- a/docs/src/main/asciidoc/spring-cloud-sleuth.adoc +++ b/docs/src/main/asciidoc/spring-cloud-sleuth.adoc @@ -1016,6 +1016,7 @@ image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/{branc If you want to use https://www.elastic.co/guide/en/logstash/current/index.html[Logstash], the following listing shows the Grok pattern for Logstash: [source] +---- filter { # pattern matching logback pattern grok { @@ -1028,9 +1029,11 @@ filter { remove_field => ["timestamp"] } } +---- NOTE: If you want to use Grok together with the logs from Cloud Foundry, you have to use the following pattern: [source] +---- filter { # pattern matching logback pattern grok { @@ -1043,6 +1046,7 @@ filter { remove_field => ["timestamp"] } } +---- === JSON Logback with Logstash