Comments (9)
Unfortunately this is not possible, as the library needs to register the APIExtensionsSpan
instance with the ScopeManager
, rather than the BraveSpan
, as the wrapper intercepts various method calls on the span to then invoke the SpanObserver
.
For example, instrumentation may later retrieve the active span from the ScopeManager
to add tags, logs or finish the span. These must be performed on the APIExtensionsSpan
instance, otherwise the observer would not be called.
from java-api-extensions.
I'm going to close the issue, but feel free to re-open if you would like to discuss further. Other option would be to raise an issue against the OT spec to start a discussion about supporting the observer as part of the core API.
from java-api-extensions.
Another option to implement the extensions would be to use a proxy using java.lang.reflect.Proxy. This would solve the problem with class casts.
Did you think about this option when implementing?
from java-api-extensions.
@michbeck100 Using proxies could actually be a really good idea.
One possibly complicating factor that must be considered is the new module system introduced by Java 9. Switching to proxies may make modularizing the api-extensions in the future more difficult.
from java-api-extensions.
@michbeck100 no didn't consider this option at the time, but as @sjoerdtalsma says, could be a good idea.
Would you be interested in contributing a PR, and also possibly looking into the java9 issue mentioned by @sjoerdtalsma ?
from java-api-extensions.
Another option to implement the extensions would be to use a proxy using java.lang.reflect.Proxy. This would solve the problem with class casts.
Java Proxies only support interfaces, not classes and BraveSpan is a class. I don't believe this would work.
What might work is to keep references to spans in weak-reference, identity hashmap which maps real span to instrumented span. Before passing something to the underlying implementation you unwrap it and when we get an uninstrumented span back that we need to expose we look it up in that map.
from java-api-extensions.
On a second thought, why not have a proxy for ScopeManager
which automatically decorates any span it exposes via activeSpan
?
from java-api-extensions.
@whiskeysierra How would the proxied ScopeManager
be set on the tracer?
from java-api-extensions.
from java-api-extensions.
Related Issues (10)
- Expose trace and span ids in SpanData HOT 2
- Need ScopeObserver HOT 6
- Release 0.5.0 not available in maven central HOT 7
- Investigate why release process does not sync with maven central
- Support for Opentracing shim
- Define a Filter API
- Create a Tracer wrapper that provides support for the APIs HOT 1
- Rename repository to reflect wider scope than just observer API HOT 6
- Determine if correlation id required when dealing with SpanData HOT 2
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 java-api-extensions.