233 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
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
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
liaochuntao
c6f03191e8 Invalid property name resolution fix
fixes gh-1376
2019-07-02 08:51:49 +02:00
Adrian Cole
a5d8893baa Updates to latest Brave (#1373) 2019-06-15 23:49:26 +08:00
Spring Operator
ac9774d8f7 URL Cleanup (#1279)
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 338 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-22 09:56:20 +01:00
Marcin Grzejszczak
f044c07f67 NPE guard for null response; fixes gh-1224 2019-02-28 15:28:42 +01:00
Marcin Grzejszczak
83545453ad Trying to make tests less brittle 2019-02-27 16:04:46 +01:00
Marcin Grzejszczak
b4174ffa82 Trying to make tests less brittle 2019-02-27 16:02:25 +01:00
Marcin Grzejszczak
1780641ee3 Removed the conditionality on a bena of KafkaProperties type; fixes gh-1209 2019-02-12 18:52:40 +01:00
Marcin Grzejszczak
2f7cf78614 Applied checkstyle 2019-02-07 16:41:59 +01:00
Marcin Grzejszczak
8c82c8aa9f Revert "Fixed the build"
This reverts commit 3107d3f3
2019-02-07 13:12:21 +01:00
Marcin Grzejszczak
3107d3f380 Fixed the build 2019-02-07 12:51:36 +01:00
Marcin Grzejszczak
8941ed8e2d Removed the jdk11 classloader workaround; fixes gh-1193 2019-01-25 13:07:11 +01:00
Tim Ysewyn
0bc500ee78 Fixed issue where the application would not start when zipkin is disabled (#1192) 2019-01-23 22:15:51 +01:00
Marcin Grzejszczak
0397f1e0dd polish 2019-01-21 13:14:06 +01:00
Tim Ysewyn
e0dc599226 Fixed backwards compatibility condition because the auto configuration order changed (#1187) 2019-01-21 12:43:36 +01:00
Marcin Grzejszczak
909afc8f96 Fixed tests 2019-01-21 11:11:53 +01:00
Marcin Grzejszczak
ab44f141e4 Polish 2019-01-21 10:59:27 +01:00
Marcin Grzejszczak
eda5781643 Polish 2019-01-21 10:40:03 +01:00
Tim Ysewyn
490a1d8626 Updated access modifiers in ZipkinBackwardsCompatibilityAutoConfiguration 2019-01-16 22:08:50 +01:00
Tim Ysewyn
3b47f77627 Updated conditional for ZipkinBackwardsCompatibilityAutoConfiguration 2019-01-16 21:56:22 +01:00
Tim Ysewyn
453d942829 Adapted new configuration to support backwards compatibility in case another tracing system extends from spring-cloud-sleuth-zipkin (like spring-cloud-gcp-trace) 2019-01-16 21:46:28 +01:00
Tim Ysewyn
d8381b88c9 Create the restTemplateSender bean when there is no other bean named "zipkinSender" 2019-01-16 16:57:56 +01:00
Tim Ysewyn
8327ecbb4d Updated documentation 2019-01-16 12:42:37 +01:00
Tim Ysewyn
7c31475422 Updated ZipkinAutoConfiguration for backwards compatibility 2019-01-16 12:41:58 +01:00
Tim Ysewyn
14700ed27b Added @ConditionalOnMissingBean(name = REPORTER_BEAN_NAME) 2019-01-15 22:27:22 +01:00
Tim Ysewyn
ca2244dd3f Updated license header 2019-01-15 22:25:25 +01:00
Tim Ysewyn
d7eccee650 Moved ReporterMetrics sleuthReporterMetrics() to TraceAutoConfiguration so other implementations can use the same default 2019-01-15 17:29:55 +01:00
Tim Ysewyn
92c909583c No reason to create a SpanBytesEncoder bean 2019-01-15 17:21:24 +01:00
Tim Ysewyn
5c05186cf1 Incorporated PR feedback 2019-01-14 19:15:26 +01:00
Tim Ysewyn
07d2aa87c9 Updated zipkin config to support multiple span reporters/senders 2019-01-13 17:13:42 +01:00
Marcin Grzejszczak
2579e7887d Added rate limit sampler via a property
fixes gh-1162
2019-01-07 10:21:20 +01:00
Marcin Grzejszczak
17d8165c5e Only wrap executors when context is refreshed (#1129)
uses terrible hacks to verify if the Spring Context is in creation or has already been created. If it has been created then we'll continue as usual. If not then we will NOT wrap any callables and runnables.

fixes #1128
2018-12-19 18:15:04 +01:00
Marcin Grzejszczak
0326f279ce Polish 2018-12-14 08:41:35 +00:00
Marcin Grzejszczak
99d38afc69 Fixed a lot of checkstyle warnings' 2018-10-01 12:29:33 +02:00
Adrian Cole
7b5d530c80 Deprecates SpanAdjuster for Brave's FirehoseHandler
Brave's `FirehoseHandler` has the features adjuster has, more
efficiently and also including the ability to prune spans.

See https://github.com/openzipkin/brave/pull/794
2018-09-25 21:26:26 -04:00
Asi Bross
d6695037b8 Make the probability sampler bean conditional on the existance of the RefreshScope bean (#1087) 2018-09-07 18:39:55 +02:00
Marcin Grzejszczak
d4e81d5dbf Polish 2018-08-30 12:46:56 +02:00
Marcin Grzejszczak
714802ca1d Fixed the kafka sender condition. fixes gh-985 2018-05-23 10:23:19 +02:00
Marcin Grzejszczak
70759b5ddd Kafka sender needs to be explicitly set
default sender is Kafka when it is detected on the classpath, with this change it will be Web. You have to set `spring.zipkin.kafka.enabled` to `true` to use Kafka

fixes gh-985
2018-05-22 19:30:34 +02:00
Adrian Cole
af7df61b17 Adds proto3 encoding
Note: Zipkin server 2.8+ is required to be running for this to work.
2018-04-29 09:54:53 +08:00
Adrian Cole
3e48dec901 Removes unnecessary dependencies
We had some out-of-date comments, and some deps that were too heavy.
2018-04-28 20:18:23 +08:00
Marcin Grzejszczak
eedff746d6 Merge branch '1.3.x' 2018-03-29 09:57:12 +02:00
Marcin Grzejszczak
1c1b963862 Polish 2018-03-29 09:57:05 +02:00
Marcin Grzejszczak
80b78bcc32 Merge branch '1.3.x' 2018-03-29 09:43:50 +02:00
Marcin Grzejszczak
eb9b305f7f Added a property to toggle discovery client support for zipkin client. Fixes gh-919 2018-03-29 09:39:38 +02:00
Adrian Cole
3b16cc6190 Re-misaligns old zipkin version and removes internal class use 2018-03-22 23:52:00 +08:00
Adrian Cole
3649852ce9 Adds the ability to configure things needed by stackdriver
We will eventually need to change the encoder to use their format. Also,
stackdriver does not support shared spans.
2018-03-20 22:18:19 +08:00
Adrian Cole
3392eca5ae Adds test to make sure RestTemplate sender doesn't mess with json (#901)
There was some doubt on gitter about sleuth generating spans with floating-point
rendered timestamps. While this shouldn't break people we certainly shouldn't
create json like this.

This was presumed to be caused by sleuth's rest template sender by @mojsha who
was trying Jaeger. Jaeger's parser doesn't give any errors with a 400.
```json
[
{
"traceId": "a65dac9d8bbb57f8",
"parentId": "a65dac9d8bbb57f8",
"id": "f223bb97e1eba9b2",
"kind": "SERVER",
"name": "https:\/hello3",
"timestamp": 1.521027116604e+15,
"duration": 1525,
"localEndpoint": {
"serviceName": "${spring.application.name}",
"ipv4": "10.128.6.98",
"port": 8443
},
```

I added a test to make sure it is not the case.
2018-03-14 20:42:18 +08:00