From 9d296a47b6efc0c18c3d62f5d736b6def7960c3b Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 5 Jul 2016 09:57:51 +0100 Subject: [PATCH] Add small sample app to README --- README.adoc | 30 ++++++++++++++++++++++++++++++ docs/src/main/asciidoc/README.adoc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/README.adoc b/README.adoc index 80b9f038f..dd09385f2 100644 --- a/README.adoc +++ b/README.adoc @@ -6,6 +6,36 @@ image::https://api.travis-ci.org/spring-cloud/spring-cloud-sleuth.svg?branch=mas image::https://badges.gitter.im/spring-cloud/spring-cloud-sleuth.svg[Gitter, link="https://gitter.im/spring-cloud/spring-cloud-sleuth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"] == Spring Cloud Sleuth +=== Quick Start + +Add sleuth to the classpath of a Spring Boot application (see below +for Maven and Gradle examples), and you will see the correlation data being +collected in logs, as long as you are logging requests. + +Example HTTP handler: + +[source,java] +---- +@RestController +public class DemoController { + private static Logger log = LoggerFactory.getLogger(DemoController.class); + @RequestMapping("/") + public String home() { + log.info("Handling home"); + ... + return "Hello World"; + } +} +---- + +You will see the calls to `home()` traced in the logs and in Zipkin, if that is configured. + +NOTE: instead of logging the request in the handler explicitly, you +could set `logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG` + +NOTE: Set `spring.application.name=bar` (for instance) to see the +service name as well as the trace and span ids. + Spring Cloud Sleuth implements a distributed tracing solution for http://cloud.spring.io[Spring Cloud]. === Terminology diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 8a946ee0a..b5bd95eea 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -4,6 +4,36 @@ image::https://api.travis-ci.org/spring-cloud/spring-cloud-sleuth.svg?branch=mas image::https://badges.gitter.im/spring-cloud/spring-cloud-sleuth.svg[Gitter, link="https://gitter.im/spring-cloud/spring-cloud-sleuth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"] == Spring Cloud Sleuth +=== Quick Start + +Add sleuth to the classpath of a Spring Boot application (see below +for Maven and Gradle examples), and you will see the correlation data being +collected in logs, as long as you are logging requests. + +Example HTTP handler: + +[source,java] +---- +@RestController +public class DemoController { + private static Logger log = LoggerFactory.getLogger(DemoController.class); + @RequestMapping("/") + public String home() { + log.info("Handling home"); + ... + return "Hello World"; + } +} +---- + +You will see the calls to `home()` traced in the logs and in Zipkin, if that is configured. + +NOTE: instead of logging the request in the handler explicitly, you +could set `logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG` + +NOTE: Set `spring.application.name=bar` (for instance) to see the +service name as well as the trace and span ids. + include::intro.adoc[] include::features.adoc[]