Add small sample app to README

This commit is contained in:
Dave Syer
2016-07-05 09:57:51 +01:00
parent 384b78b86c
commit 9d296a47b6
2 changed files with 60 additions and 0 deletions

View File

@@ -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

View File

@@ -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[]