Merge branch '1.3.x'

This commit is contained in:
Marcin Grzejszczak
2018-03-07 08:43:31 -05:00
2 changed files with 40 additions and 2 deletions

View File

@@ -1147,6 +1147,38 @@ To block this feature, set `spring.sleuth.messaging.enabled` to `false`.
We instrument the Zuul Ribbon integration by enriching the Ribbon requests with tracing information.
To disable Zuul support, set the `spring.sleuth.zuul.enabled` property to `false`.
=== Spring Cloud Function
Sleuth works out of the box with Spring Cloud Function. Since functions
might be short living, it's best to make the Zipkin span reporting synchronous.
Just define a `Reporter<Span>` bean as presented below:
[source,java]
----
@Configuration
class ReporterConfiguration {
@Bean
public Reporter<Span> reporter(
SpanMetricReporter spanMetricReporter,
ZipkinProperties zipkin,
Sender sender
) {
final AsyncReporter<Span> reporter = AsyncReporter.builder(sender)
.queuedMaxSpans(1000)
.messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS)
.metrics(new ReporterMetricsAdapter(spanMetricReporter))
.build(zipkin.getEncoder());
return new Reporter<Span>() {
@Override public void report(Span span) {
reporter.report(span);
// make the reporter synchronous
reporter.flush();
}
};
}
}
----
== Running examples
You can see the running examples deployed in the https://run.pivotal.io/[Pivotal Web Services].

View File

@@ -80,11 +80,17 @@ public class ZipkinAutoConfiguration {
ZipkinProperties zipkin,
Sender sender
) {
return AsyncReporter.builder(sender)
.queuedMaxSpans(1000) // historical constraint. Note: AsyncReporter supports memory bounds
final AsyncReporter<Span> reporter = AsyncReporter.builder(sender).queuedMaxSpans(
1000) // historical constraint. Note: AsyncReporter supports memory bounds
.messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS)
.metrics(reporterMetrics)
.build(zipkin.getEncoder());
return new Reporter<Span>() {
@Override public void report(Span span) {
reporter.report(span);
reporter.flush();
}
};
}
@Bean