Commit Graph

370 Commits

Author SHA1 Message Date
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
Marcin Grzejszczak
baad8c404a Wrapping all Executors and ThreadPoolTaskExecutors
without this change there was a gap in passing tracing info to executors.

With this change the Executors are wrapped in LazyTraceExecutor and ThreadPoolTaskExecutors are wrapped in their tracing representation too

fixes #410
2016-10-04 13:50:31 +02:00
Adrian Cole
12b488b130 Tolerate reads of 128 bit X-B3-TraceId (#408)
The first step of transitioning to 128bit `X-B3-TraceId` is tolerantly reading 32 character long ids by throwing away the high bits (any characters left of 16 characters). This allows the tracing system to more flexibly introduce 128bit trace id support in the future.

Ex. when `X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124` is received, parse the lower 64 bits (right most 16 characters ex48485a3953bb6124) as the trace id.
2016-09-15 21:12:33 +08:00
Marcin Grzejszczak
4c3ca67235 Simplified TraceZuulHandlerMapping
without this change we were wrapping the ZuulHandlerMapping in its tracing representation.

with this change we are simplifing that by adding interceptors

fixes #399
2016-09-13 10:22:30 +02:00
Marcin Grzejszczak
9ebd9184ca Feign fixes
it turned out that some of the tests were leaky and didn't catch that ExceptionUtils were throwing an exception (race condition with Hystrix). That was due to the fact that When Hystrix with Feign were doing retries the RequestInterceptor wasn't called. That means that a new span wasn't created but a parent span was closed.

With this change the only place where the span creation and closing takes place is TraceFeignClient. I removed the Feign RequestInterceptor. Now whenever there is a retry - a new span is created and closed after getting a response. There are no exceptions, special cases etc.

In addition to that since Feign is fully immutable and SpanInjector is by design made to mutate objects I had to wrap the immutable Request in an AtomicReference in order to change the contents of the Request. I'm ashamed but didn't have a better idea. Since that is packaged scope nobody should every see that (outside the package of course)
2016-09-08 22:27:46 +02:00
Marcin Grzejszczak
a9b4cbcfe6 TraceLoadBalancerFeignClient not closing span
when TLBFC is throwing an exception the span wasn't closed. Throwing exception can occurr when IOExcepiton is thrown. Then the span wouldn't be closed and the whole series of problems occur.

fixes #393
2016-09-08 15:08:01 +02:00
Marcin Grzejszczak
ea05343137 Fixed wrapping the wrapper 2016-09-08 13:03:40 +02:00
Marcin Grzejszczak
c26a722ced Reverting the feature 2016-09-08 12:19:30 +02:00
Marcin Grzejszczak
062aba6ec1 Trying to make it work 2016-09-08 12:08:51 +02:00
Marcin Grzejszczak
9d6a45fb43 Trying to fix the build 2016-09-08 11:56:46 +02:00
Marcin Grzejszczak
8f174fd2ba Wrapping LoadBalancerFeignClient in tracing representation
without this change when using SC-Netflix 1.2.0 Feign can't call an external URL

fixes #393
2016-09-08 11:24:15 +02:00
Marcin Grzejszczak
8e21a53c25 Synchronizing on spans in ArrayListSpanAccumulator
without this change tests happen to have ConcurrentModificationException
2016-08-23 15:35:33 +02:00
Marcin Grzejszczak
b24013075a Fixing TraceFilter order (#382)
after making TraceFilter process different dispatch types we've introduced a bug related to filter ordering. TraceFilter was registered with a default ordering which is of lowest precedence.

With this change we ensure that the ordering of TraceFilter is fixed.

Fixes #380
2016-08-22 12:25:36 +02:00
Marcin Grzejszczak
070000b8fb Synchronized ArrayListSpanAccumulator spans
without this change we could have ConcurrentModificationExceptions
2016-08-18 16:12:00 +02:00
Marcin Grzejszczak
a31a900542 Wraped debug logs with conditional 2016-08-17 13:58:22 +02:00
Marcin Grzejszczak
ba9e625132 Fixing broken test 2016-08-17 13:58:22 +02:00
Marcin Grzejszczak
bbfa85eb9f Ensured reusability of Feign components
Tests have been refactored to ensure that the custom components registered as beans are working properly.

fixes #374
2016-08-16 12:08:36 +02:00
Marcin Grzejszczak
0f427cbeb9 Polish 2016-08-10 17:18:20 +02:00
Marcin Grzejszczak
ecdf32c5bc Simplified Feign (#372)
with this change we no longer treat retries as a continuation of a previous span. That way the Feign code simplifies a lot. RequestInterceptor starts a span and the TraceFeignClient will always close it no matter what's happening.

fixes #202
2016-08-09 18:54:28 +02:00
Marcin Grzejszczak
9c092227de Added NPE gueard for TraceFeignContext 2016-08-06 15:36:09 -07:00
Marcin Grzejszczak
6d542f4f68 Fixed wrong ConditionalOnClass
with this fix there no longer should be bugs related to a missing class.

fixes #363
2016-08-02 23:35:51 -07:00
Marcin Grzejszczak
d7929943a3 Fixed circular dependency
fixes #354
2016-08-01 18:01:00 -07:00
Marcin Grzejszczak
11e520c70d Updating the duration setting (#360)
* Updating the duration setting

fixes #349
2016-07-29 23:29:31 +02:00
Marcin Grzejszczak
47606bc9e3 Adding tags for Hystrix spans
with this change if a span hasnt set any Hystrix related spans then we're setting the tags even if the span gets continued (which is the case when you're using Javanica

fixes #352
2016-07-29 15:07:17 +02:00
Marcin Grzejszczak
ea57bb3088 Unified tag names
with this change the tags related to method and class name will not be hyphen delimited.

fixes #359
2016-07-29 12:44:07 +02:00
Marcin Grzejszczak
f3cbfd93e1 Returning a copy instead of a view (#356)
* Returning a copy instead of a view
* Making logs and tags thread-safe

fixed #355

* Changes following code review
2016-07-28 11:04:28 +02:00
Marcin Grzejszczak
8dbb6e36e4 Fixed missing default Feign.Builder
with this fix if someone is not using Feign he gets the default traced Feign.Builder. Thanks to this no more exceptions should be seen in terms of closing the wrong span.

fixes #350
2016-07-22 18:40:30 +02:00
Marcin Grzejszczak
e28ddc0e72 Migrated to new SpringBootTest
fixes #328
2016-07-19 23:35:30 +02:00
Marcin Grzejszczak
8de8f60c2f Disabling Hystrix for a Feign test 2016-07-19 10:19:32 +02:00
Premanand Chandrasekaran
ee80b301e8 Fix for inability to provide custom implementation of AsyncClientHttpRequestFactory (#342) 2016-07-19 10:13:18 +02:00
Marcin Grzejszczak
4a6a556af0 Added tests and fix docs for AsyncRestTemplate
fixes #334
2016-07-15 16:26:21 +02:00
Steve Oakey
bf3780536b Added patterns to @GlobalChannelInterceptor (#337)
Makes use of property place holders to set the patterns attribute of the
@GlobalChannelInterceptor annotation used for the
TraceChannelInterceptor. As supported by the annotation, only simple
patterns are supported.

Added the Spring configuration metadata for spring.sleuth.integration
properties.

Fixes gh-323
2016-07-15 08:21:03 +02:00
Marcin Grzejszczak
8d87ed4ceb Fixed the port 2016-07-14 23:45:02 +02:00
Marcin Grzejszczak
a6dd902231 Added additional javadoc information for #332 2016-07-14 13:49:11 +02:00
Marcin Grzejszczak
9d3ecca72b Fixed missing wrapping of ExecutorService
with this change the missing methods in ExecutorService are wrapped with LocalComponentTraceCallable. We are wrapping only those callables that have not already been wrapped. Kudos to @PranayPS for finding the issue and proposing a solution.

Fixes #333
2016-07-14 12:59:52 +02:00
Marcin Grzejszczak
3ac3d41bad Fix headers in messaging (#335)
* Fix headers in messaging

with this change the span related headers are changed to be compatible with messaging specs. The change is backwards compatible so we accept the old ones as input, and as output we're producing both new and old headers.

fixes #332
2016-07-14 12:06:39 +02:00
Marcin Grzejszczak
795b7c8e81 Randomized port for a test 2016-07-12 14:20:54 +02:00
Marcin Grzejszczak
f199321878 Added circle.ci integration
- also limited to 5 seconds awaits
2016-07-11 15:14:21 +02:00
Marcin Grzejszczak
81f70ff071 Removed sending the tracing information back in the response (#329)
fixes #327
2016-07-11 13:21:31 +02:00
Adrian Cole
a7aca7562a Updates to Zipkin 1.3 and rounds up Span duration to one when < 1μ (#326)
Duration of 0 is confusing to plot and can be misinterpreted as null.

See https://github.com/openzipkin/zipkin/issues/1174
See https://github.com/openzipkin/zipkin/releases/tag/1.3.0
2016-07-10 12:08:36 +08:00
Marcin Grzejszczak
bfce279d52 Re-added missing server side span (#322)
* Re-added missing server side span

with this change

- HandlerInterceptor is responsible for wrapping requests in spans
- added Sring Data REST instrumentation
- added Zuul instrumentation
- it will not wrap error controller related requests with spans
- tests have been changed to ensure that ALWAYS there is at least one span on the server side (that way it will show up in Zipkin)
- "fallback" mechanism has been added that if a HandlerInterceptor hasn't been used then we are forcing creation of a Span at the server side

fixes #321
(cherry picked from commit 4f1ef52e6c)
2016-07-07 11:03:33 +02:00
Marcin Grzejszczak
48d46b07bb Added RibbonCommand instrumentation (#318)
with this change RibbonRequestCustomizers are created for
- Netflix HttpClient
- OkHttp client
- Apache HttpClient

those customizers know how to inject span into the given context. Also a wrapper over a RibbonCommandFactory bean gets created that injects http trace keys to the given span

fixes #313
2016-06-30 13:02:31 +02:00