Comments (3)
Thank you for reaching out.
Your code snippets seem almost fine, so I'm wondering why that didn't work. The only problem that might be is if the channel is empty, span_rx.try_recv()
will immediately return Err(TryRecvError::Empty)
and break the above while loop.
BTW, if you could share a working example code to reproduce the issue, I would investigate it in more detail.
from rustracing_jaeger.
Thank you very much, you were right - loop was called before the request :)
I fixed it with RAII magic.
I'll post here parts of my code just in case if it will be useful.
Thank you again!
pub struct TraceSender<'a> {
pub channel_receiver: &'a Receiver<FinishedSpan>,
pub reporter: Option<&'a JaegerCompactReporter>,
}
impl<'a> Drop for TraceSender<'a> {
fn drop(&mut self) {
if let Some(reporter) = self.reporter {
while let Ok(span) = self.channel_receiver.try_recv() {
let _ = reporter.report(&[span]);
}
}
}
}
pub struct TraceFactory {
pub tracer: Tracer,
channel_receiver: Receiver<FinishedSpan>,
reporter: Option<JaegerCompactReporter>,
}
impl TraceFactory {
pub fn new(tracer: Tracer, channel_receiver: Receiver<FinishedSpan>, reporter_name: &str) -> TraceFactory {
let reporter = match JaegerCompactReporter::new(reporter_name) {
Ok(r) => Some(r),
Err(_) => None
};
TraceFactory { tracer, channel_receiver, reporter }
}
pub fn get_sender(&self) -> TraceSender {
TraceSender { channel_receiver: &self.channel_receiver, reporter: self.reporter.as_ref() }
}
}
from rustracing_jaeger.
My pleasure :)
from rustracing_jaeger.
Related Issues (18)
- Example incorrect HOT 3
- Allow connecting to non-local agents HOT 2
- Enable injectors and extractors bound to tracer HOT 1
- Constructing TraceId from String HOT 2
- Ability to send spans directly to collector over HTTP HOT 1
- What is the expected way of using this library across threads? HOT 3
- Automatically set ip tag HOT 4
- Example panics HOT 1
- Bind to localhost instead of INADDR_ANY for reporter UDP socket creation HOT 7
- Logs & Tags not coming through to Jaeger UI. HOT 1
- Make it possible to retrieve `flags` HOT 1
- Remove the requirement to use `crossbeam` HOT 2
- reporter: support for async futures-based report() HOT 6
- Running into an error when using an alternative SocketAddr. HOT 11
- Allow generating span from known TraceId HOT 4
- Impl OpenTracing default carrier traits for SpanContextState. HOT 1
- Help wanted: Use span and Sub-span 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 rustracing_jaeger.