1438 lines
60 KiB
HTML
1438 lines
60 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="Asciidoctor 1.5.8">
|
||
<title>Spring Cloud Sleuth</title>
|
||
<link rel="stylesheet" href="css/spring.css">
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||
|
||
<style>
|
||
.hidden {
|
||
display: none;
|
||
}
|
||
|
||
.switch {
|
||
border-width: 1px 1px 0 1px;
|
||
border-style: solid;
|
||
border-color: #7a2518;
|
||
display: inline-block;
|
||
}
|
||
|
||
.switch--item {
|
||
padding: 10px;
|
||
background-color: #ffffff;
|
||
color: #7a2518;
|
||
display: inline-block;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.switch--item:not(:first-child) {
|
||
border-width: 0 0 0 1px;
|
||
border-style: solid;
|
||
border-color: #7a2518;
|
||
}
|
||
|
||
.switch--item.selected {
|
||
background-color: #7a2519;
|
||
color: #ffffff;
|
||
}
|
||
</style>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
|
||
<script type="text/javascript">
|
||
function addBlockSwitches() {
|
||
$('.primary').each(function() {
|
||
primary = $(this);
|
||
createSwitchItem(primary, createBlockSwitch(primary)).item.addClass("selected");
|
||
primary.children('.title').remove();
|
||
});
|
||
$('.secondary').each(function(idx, node) {
|
||
secondary = $(node);
|
||
primary = findPrimary(secondary);
|
||
switchItem = createSwitchItem(secondary, primary.children('.switch'));
|
||
switchItem.content.addClass('hidden');
|
||
findPrimary(secondary).append(switchItem.content);
|
||
secondary.remove();
|
||
});
|
||
}
|
||
|
||
function createBlockSwitch(primary) {
|
||
blockSwitch = $('<div class="switch"></div>');
|
||
primary.prepend(blockSwitch);
|
||
return blockSwitch;
|
||
}
|
||
|
||
function findPrimary(secondary) {
|
||
candidate = secondary.prev();
|
||
while (!candidate.is('.primary')) {
|
||
candidate = candidate.prev();
|
||
}
|
||
return candidate;
|
||
}
|
||
|
||
function createSwitchItem(block, blockSwitch) {
|
||
blockName = block.children('.title').text();
|
||
content = block.children('.content').first().append(block.next('.colist'));
|
||
item = $('<div class="switch--item">' + blockName + '</div>');
|
||
item.on('click', '', content, function(e) {
|
||
$(this).addClass('selected');
|
||
$(this).siblings().removeClass('selected');
|
||
e.data.siblings('.content').addClass('hidden');
|
||
e.data.removeClass('hidden');
|
||
});
|
||
blockSwitch.append(item);
|
||
return {'item': item, 'content': content};
|
||
}
|
||
|
||
function globalSwitch() {
|
||
$('.switch--item').each(function() {
|
||
$(this).off('click');
|
||
$(this).on('click', function() {
|
||
selectedText = $(this).text()
|
||
selectedIndex = $(this).index()
|
||
$(".switch--item").filter(function() { return ($(this).text() === selectedText) }).each(function() {
|
||
$(this).addClass('selected');
|
||
$(this).siblings().removeClass('selected');
|
||
selectedContent = $(this).parent().siblings(".content").eq(selectedIndex)
|
||
selectedContent.removeClass('hidden');
|
||
selectedContent.siblings().addClass('hidden');
|
||
});
|
||
});
|
||
});
|
||
}
|
||
|
||
$(addBlockSwitches);
|
||
$(globalSwitch);
|
||
|
||
</script>
|
||
|
||
</head>
|
||
<body class="book toc2 toc-left">
|
||
<div id="header">
|
||
<div id="toc" class="toc2">
|
||
<div id="toctitle">Table of Contents</div>
|
||
<ul class="sectlevel1">
|
||
<li><a href="#_spring_cloud_sleuth">Spring Cloud Sleuth</a>
|
||
<ul class="sectlevel2">
|
||
<li><a href="#_quick_start">Quick Start</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="#_overview">Overview</a></li>
|
||
<li><a href="#features">1. Features</a>
|
||
<ul class="sectlevel2">
|
||
<li><a href="#contextualizing-errors">1.1. Contextualizing errors</a></li>
|
||
<li><a href="#log-correlation">1.2. Log correlation</a></li>
|
||
<li><a href="#service-dependency-graph">1.3. Service Dependency Graph</a></li>
|
||
<li><a href="#request-scoped-properties-baggage">1.4. Request scoped properties (Baggage)</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="#sleuth-adding-project">2. Adding Sleuth to your Project</a>
|
||
<ul class="sectlevel2">
|
||
<li><a href="#sleuth-with-zipkin-via-http">2.1. Sleuth with Zipkin via HTTP</a></li>
|
||
<li><a href="#sleuth-with-zipkin-over-rabbitmq-or-kafka">2.2. Sleuth with Zipkin over RabbitMQ or Kafka</a></li>
|
||
<li><a href="#overriding-the-auto-configuration-of-zipkin">2.3. Overriding the auto-configuration of Zipkin</a></li>
|
||
<li><a href="#only-sleuth-log-correlation">2.4. Only Sleuth (log correlation)</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="#building">3. Building</a>
|
||
<ul class="sectlevel2">
|
||
<li><a href="#basic-compile-and-test">3.1. Basic Compile and Test</a></li>
|
||
<li><a href="#documentation">3.2. Documentation</a></li>
|
||
<li><a href="#working-with-the-code">3.3. Working with the code</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="#contributing">4. Contributing</a>
|
||
<ul class="sectlevel2">
|
||
<li><a href="#sign-the-contributor-license-agreement">4.1. Sign the Contributor License Agreement</a></li>
|
||
<li><a href="#code-of-conduct">4.2. Code of Conduct</a></li>
|
||
<li><a href="#code-conventions-and-housekeeping">4.3. Code Conventions and Housekeeping</a></li>
|
||
<li><a href="#checkstyle">4.4. Checkstyle</a></li>
|
||
<li><a href="#ide-setup">4.5. IDE setup</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="content">
|
||
<div id="preamble">
|
||
<div class="sectionbody">
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<a class="image" href="https://circleci.com/gh/spring-cloud/spring-cloud-sleuth"><img src="https://circleci.com/gh/spring-cloud/spring-cloud-sleuth.svg?style=svg" alt="CircleCI"></a>
|
||
</div>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<a class="image" href="https://codecov.io/gh/spring-cloud/spring-cloud-sleuth"><img src="https://codecov.io/gh/spring-cloud/spring-cloud-sleuth/branch/master/graph/badge.svg" alt="codecov"></a>
|
||
</div>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<a class="image" href="https://gitter.im/spring-cloud/spring-cloud-sleuth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/spring-cloud/spring-cloud-sleuth.svg" alt="Gitter"></a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="_spring_cloud_sleuth"><a class="link" href="#_spring_cloud_sleuth">Spring Cloud Sleuth</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="paragraph">
|
||
<p>Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed
|
||
tracing. Underneath, Spring Cloud Sleuth is a layer over a tracer library named
|
||
<a href="https://github.com/openzipkin/brave">Brave</a>.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Sleuth configures everything you need to get started. This includes where trace
|
||
data (spans) are reported to, how many traces to keep (sampling), if remote
|
||
fields (baggage) are sent, and which libraries are traced.</p>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="_quick_start"><a class="link" href="#_quick_start">Quick Start</a></h3>
|
||
<div class="paragraph">
|
||
<p>Add sleuth to the classpath of a Spring Boot application
|
||
(see “<a href="#sleuth-adding-project">Adding Sleuth to your Project</a>” for Maven and Gradle examples), and you will
|
||
see trace IDs in logs.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>For example, consider the following HTTP handler:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@RestController
|
||
public class DemoController {
|
||
private static Logger log = LoggerFactory.getLogger(DemoController.class);
|
||
|
||
@RequestMapping("/")
|
||
public String home() {
|
||
log.info("Handling home");
|
||
...
|
||
return "Hello World";
|
||
}
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you add that handler to a controller, you can see the calls to <code>home()</code>
|
||
being traced in the logs as well in <a href="https://zipkin.io/">Zipkin</a>, if configured.</p>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
Instead of logging the request in the handler explicitly, you
|
||
could set <code>logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG</code>.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
Set <code>spring.application.name=myService</code> (for instance) to see the service
|
||
name as well as the trace and span IDs.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="_overview"><a class="link" href="#_overview">Overview</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="paragraph">
|
||
<p>Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed
|
||
tracing. Underneath, Spring Cloud Sleuth is a layer over a Tracer library named
|
||
<a href="https://github.com/openzipkin/brave">Brave</a>.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Sleuth configures everything you need to get started. This includes where trace
|
||
data (spans) are reported to, how many traces to keep (sampling), if remote
|
||
fields (baggage) are sent, and which libraries are traced.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>We maintain an <a href="https://github.com/openzipkin/sleuth-webmvc-example">example app</a> where two Spring Boot services collaborate on an
|
||
HTTP request. Sleuth configures these apps, so that timing of these requests are
|
||
recorded into <a href="https://zipkin.io">Zipkin</a>, a distributed tracing system. Tracing
|
||
UIs visualize latency, such as time in one service vs waiting for other
|
||
services.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Here’s an example of what it looks like:</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/docs/src/main/asciidoc/images/zipkin-trace-screenshot.png" alt="Zipkin Trace">
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The <a href="https://github.com/openzipkin/sleuth-webmvc-example">source repository</a> of this
|
||
example includes demonstrations of many things, including WebFlux and messaging.
|
||
Most features require only a property or dependency change to work. These
|
||
snippets showcase the value of Spring Cloud Sleuth: Through auto-configuration,
|
||
Sleuth make getting started with distributed tracing easy!</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>To keep things simple, the same example is used throughout documentation using
|
||
basic HTTP communication.</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="features"><a class="anchor" href="#features"></a><a class="link" href="#features">1. Features</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="paragraph">
|
||
<p>Sleuth sets up instrumentation not only to track timing, but also to catch
|
||
errors so that they can be analyzed or correlated with logs. This works the
|
||
same way regardless of if the error came from a common instrumented library,
|
||
such as <code>RestTemplate</code>, or your own code annotated with <code>@NewSpan</code> or similar.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Below, we’ll use the word Zipkin to describe the tracing system, and include
|
||
Zipkin screenshots. However, most services accepting <a href="https://zipkin.io/zipkin-api/#/default/post_spans">Zipkin format</a>
|
||
have similar base features. Sleuth can also be configured to send data in other
|
||
formats, something detailed later.</p>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="contextualizing-errors"><a class="anchor" href="#contextualizing-errors"></a><a class="link" href="#contextualizing-errors">1.1. Contextualizing errors</a></h3>
|
||
<div class="paragraph">
|
||
<p>Without distributed tracing, it can be difficult to understand the impact of a
|
||
an exception. For example, it can be hard to know if a specific request caused
|
||
the caller to fail or not.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Zipkin reduces time in triage by contextualizing errors and delays.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Requests colored red in the search screen failed:</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/docs/src/main/asciidoc/images/zipkin-error-traces.png" alt="Error Traces">
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you then click on one of the traces, you can understand if the failure
|
||
happened before the request hit another service or not:</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/docs/src/main/asciidoc/images/zipkin-error-trace-screenshot.png" alt="Error Traces Info propagation">
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>For example, the above error happened in the "backend" service, and caused the
|
||
"frontend" service to fail.</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="log-correlation"><a class="anchor" href="#log-correlation"></a><a class="link" href="#log-correlation">1.2. Log correlation</a></h3>
|
||
<div class="paragraph">
|
||
<p>Sleuth configures the logging context with variables including the service name
|
||
(<code>%{spring.zipkin.service.name}</code>) and the trace ID (<code>%{traceId}</code>). These help
|
||
you connect logs with distributed traces and allow you choice in what tools you
|
||
use to troubleshoot your services.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Once you find any log with an error, you can look for the trace ID in the
|
||
message. Paste that into Zipkin to visualize the entire trace, regardless of
|
||
how many services the first request ended up hitting.</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code>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</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Above, you’ll notice the trace ID is <code>5e8eeec48b08e26882aba313eb08f0a4</code>, for
|
||
example. This log configuration was automatically setup by Sleuth.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you use a log aggregating tool (such as <a href="https://www.elastic.co/products/kibana">Kibana</a>, <a href="https://www.splunk.com/">Splunk</a>, and others), you can order the events that took place.
|
||
An example from Kibana would resemble the following image:</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/docs/src/main/asciidoc/images/kibana.png" alt="Log correlation with Kibana">
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you want to use <a href="https://www.elastic.co/guide/en/logstash/current/index.html">Logstash</a>, the following listing shows the Grok pattern for Logstash:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code>filter {
|
||
# pattern matching logback pattern
|
||
grok {
|
||
match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
|
||
}
|
||
date {
|
||
match => ["timestamp", "ISO8601"]
|
||
}
|
||
mutate {
|
||
remove_field => ["timestamp"]
|
||
}
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
If you want to use Grok together with the logs from Cloud Foundry, you have to use the following pattern:
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code>filter {
|
||
# pattern matching logback pattern
|
||
grok {
|
||
match => { "message" => "(?m)OUT\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
|
||
}
|
||
date {
|
||
match => ["timestamp", "ISO8601"]
|
||
}
|
||
mutate {
|
||
remove_field => ["timestamp"]
|
||
}
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="sect3">
|
||
<h4 id="json-logback-with-logstash"><a class="anchor" href="#json-logback-with-logstash"></a><a class="link" href="#json-logback-with-logstash">1.2.1. JSON Logback with Logstash</a></h4>
|
||
<div class="paragraph">
|
||
<p>Often, you do not want to store your logs in a text file but in a JSON file that Logstash can immediately pick.
|
||
To do so, you have to do the following (for readability, we pass the dependencies in the <code>groupId:artifactId:version</code> notation).</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p><strong>Dependencies Setup</strong></p>
|
||
</div>
|
||
<div class="olist arabic">
|
||
<ol class="arabic">
|
||
<li>
|
||
<p>Ensure that Logback is on the classpath (<code>ch.qos.logback:logback-core</code>).</p>
|
||
</li>
|
||
<li>
|
||
<p>Add Logstash Logback encode. For example, to use version <code>4.6</code>, add <code>net.logstash.logback:logstash-logback-encoder:4.6</code>.</p>
|
||
</li>
|
||
</ol>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p><strong>Logback Setup</strong></p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Consider the following example of a Logback configuration file (logback-spring.xml).</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||
<configuration>
|
||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
|
||
<!-- Example for logging into the build folder of your project -->
|
||
<property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
|
||
|
||
<!-- You can override this to have a custom pattern -->
|
||
<property name="CONSOLE_LOG_PATTERN"
|
||
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||
|
||
<!-- Appender to log to console -->
|
||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||
<!-- Minimum logging level to be presented in the console logs-->
|
||
<level>DEBUG</level>
|
||
</filter>
|
||
<encoder>
|
||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||
<charset>utf8</charset>
|
||
</encoder>
|
||
</appender>
|
||
|
||
<!-- Appender to log to file -->
|
||
<appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||
<file>${LOG_FILE}</file>
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>
|
||
<maxHistory>7</maxHistory>
|
||
</rollingPolicy>
|
||
<encoder>
|
||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||
<charset>utf8</charset>
|
||
</encoder>
|
||
</appender>
|
||
<!-- Appender to log to file in a JSON format -->
|
||
<appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||
<file>${LOG_FILE}.json</file>
|
||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||
<fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern>
|
||
<maxHistory>7</maxHistory>
|
||
</rollingPolicy>
|
||
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||
<providers>
|
||
<timestamp>
|
||
<timeZone>UTC</timeZone>
|
||
</timestamp>
|
||
<pattern>
|
||
<pattern>
|
||
{
|
||
"timestamp": "@timestamp",
|
||
"severity": "%level",
|
||
"service": "${springAppName:-}",
|
||
"trace": "%X{traceId:-}",
|
||
"span": "%X{spanId:-}",
|
||
"pid": "${PID:-}",
|
||
"thread": "%thread",
|
||
"class": "%logger{40}",
|
||
"rest": "%message"
|
||
}
|
||
</pattern>
|
||
</pattern>
|
||
</providers>
|
||
</encoder>
|
||
</appender>
|
||
<root level="INFO">
|
||
<appender-ref ref="console"/>
|
||
<!-- uncomment this to have also JSON logs -->
|
||
<!--<appender-ref ref="logstash"/>-->
|
||
<!--<appender-ref ref="flatfile"/>-->
|
||
</root>
|
||
</configuration></code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>That Logback configuration file:</p>
|
||
</div>
|
||
<div class="ulist">
|
||
<ul>
|
||
<li>
|
||
<p>Logs information from the application in a JSON format to a <code>build/${spring.application.name}.json</code> file.</p>
|
||
</li>
|
||
<li>
|
||
<p>Has commented out two additional appenders: console and standard log file.</p>
|
||
</li>
|
||
<li>
|
||
<p>Has the same logging pattern as the one presented in the previous section.</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
If you use a custom <code>logback-spring.xml</code>, you must pass the <code>spring.application.name</code> in the <code>bootstrap</code> rather than the <code>application</code> property file.
|
||
Otherwise, your custom logback file does not properly read the property.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="service-dependency-graph"><a class="anchor" href="#service-dependency-graph"></a><a class="link" href="#service-dependency-graph">1.3. Service Dependency Graph</a></h3>
|
||
<div class="paragraph">
|
||
<p>When you consider distributed tracing tracks requests, it makes sense that
|
||
trace data can paint a picture of your architecture.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Zipkin includes a tool to build service dependency diagrams from traces,
|
||
including the count of calls and how many errors exist.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The example application will make a simple diagram like this, but your real
|
||
environment diagram may be more complex.
|
||
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master/docs/src/main/asciidoc/images/zipkin-depedendencies.png[Zipkin Dependencies]</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p><strong>Note</strong>: Production environments will generate a lot of data. You will likely
|
||
need to run a separate service to aggregate the dependency graph. You can learn
|
||
more <a href="https://github.com/openzipkin/zipkin-dependencies/">here</a>.</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="request-scoped-properties-baggage"><a class="anchor" href="#request-scoped-properties-baggage"></a><a class="link" href="#request-scoped-properties-baggage">1.4. Request scoped properties (Baggage)</a></h3>
|
||
<div class="paragraph">
|
||
<p>Distributed tracing works by propagating fields inside and across services that
|
||
connect the trace together: traceId and spanId notably. The context that holds
|
||
these fields can optionally push other fields that need to be consistent
|
||
regardless of many services are touched. The simple name for these extra fields
|
||
is "Baggage".</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Sleuth allows you to define which baggage are permitted to exist in the trace
|
||
context, including what header names are used.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows setting baggage values:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">Span initialSpan = this.tracer.nextSpan().name("span").start();
|
||
BUSINESS_PROCESS.updateValue(initialSpan.context(), "ALM");
|
||
COUNTRY_CODE.updateValue(initialSpan.context(), "FO");</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="admonitionblock important">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-important" title="Important"></i>
|
||
</td>
|
||
<td class="content">
|
||
There is currently no limitation of the count or size of baggage
|
||
items. Keep in mind that too many can decrease system throughput or increase
|
||
RPC latency. In extreme cases, too much baggage can crash the application, due
|
||
to exceeding transport-level message or header capacity.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="sect3">
|
||
<h4 id="baggage-versus-tags"><a class="anchor" href="#baggage-versus-tags"></a><a class="link" href="#baggage-versus-tags">1.4.1. Baggage versus Tags</a></h4>
|
||
<div class="paragraph">
|
||
<p>Like trace IDs, Baggage is attached to messages or requests, usually as
|
||
headers. Tags are key value pairs sent in a Span to Zipkin. Baggage values are
|
||
not added spans by default, which means you can’t search based on Baggage
|
||
unless you opt-in.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>To make baggage also tags, use the property <code>spring.sleuth.baggage.tag-fields</code>
|
||
like so:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-yml hljs" data-lang="yml">spring:
|
||
sleuth:
|
||
baggage:
|
||
remoteFields:
|
||
- country-code
|
||
- x-vcap-request-id
|
||
tagFields:
|
||
- country-code</code></pre>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="sleuth-adding-project"><a class="anchor" href="#sleuth-adding-project"></a><a class="link" href="#sleuth-adding-project">2. Adding Sleuth to your Project</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="paragraph">
|
||
<p>This section addresses how to add Sleuth to your project with either Maven or Gradle.</p>
|
||
</div>
|
||
<div class="admonitionblock important">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-important" title="Important"></i>
|
||
</td>
|
||
<td class="content">
|
||
To ensure that your application name is properly displayed in Zipkin, set the <code>spring.application.name</code> property in <code>bootstrap.yml</code>.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="sleuth-with-zipkin-via-http"><a class="anchor" href="#sleuth-with-zipkin-via-http"></a><a class="link" href="#sleuth-with-zipkin-via-http">2.1. Sleuth with Zipkin via HTTP</a></h3>
|
||
<div class="paragraph">
|
||
<p>If you want both Sleuth and Zipkin, add the <code>spring-cloud-starter-zipkin</code> dependency.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows how to do so for Maven:</p>
|
||
</div>
|
||
<div class="listingblock primary">
|
||
<div class="title">Maven</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependencyManagement> <i class="conum" data-value="1"></i><b>(1)</b>
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-dependencies</artifactId>
|
||
<version>${release.train.version}</version>
|
||
<type>pom</type>
|
||
<scope>import</scope>
|
||
</dependency>
|
||
</dependencies>
|
||
</dependencyManagement>
|
||
|
||
<dependency> <i class="conum" data-value="2"></i><b>(2)</b>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||
</dependency></code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-zipkin</code>.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows how to do so for Gradle:</p>
|
||
</div>
|
||
<div class="listingblock secondary">
|
||
<div class="title">Gradle</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">dependencyManagement { <i class="conum" data-value="1"></i><b>(1)</b>
|
||
imports {
|
||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
|
||
}
|
||
}
|
||
|
||
dependencies { <i class="conum" data-value="2"></i><b>(2)</b>
|
||
compile "org.springframework.cloud:spring-cloud-starter-zipkin"
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-zipkin</code>.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="sleuth-with-zipkin-over-rabbitmq-or-kafka"><a class="anchor" href="#sleuth-with-zipkin-over-rabbitmq-or-kafka"></a><a class="link" href="#sleuth-with-zipkin-over-rabbitmq-or-kafka">2.2. Sleuth with Zipkin over RabbitMQ or Kafka</a></h3>
|
||
<div class="paragraph">
|
||
<p>If you want to use RabbitMQ or Kafka instead of HTTP, add the <code>spring-rabbit</code> or <code>spring-kafka</code> dependency.
|
||
The default destination name is <code>zipkin</code>.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If using Kafka, you must set the property <code>spring.zipkin.sender.type</code> property accordingly:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">spring.zipkin.sender.type: kafka</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="admonitionblock caution">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-caution" title="Caution"></i>
|
||
</td>
|
||
<td class="content">
|
||
<code>spring-cloud-sleuth-stream</code> is deprecated and incompatible with these destinations.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you want Sleuth over RabbitMQ, add the <code>spring-cloud-starter-zipkin</code> and <code>spring-rabbit</code>
|
||
dependencies.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows how to do so for Gradle:</p>
|
||
</div>
|
||
<div class="listingblock primary">
|
||
<div class="title">Maven</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependencyManagement> <i class="conum" data-value="1"></i><b>(1)</b>
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-dependencies</artifactId>
|
||
<version>${release.train.version}</version>
|
||
<type>pom</type>
|
||
<scope>import</scope>
|
||
</dependency>
|
||
</dependencies>
|
||
</dependencyManagement>
|
||
|
||
<dependency> <i class="conum" data-value="2"></i><b>(2)</b>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||
</dependency>
|
||
<dependency> <i class="conum" data-value="3"></i><b>(3)</b>
|
||
<groupId>org.springframework.amqp</groupId>
|
||
<artifactId>spring-rabbit</artifactId>
|
||
</dependency></code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-zipkin</code>. That way, all nested dependencies get downloaded.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="3"></i><b>3</b></td>
|
||
<td>To automatically configure RabbitMQ, add the <code>spring-rabbit</code> dependency.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="listingblock secondary">
|
||
<div class="title">Gradle</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">dependencyManagement { <i class="conum" data-value="1"></i><b>(1)</b>
|
||
imports {
|
||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
compile "org.springframework.cloud:spring-cloud-starter-zipkin" <i class="conum" data-value="2"></i><b>(2)</b>
|
||
compile "org.springframework.amqp:spring-rabbit" <i class="conum" data-value="3"></i><b>(3)</b>
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-zipkin</code>. That way, all nested dependencies get downloaded.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="3"></i><b>3</b></td>
|
||
<td>To automatically configure RabbitMQ, add the <code>spring-rabbit</code> dependency.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="overriding-the-auto-configuration-of-zipkin"><a class="anchor" href="#overriding-the-auto-configuration-of-zipkin"></a><a class="link" href="#overriding-the-auto-configuration-of-zipkin">2.3. Overriding the auto-configuration of Zipkin</a></h3>
|
||
<div class="paragraph">
|
||
<p>Spring Cloud Sleuth supports sending traces to multiple tracing systems as of version 2.1.0.
|
||
In order to get this to work, every tracing system needs to have a <code>Reporter<Span></code> and <code>Sender</code>.
|
||
If you want to override the provided beans you need to give them a specific name.
|
||
To do this you can use respectively <code>ZipkinAutoConfiguration.REPORTER_BEAN_NAME</code> and <code>ZipkinAutoConfiguration.SENDER_BEAN_NAME</code>.</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">@Configuration
|
||
protected static class MyConfig {
|
||
|
||
@Bean(ZipkinAutoConfiguration.REPORTER_BEAN_NAME)
|
||
Reporter<zipkin2.Span> myReporter() {
|
||
return AsyncReporter.create(mySender());
|
||
}
|
||
|
||
@Bean(ZipkinAutoConfiguration.SENDER_BEAN_NAME)
|
||
MySender mySender() {
|
||
return new MySender();
|
||
}
|
||
|
||
static class MySender extends Sender {
|
||
|
||
private boolean spanSent = false;
|
||
|
||
boolean isSpanSent() {
|
||
return this.spanSent;
|
||
}
|
||
|
||
@Override
|
||
public Encoding encoding() {
|
||
return Encoding.JSON;
|
||
}
|
||
|
||
@Override
|
||
public int messageMaxBytes() {
|
||
return Integer.MAX_VALUE;
|
||
}
|
||
|
||
@Override
|
||
public int messageSizeInBytes(List<byte[]> encodedSpans) {
|
||
return encoding().listSizeInBytes(encodedSpans);
|
||
}
|
||
|
||
@Override
|
||
public Call<Void> sendSpans(List<byte[]> encodedSpans) {
|
||
this.spanSent = true;
|
||
return Call.create(null);
|
||
}
|
||
|
||
}
|
||
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="only-sleuth-log-correlation"><a class="anchor" href="#only-sleuth-log-correlation"></a><a class="link" href="#only-sleuth-log-correlation">2.4. Only Sleuth (log correlation)</a></h3>
|
||
<div class="paragraph">
|
||
<p>If you want to use only Spring Cloud Sleuth without the Zipkin integration, add the <code>spring-cloud-starter-sleuth</code> module to your project.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows how to add Sleuth with Maven:</p>
|
||
</div>
|
||
<div class="listingblock primary">
|
||
<div class="title">Maven</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml"><dependencyManagement> <i class="conum" data-value="1"></i><b>(1)</b>
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-dependencies</artifactId>
|
||
<version>${release.train.version}</version>
|
||
<type>pom</type>
|
||
<scope>import</scope>
|
||
</dependency>
|
||
</dependencies>
|
||
</dependencyManagement>
|
||
|
||
<dependency> <i class="conum" data-value="2"></i><b>(2)</b>
|
||
<groupId>org.springframework.cloud</groupId>
|
||
<artifactId>spring-cloud-starter-sleuth</artifactId>
|
||
</dependency></code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-sleuth</code>.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The following example shows how to add Sleuth with Gradle:</p>
|
||
</div>
|
||
<div class="listingblock secondary">
|
||
<div class="title">Gradle</div>
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-groovy hljs" data-lang="groovy">dependencyManagement { <i class="conum" data-value="1"></i><b>(1)</b>
|
||
imports {
|
||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}"
|
||
}
|
||
}
|
||
|
||
dependencies { <i class="conum" data-value="2"></i><b>(2)</b>
|
||
compile "org.springframework.cloud:spring-cloud-starter-sleuth"
|
||
}</code></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>We recommend that you add the dependency management through the Spring BOM so that you need not manage versions yourself.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Add the dependency to <code>spring-cloud-starter-sleuth</code>.</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="building"><a class="anchor" href="#building"></a><a class="link" href="#building">3. Building</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="sect2">
|
||
<h3 id="basic-compile-and-test"><a class="anchor" href="#basic-compile-and-test"></a><a class="link" href="#basic-compile-and-test">3.1. Basic Compile and Test</a></h3>
|
||
<div class="paragraph">
|
||
<p>To build the source you will need to install JDK 1.7.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Spring Cloud uses Maven for most build-related activities, and you
|
||
should be able to get off the ground quite quickly by cloning the
|
||
project you are interested in and typing</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre>$ ./mvnw install</pre>
|
||
</div>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
You can also install Maven (>=3.3.3) yourself and run the <code>mvn</code> command
|
||
in place of <code>./mvnw</code> in the examples below. If you do that you also
|
||
might need to add <code>-P spring</code> if your local Maven settings do not
|
||
contain repository declarations for spring pre-release artifacts.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
Be aware that you might need to increase the amount of memory
|
||
available to Maven by setting a <code>MAVEN_OPTS</code> environment variable with
|
||
a value like <code>-Xmx512m -XX:MaxPermSize=128m</code>. We try to cover this in
|
||
the <code>.mvn</code> configuration, so if you find you have to do it to make a
|
||
build succeed, please raise a ticket to get the settings added to
|
||
source control.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>For hints on how to build the project look in <code>.travis.yml</code> if there
|
||
is one. There should be a "script" and maybe "install" command. Also
|
||
look at the "services" section to see if any services need to be
|
||
running locally (e.g. mongo or rabbit). Ignore the git-related bits
|
||
that you might find in "before_install" since they’re related to setting git
|
||
credentials and you already have those.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The projects that require middleware generally include a
|
||
<code>docker-compose.yml</code>, so consider using
|
||
<a href="https://docs.docker.com/compose/">Docker Compose</a> to run the middeware servers
|
||
in Docker containers. See the README in the
|
||
<a href="https://github.com/spring-cloud-samples/scripts">scripts demo
|
||
repository</a> for specific instructions about the common cases of mongo,
|
||
rabbit and redis.</p>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
If all else fails, build with the command from <code>.travis.yml</code> (usually
|
||
<code>./mvnw install</code>).
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="documentation"><a class="anchor" href="#documentation"></a><a class="link" href="#documentation">3.2. Documentation</a></h3>
|
||
<div class="paragraph">
|
||
<p>The spring-cloud-build module has a "docs" profile, and if you switch
|
||
that on it will try to build asciidoc sources from
|
||
<code>src/main/asciidoc</code>. As part of that process it will look for a
|
||
<code>README.adoc</code> and process it by loading all the includes, but not
|
||
parsing or rendering it, just copying it to <code>${main.basedir}</code>
|
||
(defaults to <code>${basedir}</code>, i.e. the root of the project). If there are
|
||
any changes in the README it will then show up after a Maven build as
|
||
a modified file in the correct place. Just commit it and push the change.</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="working-with-the-code"><a class="anchor" href="#working-with-the-code"></a><a class="link" href="#working-with-the-code">3.3. Working with the code</a></h3>
|
||
<div class="paragraph">
|
||
<p>If you don’t have an IDE preference we would recommend that you use
|
||
<a href="https://www.springsource.com/developer/sts">Spring Tools Suite</a> or
|
||
<a href="https://eclipse.org">Eclipse</a> when working with the code. We use the
|
||
<a href="https://eclipse.org/m2e/">m2eclipse</a> eclipse plugin for maven support. Other IDEs and tools
|
||
should also work without issue as long as they use Maven 3.3.3 or better.</p>
|
||
</div>
|
||
<div class="sect3">
|
||
<h4 id="importing-into-eclipse-with-m2eclipse"><a class="anchor" href="#importing-into-eclipse-with-m2eclipse"></a><a class="link" href="#importing-into-eclipse-with-m2eclipse">3.3.1. Importing into eclipse with m2eclipse</a></h4>
|
||
<div class="paragraph">
|
||
<p>We recommend the <a href="https://eclipse.org/m2e/">m2eclipse</a> eclipse plugin when working with
|
||
eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse
|
||
marketplace".</p>
|
||
</div>
|
||
<div class="admonitionblock note">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-note" title="Note"></i>
|
||
</td>
|
||
<td class="content">
|
||
Older versions of m2e do not support Maven 3.3, so once the
|
||
projects are imported into Eclipse you will also need to tell
|
||
m2eclipse to use the right profile for the projects. If you
|
||
see many different errors related to the POMs in the projects, check
|
||
that you have an up to date installation. If you can’t upgrade m2e,
|
||
add the "spring" profile to your <code>settings.xml</code>. Alternatively you can
|
||
copy the repository settings from the "spring" profile of the parent
|
||
pom into your <code>settings.xml</code>.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="sect3">
|
||
<h4 id="importing-into-eclipse-without-m2eclipse"><a class="anchor" href="#importing-into-eclipse-without-m2eclipse"></a><a class="link" href="#importing-into-eclipse-without-m2eclipse">3.3.2. Importing into eclipse without m2eclipse</a></h4>
|
||
<div class="paragraph">
|
||
<p>If you prefer not to use m2eclipse you can generate eclipse project metadata using the
|
||
following command:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre>$ ./mvnw eclipse:eclipse</pre>
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>The generated eclipse projects can be imported by selecting <code>import existing projects</code>
|
||
from the <code>file</code> menu.</p>
|
||
</div>
|
||
<div class="admonitionblock important">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-important" title="Important"></i>
|
||
</td>
|
||
<td class="content">
|
||
Spring Cloud Sleuth uses two different versions of language level. Java 1.7 is used for main sources, and
|
||
Java 1.8 is used for tests. When importing your project to an IDE, you should activate the <code>ide</code> Maven profile to turn on
|
||
Java 1.8 for both main and test sources. You MUST NOT use Java 1.8 features in the main sources. If you do
|
||
so, your app breaks during the Maven build.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect1">
|
||
<h2 id="contributing"><a class="anchor" href="#contributing"></a><a class="link" href="#contributing">4. Contributing</a></h2>
|
||
<div class="sectionbody">
|
||
<div class="paragraph">
|
||
<p>Spring Cloud is released under the non-restrictive Apache 2.0 license,
|
||
and follows a very standard Github development process, using Github
|
||
tracker for issues and merging pull requests into master. If you want
|
||
to contribute even something trivial please do not hesitate, but
|
||
follow the guidelines below.</p>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="sign-the-contributor-license-agreement"><a class="anchor" href="#sign-the-contributor-license-agreement"></a><a class="link" href="#sign-the-contributor-license-agreement">4.1. Sign the Contributor License Agreement</a></h3>
|
||
<div class="paragraph">
|
||
<p>Before we accept a non-trivial patch or pull request we will need you to sign the
|
||
<a href="https://cla.pivotal.io/sign/spring">Contributor License Agreement</a>.
|
||
Signing the contributor’s agreement does not grant anyone commit rights to the main
|
||
repository, but it does mean that we can accept your contributions, and you will get an
|
||
author credit if we do. Active contributors might be asked to join the core team, and
|
||
given the ability to merge pull requests.</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="code-of-conduct"><a class="anchor" href="#code-of-conduct"></a><a class="link" href="#code-of-conduct">4.2. Code of Conduct</a></h3>
|
||
<div class="paragraph">
|
||
<p>This project adheres to the Contributor Covenant <a href="https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc">code of
|
||
conduct</a>. By participating, you are expected to uphold this code. Please report
|
||
unacceptable behavior to <a href="mailto:spring-code-of-conduct@pivotal.io">spring-code-of-conduct@pivotal.io</a>.</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="code-conventions-and-housekeeping"><a class="anchor" href="#code-conventions-and-housekeeping"></a><a class="link" href="#code-conventions-and-housekeeping">4.3. Code Conventions and Housekeeping</a></h3>
|
||
<div class="paragraph">
|
||
<p>None of these is essential for a pull request, but they will all help. They can also be
|
||
added after the original pull request but before a merge.</p>
|
||
</div>
|
||
<div class="ulist">
|
||
<ul>
|
||
<li>
|
||
<p>Use the Spring Framework code format conventions. If you use Eclipse
|
||
you can import formatter settings using the
|
||
<code>eclipse-code-formatter.xml</code> file from the
|
||
<a href="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml">Spring
|
||
Cloud Build</a> project. If using IntelliJ, you can use the
|
||
<a href="https://plugins.jetbrains.com/plugin/6546">Eclipse Code Formatter
|
||
Plugin</a> to import the same file.</p>
|
||
</li>
|
||
<li>
|
||
<p>Make sure all new <code>.java</code> files to have a simple Javadoc class comment with at least an
|
||
<code>@author</code> tag identifying you, and preferably at least a paragraph on what the class is
|
||
for.</p>
|
||
</li>
|
||
<li>
|
||
<p>Add the ASF license header comment to all new <code>.java</code> files (copy from existing files
|
||
in the project)</p>
|
||
</li>
|
||
<li>
|
||
<p>Add yourself as an <code>@author</code> to the .java files that you modify substantially (more
|
||
than cosmetic changes).</p>
|
||
</li>
|
||
<li>
|
||
<p>Add some Javadocs and, if you change the namespace, some XSD doc elements.</p>
|
||
</li>
|
||
<li>
|
||
<p>A few unit tests would help a lot as well — someone has to do it.</p>
|
||
</li>
|
||
<li>
|
||
<p>If no-one else is using your branch, please rebase it against the current master (or
|
||
other target branch in the main project).</p>
|
||
</li>
|
||
<li>
|
||
<p>When writing a commit message please follow <a href="https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html">these conventions</a>,
|
||
if you are fixing an existing issue please add <code>Fixes gh-XXXX</code> at the end of the commit
|
||
message (where XXXX is the issue number).</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="checkstyle"><a class="anchor" href="#checkstyle"></a><a class="link" href="#checkstyle">4.4. Checkstyle</a></h3>
|
||
<div class="paragraph">
|
||
<p>Spring Cloud Build comes with a set of checkstyle rules. You can find them in the <code>spring-cloud-build-tools</code> module. The most notable files under the module are:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="title">spring-cloud-build-tools/</div>
|
||
<div class="content">
|
||
<pre>└── src
|
||
├── checkstyle
|
||
│ └── checkstyle-suppressions.xml <i class="conum" data-value="3"></i><b>(3)</b>
|
||
└── main
|
||
└── resources
|
||
├── checkstyle-header.txt <i class="conum" data-value="2"></i><b>(2)</b>
|
||
└── checkstyle.xml <i class="conum" data-value="1"></i><b>(1)</b></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>Default Checkstyle rules</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>File header setup</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="3"></i><b>3</b></td>
|
||
<td>Default suppression rules</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="sect3">
|
||
<h4 id="checkstyle-configuration"><a class="anchor" href="#checkstyle-configuration"></a><a class="link" href="#checkstyle-configuration">4.4.1. Checkstyle configuration</a></h4>
|
||
<div class="paragraph">
|
||
<p>Checkstyle rules are <strong>disabled by default</strong>. To add checkstyle to your project just define the following properties and plugins.</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="title">pom.xml</div>
|
||
<div class="content">
|
||
<pre><properties>
|
||
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <i class="conum" data-value="1"></i><b>(1)</b>
|
||
<maven-checkstyle-plugin.failsOnViolation>true
|
||
</maven-checkstyle-plugin.failsOnViolation> <i class="conum" data-value="2"></i><b>(2)</b>
|
||
<maven-checkstyle-plugin.includeTestSourceDirectory>true
|
||
</maven-checkstyle-plugin.includeTestSourceDirectory> <i class="conum" data-value="3"></i><b>(3)</b>
|
||
</properties>
|
||
|
||
<build>
|
||
<plugins>
|
||
<plugin> <i class="conum" data-value="4"></i><b>(4)</b>
|
||
<groupId>io.spring.javaformat</groupId>
|
||
<artifactId>spring-javaformat-maven-plugin</artifactId>
|
||
</plugin>
|
||
<plugin> <i class="conum" data-value="5"></i><b>(5)</b>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||
</plugin>
|
||
</plugins>
|
||
|
||
<reporting>
|
||
<plugins>
|
||
<plugin> <i class="conum" data-value="5"></i><b>(5)</b>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||
</plugin>
|
||
</plugins>
|
||
</reporting>
|
||
</build></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>Fails the build upon Checkstyle errors</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>Fails the build upon Checkstyle violations</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="3"></i><b>3</b></td>
|
||
<td>Checkstyle analyzes also the test sources</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="4"></i><b>4</b></td>
|
||
<td>Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="5"></i><b>5</b></td>
|
||
<td>Add checkstyle plugin to your build and reporting phases</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under <code>${project.root}/src/checkstyle/checkstyle-suppressions.xml</code> with your suppressions. Example:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="title">projectRoot/src/checkstyle/checkstyle-suppresions.xml</div>
|
||
<div class="content">
|
||
<pre><?xml version="1.0"?>
|
||
<!DOCTYPE suppressions PUBLIC
|
||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||
"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||
<suppressions>
|
||
<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
|
||
<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
|
||
</suppressions></pre>
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>It’s advisable to copy the <code>${spring-cloud-build.rootFolder}/.editorconfig</code> and <code>${spring-cloud-build.rootFolder}/.springformat</code> to your project. That way, some default formatting rules will be applied. You can do so by running this script:</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="content">
|
||
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig
|
||
$ touch .springformat</code></pre>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect2">
|
||
<h3 id="ide-setup"><a class="anchor" href="#ide-setup"></a><a class="link" href="#ide-setup">4.5. IDE setup</a></h3>
|
||
<div class="sect3">
|
||
<h4 id="intellij-idea"><a class="anchor" href="#intellij-idea"></a><a class="link" href="#intellij-idea">4.5.1. Intellij IDEA</a></h4>
|
||
<div class="paragraph">
|
||
<p>In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.
|
||
The following files can be found in the <a href="https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools">Spring Cloud Build</a> project.</p>
|
||
</div>
|
||
<div class="listingblock">
|
||
<div class="title">spring-cloud-build-tools/</div>
|
||
<div class="content">
|
||
<pre>└── src
|
||
├── checkstyle
|
||
│ └── checkstyle-suppressions.xml <i class="conum" data-value="3"></i><b>(3)</b>
|
||
└── main
|
||
└── resources
|
||
├── checkstyle-header.txt <i class="conum" data-value="2"></i><b>(2)</b>
|
||
├── checkstyle.xml <i class="conum" data-value="1"></i><b>(1)</b>
|
||
└── intellij
|
||
├── Intellij_Project_Defaults.xml <i class="conum" data-value="4"></i><b>(4)</b>
|
||
└── Intellij_Spring_Boot_Java_Conventions.xml <i class="conum" data-value="5"></i><b>(5)</b></pre>
|
||
</div>
|
||
</div>
|
||
<div class="colist arabic">
|
||
<table>
|
||
<tr>
|
||
<td><i class="conum" data-value="1"></i><b>1</b></td>
|
||
<td>Default Checkstyle rules</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="2"></i><b>2</b></td>
|
||
<td>File header setup</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="3"></i><b>3</b></td>
|
||
<td>Default suppression rules</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="4"></i><b>4</b></td>
|
||
<td>Project defaults for Intellij that apply most of Checkstyle rules</td>
|
||
</tr>
|
||
<tr>
|
||
<td><i class="conum" data-value="5"></i><b>5</b></td>
|
||
<td>Project style conventions for Intellij that apply most of Checkstyle rules</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-code-style.png" alt="Code style">
|
||
</div>
|
||
<div class="title">Figure 1. Code style</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Go to <code>File</code> → <code>Settings</code> → <code>Editor</code> → <code>Code style</code>. There click on the icon next to the <code>Scheme</code> section. There, click on the <code>Import Scheme</code> value and pick the <code>Intellij IDEA code style XML</code> option. Import the <code>spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml</code> file.</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-inspections.png" alt="Code style">
|
||
</div>
|
||
<div class="title">Figure 2. Inspection profiles</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Go to <code>File</code> → <code>Settings</code> → <code>Editor</code> → <code>Inspections</code>. There click on the icon next to the <code>Profile</code> section. There, click on the <code>Import Profile</code> and import the <code>spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml</code> file.</p>
|
||
</div>
|
||
<div class="paragraph">
|
||
<div class="title">Checkstyle</div>
|
||
<p>To have Intellij work with Checkstyle, you have to install the <code>Checkstyle</code> plugin. It’s advisable to also install the <code>Assertions2Assertj</code> to automatically convert the JUnit assertions</p>
|
||
</div>
|
||
<div class="imageblock">
|
||
<div class="content">
|
||
<img src="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-checkstyle.png" alt="Checkstyle">
|
||
</div>
|
||
</div>
|
||
<div class="paragraph">
|
||
<p>Go to <code>File</code> → <code>Settings</code> → <code>Other settings</code> → <code>Checkstyle</code>. There click on the <code>+</code> icon in the <code>Configuration file</code> section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the <code>checkstyle.xml</code> : <code><a href="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml" class="bare">raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml</a></code>). We need to provide the following variables:</p>
|
||
</div>
|
||
<div class="ulist">
|
||
<ul>
|
||
<li>
|
||
<p><code>checkstyle.header.file</code> - please point it to the Spring Cloud Build’s, <code>spring-cloud-build-tools/src/main/resources/checkstyle-header.txt</code> file either in your cloned repo or via the <code><a href="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt" class="bare">raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt</a></code> URL.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>checkstyle.suppressions.file</code> - default suppressions. Please point it to the Spring Cloud Build’s, <code>spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml</code> file either in your cloned repo or via the <code><a href="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml" class="bare">raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml</a></code> URL.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>checkstyle.additional.suppressions.file</code> - this variable corresponds to suppressions in your local project. E.g. you’re working on <code>spring-cloud-contract</code>. Then point to the <code>project-root/src/checkstyle/checkstyle-suppressions.xml</code> folder. Example for <code>spring-cloud-contract</code> would be: <code>/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml</code>.</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="admonitionblock important">
|
||
<table>
|
||
<tr>
|
||
<td class="icon">
|
||
<i class="fa icon-important" title="Important"></i>
|
||
</td>
|
||
<td class="content">
|
||
Remember to set the <code>Scan Scope</code> to <code>All sources</code> since we apply checkstyle rules for production and test sources.
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript" src="js/tocbot/tocbot.min.js"></script>
|
||
<script type="text/javascript" src="js/toc.js"></script>
|
||
<link rel="stylesheet" href="js/highlight/styles/github.min.css">
|
||
<script src="js/highlight/highlight.min.js"></script>
|
||
<script>hljs.initHighlighting()</script>
|
||
</body>
|
||
</html> |