Commit Graph

1619 Commits

Author SHA1 Message Date
buildmaster
93ea0d6b00 Going back to snapshots 2020-05-29 19:03:35 +00:00
buildmaster
640faa7c30 Update SNAPSHOT to 3.0.0-M2 2020-05-29 19:02:42 +00:00
Adrian Cole
18415d6877 Merge branch '2.2.x' 2020-05-26 19:47:01 +08:00
Adrian Cole
3685cc2d7c Fixes bug where we didn't fall back to current span (#1656) 2020-05-26 19:44:25 +08:00
Adrian Cole
32baa11183 Merge branch '2.2.x' 2020-05-26 14:54:31 +08:00
Adrian Cole
a6573bc2a5 Uses B3 single for non-remote spans (2.2.x) (#1655)
This makes sure there cannot be JMS problems related to use of
hyphenated headers unless someone overrides the `Propagation.Factory`.

To avoid this, we set non-remote spans to B3 single format as done on
the 3.x branch here:
https://github.com/spring-cloud/spring-cloud-sleuth/pull/1607/files#diff-db43b7e91bd69d063333c20b947c902bR83-R84
2020-05-26 14:42:27 +08:00
Marcin Grzejszczak
de399c8959 Merge branch '2.2.x' 2020-05-22 14:02:11 +02:00
Marcin Grzejszczak
473549f000 Removed / ignored flakey tests; fixes gh-1635; fixes gh-1652 2020-05-22 13:51:14 +02:00
Adrian Cole
4ed3db9a27 Drops zipkin dependency from spring-cloud-sleuth-core (#1649)
There was emmense work to prepare for decoupling of spring-cloud-sleuth-core
from Zipkin. This included complete test conversion and deprecations between
2.2.x and 3.0.x.

This moves all Zipkin related code to spring-cloud-sleuth-zipkin, making the
primary data recording tool `SpanHandler` as opposed to `Reporter<zipkin2.Span>`

For example, Wavefront and soon Stackdriver can implement `SpanHandler` and
skip conversion into the Zipkin model first. `SpanHandler` also includes
begin and end hooks which allow data extensions to be developed.

see https://github.com/wavefrontHQ/wavefront-spring-boot
2020-05-19 08:22:54 +08:00
Adrian Cole
31fb3001c5 Merge branch '2.2.x' 2020-05-18 23:58:46 +08:00
Adrian Cole
03be784678 Ensures Zipkin handlers order last (after redacters etc) (#1648)
This is more prevention of a problem, then seeing one in practice.
Technically, a TracingCustomizer can order things backwards, and it hit
me in a test env (not sleuth).
2020-05-18 23:43:23 +08:00
Adrian Cole
e19e0ca169 Backports BaggagePropagation to 2.2.x (#1647)
This allows integrations of Sleuth to use the same approach for 2.2.x as 3.x:

If you have a custom base propagation format, override the `BaggagePropagation.Factory`
bean instead of `ExtraFieldsPropagation.Factory`

Note: one subtle difference 2.2.x to 3.x is the change in the primary inject format.

2.2.x is
```java
return BaggagePropagation.newFactoryBuilder(B3Propagation.newFactoryBuilder()
                         .injectFormat(B3Propagation.Format.MULTI).build());
```

3.0 is
```java
return BaggagePropagation.newFactoryBuilder(B3Propagation.newFactoryBuilder()
                         .injectFormat(B3Propagation.Format.SINGLE_NO_PARENT).build());
```
per #1607

See https://github.com/spring-cloud/spring-cloud-gcp/issues/2268
2020-05-18 23:08:08 +08:00
Adrian Cole
30bc36ea81 Last deprecation cleanup on master (3.x) (#1646) 2020-05-18 21:51:00 +08:00
Adrian Cole
3da9de053e Merge branch '2.2.x' 2020-05-18 20:20:40 +08:00
Adrian Cole
40785d642a Removes Zipkin dependency from all tests (#1645)
Brave's SpanHandler can report natively in other formats which have different
constraints than Zipkin and often extensions to the data model.

This change ports all tests away from Zipkin's types so that it is more clear
what's actually recorded vs what's a side-effect of Zipkin conversion.

This removes `BlockingQueueSpanReporter` which was never released, also.
2020-05-18 17:02:29 +08:00
Adrian Cole
a27d634645 Hides exposed configuration and properties types (#1642)
This completes #1638 by addressing deprecations on master (3.x)
2020-05-17 21:30:45 +08:00
Adrian Cole
946486b20a Merge branch '2.2.x' 2020-05-17 18:54:30 +08:00
Adrian Cole
e9d12703c1 Pares back some deprecation after analyzing each file (#1640)
This puts specific comments in as to why certain files that seem like they
shouldn't be public are. Notably, this includes entrypoint autoconfiguration,
which are sometimes order sensitive. In other cases there are types that were
documented (notably the async package).

This also untangles a few configuration.
2020-05-17 08:38:08 +08:00
Adrian Cole
eca5ea6db0 Merge branch '2.2.x' 2020-05-16 16:31:42 +08:00
Adrian Cole
8ae5e13d31 Merge branch '2.2.x' 2020-05-16 15:15:37 +08:00
Adrian Cole
c1a83aa5bb Replaces deprecated note on Properties with TODO to hide them in 3.x (#1639)
I noticed we deleted many things without deprecation in 3.x and figured
deprecation was the right way. However, this doesn't work for auto-config
properties. This replaces deprecation with a TODO note to hide all the
types so that 4.x won't require guessing if someone externally is using
them directly or not.
2020-05-16 14:37:45 +08:00
Adrian Cole
b1d39ce291 Updates to Brave 5.12 and introduces SpanHandler (#1632)
`SpanHandler` is the base type for the now deprecated `FinishedSpanHandler`.

Notable, it can not just handle things at the end of a recording, but also the
beginning.

For example, this permits set-once baggage without the HTTP abstraction:
```java
static final BaggageField EPOCH_SECONDS = BaggageField.create("epoch_seconds");

static final class RootOnlyBaggage extends SpanHandler {
  @Override
  public boolean begin(TraceContext context, MutableSpan span, @Nullable TraceContext parent) {
    if (EPOCH_SECONDS.getValue(context) == null) { // only set at the first span
      long epochSeconds = System.currentTimeMillis() / 1000;
      EPOCH_SECONDS.updateValue(context, String.valueOf(epochSeconds));
    }
    return true;
  }

  @Override public boolean end(TraceContext context, MutableSpan span, Cause cause) {
    Tags.BAGGAGE_FIELD.tag(EPOCH_SECONDS, context, span);
    return true;
  }
}
```

As the parent is available, it can also facilitate advanced tasks like counting
children, or summarizing entire local roots.

See https://github.com/openzipkin/brave/tree/master/brave/src/test/java/brave/features/handler
and https://github.com/openzipkin/brave/blob/master/brave/src/main/java/brave/handler/SpanHandler.java for more
2020-05-16 14:01:38 +08:00
Adrian Cole
d4088dec9c Deprecates unnecessarily public types to ease burden (#1638)
Types like Properties and AutoConfiguration and internal utilities are
routinely marked public when they needn't be. This causes toil as we
have to preserve signatures even if they were made public by accident.

This deprecates the mass of types marked public to give some hope of
less undifferentiated toil in the future. Ideally, future change will
consider greatly if a type should be public or not as doing so haunts
maintainers.
2020-05-16 13:09:24 +08:00
Adrian Cole
f9821495e1 Deprecates ExceptionLoggingFilter and disables it by default (#1633)
`ExceptionLoggingFilter` logs "Uncaught exception thrown" to error level
when there is a synchronous exception not otherwise swallowed. This is a
cure worse than the disease. This disables it by default and the 3.x
should end the years of problems it caused.
2020-05-15 20:27:13 +08:00
Tim te Beek
75756fd092 Move TraceSchedulingAutoConfiguration @Conditional for optional AspectJ
Co-authored-by: Tim te Beek <tim.te.beek@jdriven.com>
2020-05-09 15:19:49 +08:00
Toshiaki Maki
79f258c2eb This commit makes TraceMessagingAutoConfiguration happens only when (#1629)
MessagingTracing so that excluding brave-instrumentation-messaging
dependency does't make an exception.
2020-05-09 15:19:28 +08:00
Toshiaki Maki
c3f67f31d4 This commit makes TraceRpcAutoConfiguration happens only when (#1628)
RpcTracing so that excluding brave-instrumentation-rpc dependency
does't make an exception.
Also add an missing property to disable RPC tracing
in additional-spring-configuration-metadata.json
2020-05-09 15:19:15 +08:00
zhanghaoxin-at-826767166263
e92a735faa add unit test for saved template 2020-05-09 14:57:06 +08:00
Tim te Beek
b3cfa42448 Get KafkaStreamsTracing via BeanFactory to prevent eager initialization (#1623) 2020-05-09 13:22:25 +08:00
张哈希
343d84346f replace method for deprecation and keep reference of requestTemplate 2020-05-09 13:22:15 +08:00
Tim te Beek
bf9cfe5cc1 Move TraceSchedulingAutoConfiguration @Conditional for optional AspectJ
Co-authored-by: Tim te Beek <tim.te.beek@jdriven.com>
2020-05-09 13:20:15 +08:00
Olga Maciaszek-Sharma
d544f6c01a Merge pull request #1622 from HashZhang/HashZhang-patch-2
replace method for deprecation and keep reference of requestTemplate
2020-05-08 18:05:04 +02:00
Toshiaki Maki
043b910f5a This commit makes TraceMessagingAutoConfiguration happens only when (#1629)
MessagingTracing so that excluding brave-instrumentation-messaging
dependency does't make an exception.
2020-05-08 18:13:16 +08:00
Toshiaki Maki
1afe81bdf3 This commit makes TraceRpcAutoConfiguration happens only when (#1628)
RpcTracing so that excluding brave-instrumentation-rpc dependency
does't make an exception.
Also add an missing property to disable RPC tracing
in additional-spring-configuration-metadata.json
2020-05-08 18:12:11 +08:00
zhanghaoxin-at-826767166263
00ca6ad100 add unit test for saved template 2020-05-07 08:19:50 +00:00
buildmaster
ee34b489f6 Bumping versions 2020-05-07 05:29:16 +00:00
Tim te Beek
fe63513b23 Get KafkaStreamsTracing via BeanFactory to prevent eager initialization (#1623) 2020-05-06 14:46:46 +08:00
张哈希
c076cccfa0 replace method for deprecation and keep reference of requestTemplate 2020-04-30 01:58:59 +00:00
Adrian Cole
6fb92a5f66 Merge branch '2.2.x' 2020-04-23 19:42:38 +08:00
Adrian Cole
eac2733c8c Restores special case that ignores sampling properties (#1619)
Sleuth is unlike most tracing configuration libraries, as it has a
legacy from 1.x as being primarily log correlation. In short, when
Zipkin is not installed, it ignored the sampling properties. This
behavior was managed implicitly through an untested combination of
configuration conventions between the core and zipkin modules.

16fb8e3 broke this and this change puts it back, in a way not tightly
coupled to Zipkin and neither requires the more simple, but confusing
"import SamplerAutoConfiguration" approach. It also backfills tests
that should have broken earlier.

In practice, a site that only uses logging is likely uniform in that, so
whether or not the sampled bit is set is of no consequence. However,
there's a chance that someone might rely on this historical behavior.

We should follow-up on 3.0 and remove this as it is very unintuitive to
intentionally ignore sampling properties. For now, this restores the old
behavior based on heuristics of bean definitions.
2020-04-23 13:09:28 +08:00
Adrian Cole
b146067b51 Merge branch '2.2.x' 2020-04-22 19:36:25 +08:00
Adrian Cole
16fb8e3ac6 Moves responsibility to import SamplerAutoConfiguration to core
Before, spring-cloud-sleuth-zipkin had to import `SamplerAutoConfiguration`
directly to unwind a sampler ordering problem caused by `TraceAutoConfiguration`
defining the default `Sampler` bean.

This fixes that by moving the default `Sampler` to where it belongs
(`SamplerAutoConfiguration`) and having `TraceAutoConfiguration` import
the sampling configuration directly as opposed to relying on auto-configuration
ordering. Finally it removes the mistake of setting `SamplerAutoConfiguration`
as auto-configuration in the first place.

The name `SamplerAutoConfiguration` was left alone because changing it would
interfere with 3rd party code that formerly imported it to correct this issue
in their non-zipkin setups.

Fixes #1618
2020-04-22 19:04:19 +08:00
buildmaster
d41d75a3eb Bumping versions 2020-04-17 14:53:39 +00:00
buildmaster
08a575141d Going back to snapshots 2020-04-09 22:48:15 +00:00
buildmaster
66b540f0b9 Update SNAPSHOT to 3.0.0.M1 2020-04-09 22:47:21 +00:00
Olga Maciaszek-Sharma
3ed6ef475c Merge remote-tracking branch 'origin/2.2.x'
# Conflicts:
#	spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java
#	tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue1125/ManuallyCreatedLoadBalancerFeignClientTests.java
#	tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue1125delegates/ManuallyCreatedDelegateLoadBalancerFeignClientTests.java
2020-04-08 11:12:54 +02:00
Olga Maciaszek-Sharma
47c2523ede Avoid double-load-balancing. Fixes gh-1610. 2020-04-07 13:44:23 +02:00
Adrian Cole
29cc2422ec Adds missing customizer config and backfills tests 2020-04-07 11:36:21 +08:00
Adrian Cole
b92db4ce51 Stops propagating Sleuth 1.x spring-messaging headers
To reduce confusion and overhead, the following custom spring-messaging headers added in Sleuth 1.0 are no longer sent, and a log warning is issued once if they are by outside code.

* spanId
* spanSampled
* spanParentSpanId
* spanTraceId
* spanFlags

Sending the above headers actually increases the headers by up to 10 because they are duplicated in the "native" part of messages. This overhead is extreme especially if messages never leave the process.

The solution is to only send [b3 single format](https://github.com/openzipkin/b3-propagation#single-header), which has been in sleuth since 2.0 and is compatible with JMS. The B3 single format is always parsed and takes precedence, even if multiple headers are sent, so this is a safe change.

Note: Unlike RPC, messaging spans never join with their parent. Better performance is achieved by not propagating the producer's parentId downstream.

Note: Deprecated spring-messaging headers such "spanTraceId" as are still read in Sleuth 3.x. However, they will not be at some point in the future. Please pay attention to the log messages and update your code if you are accidentally using them.
2020-04-07 10:58:49 +08:00
Adrian Cole
01e0c97838 doc drift 2020-04-07 08:54:40 +08:00