Commit Graph

440 Commits

Author SHA1 Message Date
Marcin Grzejszczak
ce226ba334 Removing colour from the logging pattern\n\nwithout this change due to the presence of colours in the logging pattern, the logs could be corrupt in some cases\nwith this change we're removing the colour\n\nfixes #510 2017-02-07 17:35:07 +01:00
Arthur Gavlyukovskiy
634fa90a0d Display overriden service name in logs (addition to #487) (#507)
Use `spring.zipkin.service.name` if present.
2017-02-02 09:13:37 +01:00
Marcin Grzejszczak
ea30fefdf9 Removed duplicated dependency
fixes #504
2017-02-01 11:20:04 +01:00
Marcin Grzejszczak
b996de50ea Fixing the moment when SS is set
without this change there's a problem with the time when the SS is set on a span. Currently it's done in TraceFilter's finally block. The problem is that this code is executed after the response has been sent back to the client. Thus CR sometimes was set faster than SS (it doesn't make any sense from the logical point of view).

with this change we're introducing wrappers over the HttpServletResponse where we annotate the span with SS just after the response gets sent to the recipient.

fixes #492 #431
2017-02-01 10:49:47 +01:00
Marcin Grzejszczak
6d445f56f4 Going back to snapshots 2017-01-30 10:37:40 +01:00
Marcin Grzejszczak
adfaa036a2 Bumping versions before release 2017-01-30 10:31:39 +01:00
Marcin Grzejszczak
ba4e4f32c1 Giving an option to reuse a custom feign client
without this change you couldn't register your own client (for example to set your ssl config) for Sleuth to reuse it
with this change we're reusing a registered feign client bean or creating a default one if necessary

fixes #502
2017-01-26 18:52:59 +01:00
Brian Devins
1c7d861ffc Add a new log method to span that allows for setting the time (#501)
* Add a new log method that allows for setting the time
* Clarify with time unit
* Simple test and spelling correction
* Consolidate "logic" and add a test for the other log method
2017-01-25 17:25:44 +01:00
Marcin Grzejszczak
c347f724cd Add an option to use the X-B3-Flags header to override any sampling decision
without this change it's pretty much impossible to enforce sampling for certain traces
    with this change setting the X-B3-Flags to 1 for HTTP messages / spanFlags to 1 for messaging will override any sampling decisions

    fixes #496
2017-01-18 13:12:13 +01:00
Ryan Baxter
583893a29d Merging PR #446 into master. 2017-01-10 14:55:32 -05:00
Marcin Grzejszczak
5b442e9526 Adding the spring.instance_id tag
without this tag it's impossible to discern from which server was the given span originated
    with this change we're adding a tag in which we're passing the instance id value. The value can be taken either from Cloud Foundry or from a concatanation of some local properties like instance_id / application name / application port etc.

    fixes #369
2017-01-03 14:44:56 +01:00
Marcin Grzejszczak
6ddd009498 Added test for non web apps, fixed the autoconfig in that case
without this change the non web apps can't start
    with this change the missing bean gets registered

    also in terms of non boot apps if there is no port or address set we're providing some default values. In terms of the service name one can always use the override via the spring.zipkin.service.name property

    fixes #32
2017-01-02 15:42:28 +01:00
Arthur Gavlyukovskiy
24f6827a4a Created @ConfigurationProperties classes and updated additional metadata (#485)
* Created @ConfigurationProperties classes and updated additional metadata
2016-12-30 12:42:38 +01:00
Marcin Grzejszczak
7c7660a84f Added checks to close / detach only if tracing
without this change during asynchronous communication some components are trying to detach or close spans that were aready detached. This leads to exceptions utils warnings and spans were not closed.
    with this change we're adding additional checks to ensure that we're tracing

    fixes #447
2016-12-30 11:49:05 +01:00
Marcin Grzejszczak
03c4300215 Adding parent id to MDC
without this change we couldn't reference parent id in the logs
    with this change we add the parent id to MDC context

    fixes #480
2016-12-20 18:14:38 +01:00
Marcin Grzejszczak
7ad0803336 Added a check for tracing in Trace Filter 2016-12-20 15:57:07 +01:00
Marcin Grzejszczak
d2bf1ea776 Detaching async traces only if tracing is still in progress 2016-12-19 16:52:43 +01:00
Marcin Grzejszczak
4f9bf6d6e4 Added consistency between metric and metrics
without this change we have 2 different properties. One is `spring.sleuth.metric` and the other is `spring.sleuth.metrics`.
with this change we're introducing conditionality on `spring.sleuth.metric.enabled`

fixes #477
2016-12-19 11:58:36 +01:00
Marcin Grzejszczak
b61be04866 Fixing race conditions in tests 2016-12-19 10:20:18 +01:00
Marcin Grzejszczak
964afe10f7 Premature async rest template (#479)
without this change the async rest template provides wrong value of the span duration
with this change the span is closed via a callback

fixes #475
2016-12-16 15:18:29 +01:00
Marcin Grzejszczak
73fb8a8c4c Made tests even less brittle 2016-12-16 15:10:28 +01:00
Marcin Grzejszczak
f047b39fd8 Made tests less brittle - fixed the stupid change 2016-12-16 14:14:14 +01:00
Marcin Grzejszczak
765e41d6c7 Made tests less brittle 2016-12-16 13:51:50 +01:00
Marcin Grzejszczak
1b832b6029 Spans are continued in Handler Interceptors (#474)
without this change an explicit new span is created on the server side. Its name is equal to the method name of the controller. It introduces some nice advantages in terms of readability of trace.

with this change we're continuing a previous span on the server side. We're attaching the tags and logs to that span with information about controller class and controller name. Also events related to start and finish of the controller are there.

fixes #471 #469 #427
2016-12-16 13:51:37 +01:00
Dave Syer
a0adcecba0 Update to Spring Boot 1.5 2016-12-12 12:52:21 +00:00
Marcin Grzejszczak
7855560fa9 Fixed disabling of Sleuth
without this change it's impossible to disable Sleuth when you have registered a Random bean
with this change the conditions are fixed

fixes #462
2016-12-08 15:25:55 +01:00
Marcin Grzejszczak
8c8c3e919b Continuing Spans (#461)
With this change we change the approach to continue spans (if they already exist) instead of starting new ones. The RPC spans would still be generated but Hystrix, Async, Callables / Runnables will reuse an existing span if there is one.

the scenarios are as follows:

Assuming that we have a trace X with span Y
* if you used tracer.wrap(Callable) or trace.wrap(Runnable) then:
  * previously you'd get a span Z created when the Callable / Runnable is executed
  * with this change you'll continue the span Y
* if you used a HystrixCommand then
  * previously you'd get a span Z together with added tags when the command got executed
  * with this change you'll continue the span Y and the tags will be added to span Y
* if you used a ExecutorService then
  * previously you'd get a span Z together with added tags when a method from ExecutorService got executed
  * with this change you'll continue the span Y and the tags will be added to span Y

Assuming that there was no span then everything will work as previously.

In order to create a new span you just have to create it manually. Example of creating a new span for an `@Async` annotated method.

```
// obviously you should inject via constructor ;)
@Autowired Tracer tracer;

@Async
public Future<String> foo() {
    Span span = tracer.createSpan("newSpan");
    try {
       // do your stuff
    } finally {
       this.tracer.close(span);
    }
}
```

fixes #174
2016-12-07 11:18:13 +01:00
Jean-Philippe Courson
85f8943410 Custom HTTP status codes support (#460)
Provides  custom HTTP status codes support

without this change applications using custom HTTP status codes are currently having issues with Spring Cloud Sleuth. TraceFilter.httpStatusSuccessful() is throwing an IllegalArgumentException on HttpStatus.valueOf(response.getStatus()).

with this change that gets fixed
2016-12-03 17:14:12 +02:00
Marcin Grzejszczak
64c2946d65 Fixed wrong proxying of executors
without this change tracing worked fine but the custom types were not registered as beans. Thus autowiring of them was not possible
with this change the bean post processor is removed and an aspect is used - that way tracing is still working fine but we don't interfere in bean registration

fixes #445
2016-11-21 16:55:42 +01:00
Adrian Cole
bee6956987 Starts 128-bit traces when spring.sleuth.traceId128=true (#455)
This adds autoconfiguration to create 128-bit traces when
`spring.sleuth.traceId128=true`.
2016-11-18 20:10:00 +08:00
Adrian Cole
c596f3f1ae Propagates logs and reports 128-bit trace IDs (#452)
This supports 128-bit traces via a new field traceIdHigh, which matches
other zipkin implementations. In encoded form, the trace ID is simply
twice as long (32 hex characters).

With this change in, a 128-bit trace propagated will not be downgraded
to 64-bits when sending downstream, reporting to Zipkin or adding to
the logging context.

This will be followed by a change to support initiating 128-bit traces.
2016-11-18 08:46:54 +08:00
Adrian Cole
c943e4cd50 Switches ID encoding to fixed-length (#450)
Before, we were using variable encoding for trace and span identifiers.
This complicates search for those who are copy/pasting fixed-length IDs
provisioned upstream. This moves to standard formatting, while
maintaining tolerant reads.

The code added will also be used to support 128-bit (32 char) trace IDs.

Fixes #449
2016-11-16 14:55:28 +08:00
Marcin Grzejszczak
96df523557 Added baggage support (#440)
without this change there is no support for context propagation
with this change whenever you pass the `baggage-...` for http or `baggage_` for messaging headers then such a value will be propagated through your system

fixes #237
2016-11-10 15:36:47 +01:00
Marcin Grzejszczak
9ab37c34fa Wrapping ExecutorService in its own representation
without this change ExecutorService was treated as an Executor and wrapped in the Executor bean. Due to this the bean was missing / bean of invalid type was registered.
with this change we do not wrap ExecutorService with a Executor bean, instead we wrap it in a TraceableExecutorService representation.

fixes #445
2016-11-08 15:22:40 +01:00
Marcin Grzejszczak
2ab2eb1747 Polish 2016-11-06 20:03:44 +01:00
Christoffer Sawicki
3b14e6a1f7 Allow TraceWebAutoConfiguration to work without Web MVC
Fixes #436
2016-11-06 20:03:34 +01:00
Marcin Grzejszczak
9291af89cf Updated docs 2016-11-06 12:31:03 +01:00
Marcin Grzejszczak
6f24c8866c Polish 2016-11-04 13:09:36 +01:00
Marcin Grzejszczak
83012a5aa6 Text map introduction (#439)
without this change we had to treat every mean of injecting and extracting span information separately
with this change all means of communications are abstracted. That way you configure things once only.

part of #237
2016-11-04 12:23:14 +01:00
Marcin Grzejszczak
69521f37f0 Updated version to 1.2.0 2016-11-02 13:58:40 +01:00
Marcin Grzejszczak
1eefc4c4b3 Ensuring that disabling of modules work
without this change when you disable Sleuth web client the context fails to load
with this change it's working fine. We've moved beans around + the async web client will be turned off automatically if the sync one is also disabled

fixes #433
2016-11-02 12:39:12 +01:00
Marcin Grzejszczak
5e5338869c Added error tag upon exceptions (#435)
without this change there's no error colouring on Zipkin side
with this change we set error tags
- whenever there is an exception thrown on the server side (5xx)
- wheneber on the client side it's impossible to send a message

fixes #384
2016-10-31 13:22:22 +01:00
Marcin Grzejszczak
067242288f Providing examples of how to work with executors
without this example it might be misleading for users how to work with callables and custom executors.
with this example we're showing both the case when you're using a custom executor (in this case you just have to register it as a bean and then use that bean in your callable); and also we show an example of how to reuse the taskScheduler one (it's enough to wrap it with LazyTraceExecutor).

fixes #423
2016-10-28 09:57:16 +02:00
Biju Kunjummen
92cdb8817b Issue 424 - Documentation for adding trace/span headers to http response (#429) 2016-10-27 13:42:48 +02:00
Marcin Grzejszczak
14236cfd97 Propagating exceptions in trace filter
without this change any exception occurring while creating a span will be swallowed.
with this change we're propagating the exception so that it gets handled properly.

fixes #426
2016-10-18 16:23:32 +02:00
Marcin Grzejszczak
17f68f80fd Failure in extracting headers results in new span
without this change if the users sends invalid headers then exceptions are thrown.
with this change extractors catch the exception, log it and then a new span is created. That of course will lead to an invalid trace graph cause a new trace will be created but at least business apps will not be broken due to an issue in instrumentation.

fixes #425
2016-10-18 14:42:47 +02:00
Dave Syer
825ea0ce31 Ensure lifecycle callbacks are applied to delegate
When wrapping a ThreadPoolTaskExecutor in a bean postprocessor
we should take care that the delegate gets the lifecycle callbacks
from the container. Otherwise when it is first used, the thread pool
will not have been initialized, resulting in an exception.

(Can't believe this ever actually worked)
2016-10-10 13:45:03 +01:00
Dave Syer
0e43466b91 Ensure message headers are still mutable after interceptor is called
Some components in Spring assume (perhaps wrongly) that a channel
interceptor will not convert a mutable message into an immutable
one, and they continue to modify the headers dowstream. We can
dosge the issue of whether this is right or wrong by keeping the
message headers mutable, just in case.

It would probably be better to refactor the SpanInjector so that
it works with something other than the MessageBuilder, but we can
defer doing that in favour of this smaller change that works.

Adds a test for mutability. Also tested with the
gs-messaging-stomp-websocket guide from spring.io.

Fixes gh-276
2016-10-10 13:44:46 +01:00
Marcin Grzejszczak
4a3b346888 Fixed race condition in tests 2016-10-04 14:31:15 +02:00
Marcin Grzejszczak
31cec3fc79 Fixing ConcurrentModificationException 2016-10-04 14:04:03 +02:00