1356 Commits

Author SHA1 Message Date
Adrian Cole
a9128dcd32 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-17 21:20:09 +08:00
Adrian Cole
511c54da81 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 14:10:46 +08:00
Adrian Cole
ef866d97f3 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:25:00 +08:00
Adrian Cole
cab7d68eac latest brave 2020-04-06 17:03:16 +08:00
Adrian Cole
ac50a7fafb Moves Slf4jScopeDecorator to use CorrelationField internally (#1597) 2020-04-03 20:17:28 +08:00
Adrian Cole
b2255f8805 Rewrites Slf4jScopeDecorator internally to re-use Brave's (#1595) 2020-04-03 20:10:07 +08:00
Adrian Cole
6fe46bf062 Updates to latest brave and removes all static thread local use (#1594) 2020-04-03 18:56:06 +08:00
Adrian Cole
7861e68aa2 feign cleanup 2020-03-02 07:58:37 +08:00
Adrian Cole
d97f4d22de Updates feign client and tests around latest Brave 2020-02-13 14:22:25 -08:00
verichenn
aefa2a0119 [fix#1359]Keep headers in their original order. (#1360)
Fixes gh-1359
2020-02-13 14:14:00 -08:00
buildmaster
efda469d91 Bumping versions to 2.1.8.BUILD-SNAPSHOT after release 2020-01-31 22:16:43 +00:00
buildmaster
00af789f6d Going back to snapshots 2020-01-31 22:16:43 +00:00
buildmaster
c4c05354e5 Update SNAPSHOT to 2.1.7.RELEASE 2020-01-31 22:14:45 +00:00
Marcin Grzejszczak
b830137ac5 Fixing wrong ScheduledExecutorService wrapping; fixes gh-1536 2020-01-30 12:58:37 +01:00
Adrian Cole
cba886720d latest brave 2020-01-29 15:07:06 +08:00
Marcin Grzejszczak
d89624d712 Added missing test 2020-01-13 11:58:36 +01:00
Marcin Grzejszczak
67365321b6 Improved WebClient parent-child relation; fixes gh-1516 2020-01-13 11:55:16 +01:00
Marcin Grzejszczak
3159f96a49 Added logging in case delegate wasn't instrumented 2019-12-27 10:05:44 +01:00
colejnic
b492868546 Instruments manually created load-balanced Feign Clients
fixes gh-1125
2019-12-27 09:36:56 +01:00
evilnull
247d19f5c8 Shouldn't call finalize on LazyTraceThreadPoolTaskScheduler delegate
fixes gh-1485
2019-11-22 21:00:52 +01:00
Marcin Grzejszczak
1cbe0c03b0 When application context is closed, tracing bean retrieval will result in an exception
fixes gh-1450
2019-11-20 13:25:24 +01:00
buildmaster
22fce3694f Bumping versions to 2.1.7.BUILD-SNAPSHOT after release 2019-11-18 15:46:50 +00:00
buildmaster
f2af9fa8d1 Going back to snapshots 2019-11-18 15:46:50 +00:00
buildmaster
1fbfc67930 Update SNAPSHOT to 2.1.6.RELEASE 2019-11-18 15:45:34 +00:00
Marcin Grzejszczak
34b2f3a268 Fixed wrong gateway integration and b3 parsing; fixes gh-1452 2019-11-08 17:44:43 +01:00
Marcin Grzejszczak
ec5973bd90 Revert "Revert "Revert "Came back to previous test impl"" - priort to the release" - after the release
This reverts commit 3173ca1505.
2019-10-31 12:40:32 +01:00
Marcin Grzejszczak
54068d24ce Bumping versions to 2.1.6.BUILD-SNAPSHOT after release 2019-10-31 12:39:24 +01:00
Marcin Grzejszczak
f993c6f131 Going back to snapshots 2019-10-31 12:39:23 +01:00
Marcin Grzejszczak
6a5cbbc519 Update SNAPSHOT to 2.1.5.RELEASE 2019-10-31 12:35:35 +01:00
Marcin Grzejszczak
3173ca1505 Revert "Revert "Came back to previous test impl"" - priort to the release
This reverts commit 1a3e405e5a.
2019-10-31 12:28:33 +01:00
Marcin Grzejszczak
6ee2cf6dab Gateway should try to continue an existing trace from either thread local or request 2019-10-31 10:55:37 +01:00
Marcin Grzejszczak
cd2e2c2d49 Configure Reactor instrumentation to wrap onLastOperator or onEachOperator
with this feature we would allow user to pick whether they instrument on each or on last operator.

fixes gh-1478
2019-10-30 13:09:30 +01:00
Marcin Grzejszczak
759ac87481 Not using loadbalancer zipkin URI extractor when zipkin url contains a port
fixes gh-1474
2019-10-23 13:41:24 +02:00
Marcin Grzejszczak
54a65bc9f3 Ensures that there is no double instrumentation for executor services
fixes gh-1463
2019-10-22 13:06:50 +02:00
Marcin Grzejszczak
f586661b78 Reusing input headers for Gateway instrumentation
fixes gh-1469
2019-10-22 12:41:53 +02:00
Marcin Grzejszczak
e9df7a844b Added missing import 2019-10-21 15:57:00 +02:00
Marcin Grzejszczak
6a07a3417d Fixed checkstyle 2019-10-21 15:50:45 +02:00
Marcin Grzejszczak
12aa85d6cd Ensures that a custom status code works fine with Sleuth & WebClient
fixes gh-1462
2019-10-21 12:59:24 +02:00
Adrian Cole
aa533bc4cb Updates to latest Sampling infrastructure (2.1.x) (#1461)
* Updates to latest Sampling infrastructure (2.1.x)

This adapts #1456 for the 2.1.x branch
2019-10-08 18:47:25 -05:00
Marcin Grzejszczak
ac7dd52544 Added a check for LazyTracingClientHttpRequestInterceptor fixes gh-1457 2019-10-03 12:37:05 +02:00
Marcin Grzejszczak
1a3e405e5a Revert "Came back to previous test impl"
This reverts commit 3fb22e35be.
2019-09-27 13:57:17 +02:00
Marcin Grzejszczak
028a79dc25 Bumping versions to 2.1.5.BUILD-SNAPSHOT after release 2019-09-27 13:56:35 +02:00
Marcin Grzejszczak
198843a917 Going back to snapshots 2019-09-27 13:56:35 +02:00
Marcin Grzejszczak
c9196fe177 Update SNAPSHOT to 2.1.4.RELEASE 2019-09-27 13:09:09 +02:00
Marcin Grzejszczak
3fb22e35be Came back to previous test impl 2019-09-27 12:31:52 +02:00
Marcin Grzejszczak
32aef9f154 Improved performance of ReactorSleuth; fixes gh-1449 2019-09-19 11:42:08 +02:00
Marcin Grzejszczak
75dcc87bd5 Reverts impl to the refactored one
Revert "Not using httpStatus() method for custom status codes"

    This reverts commit b59277f0

    Revert "Came back to previous impl for WebClient instrumentation; fixes gh-1442"

    This reverts commit bee61a9988.
2019-09-19 10:00:11 +02:00
Nick
8afa3e8d37 Fix ThreadPoolTaskScheduler proxy mechanism (#1447) 2019-09-19 09:50:12 +02:00
Marcin Grzejszczak
bee61a9988 Came back to previous impl for WebClient instrumentation; fixes gh-1442 2019-09-18 12:10:53 +02:00
Marcin Grzejszczak
6da8b91bcd Renamed the bean, fixes gh-1444 2019-09-16 15:20:00 +02:00