Comments (10)
It actually supports stacking, see Usage, but it's different from what you want. It effectively suspends the first, starts/stops a new one and resumes the first one afterwards. You'll basically only see one trace id at all times.
from opentracing-toolbox.
This is exactly why I opened this issue :)
from opentracing-toolbox.
Implementing stacking in the way you probably need it would require a breaking API change, namely Trace.getValue()
can no longer return a single value but rather an array. Alternatively we could add Tracer.getValues()
and restrict the semantics of getValue()
to return the inner trace.
Anyway, I'd like to avoid this, as stacking (in the current sense) was meant to be transparent to users/integrations. E.g. listeners that were written for non-stacked traces are expecting pairs of onStart/onStop calls. By suspending and resuming the outer trace we were able to still honor that contract and we didn't need to touch the generators at all.
Am I assuming correctly that for you to be satisfied it would be enough to see both Trace IDs in the log file? If that's the case I had an idea back then that I didn't implement but that might solve your issue:
I'd suggest to introduce a special type of TraceListener (StackedTraceListener extends TraceListener
). It won't define any additional methods or whatever, it just specifies a different contract and that would expect stacked calls like this (assuming we have an outer trace A and an inner one B):
- onStart A
- onStart B
- onStop B
- onStop A
compared to the sequence of calls that a traditional generator expects:
- onStart A
- onStop A
- onStart B
- onStop B
- onStart A
- onStop A
The stacked tracer implementation could partition both types of listeners and honor their contract separately.
Now, given that we have that interface and the implementation, I'd suggest to introduce a new module tracer-log4j
(or tracer-log4j2
) that has an NDCTraceListener
that implements this. It's a seperate module because NDC
(or Thread Context Stack as it is called now) is log4j specific and not abstracted away in slf4j.
What do you think?
from opentracing-toolbox.
I just realized that the Thread Context Stack (as well as the NDC) is not named, i.e. you only have one. That might be a problem if you have two different Traces (e.g. X-Trace-ID and X-Flow-ID) that are both stacked.
from opentracing-toolbox.
from opentracing-toolbox.
Hey, sorry.. I was busy with other parts of the software..
This sounds pretty much like what I had in mind.
Why not use the MDC?
It basically behaves like a map (so your "two traces" problem is fixed). The downside is that it only supports one value per name... You'll have to build some strange string concatenation system then to build this..
What do you think?
from opentracing-toolbox.
You'll have to build some strange string concatenation system then to build this..
Basically a stack build as a single string. Something that I'd like to avoid, but yes that's a possibility.
from opentracing-toolbox.
Another downside is that the concept of multiple active traces is only visible in the logs but nowhere else.
from opentracing-toolbox.
@JonasJurczok I created #59, please take a look
from opentracing-toolbox.
@JonasJurczok I deployed 0.11.0 to central.
from opentracing-toolbox.
Related Issues (20)
- Expand scope and purpose of the library HOT 1
- OpenTracing Spring Web Extension HOT 1
- OpenTracing Proxy Auto Configuration HOT 4
- OpenTracing JDBC Auto Configuration HOT 1
- New Proxy Plugin to limit number of unfinished Spans HOT 1
- Spring Boot Starters
- OpenTracing Servlet Extension
- OpenTracing Servlet Extension Auto Configuration
- OpenTracing Spring Web Extension Auto Configuration
- OpenTracing FlowID Auto Configuration
- Set peer.service based on principal/subject HOT 1
- Early Initialization of Beans due to TracingDataSourceBeanPostProcessor
- Register at OpenTracing Registry
- kotlin-stdlib-common-1.4.0.jar: CVE-2020-29582 HOT 2
- Release script is slightly broken HOT 6
- Opentracing-FlowID breaks when used with a NoopTracer
- Tests for opentracing-flowid-servlet fail when run on OpenJDK 11 HOT 1
- POM version is not updated after release? HOT 1
- Issue with logging in nested scopes
- Can I configure the library to log the flow id? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentracing-toolbox.