Git Product home page Git Product logo

Comments (9)

andylokandy avatar andylokandy commented on June 16, 2024 1

Because concurrency is not supported in local span, it's not possible to start a local span whose parent are not the current local parent.

I assume you're interested in tracing a single thread within an asynchronous runtime, correct? Could you describe what kind of results or data you expect to collect from this process?

from minitrace-rust.

andylokandy avatar andylokandy commented on June 16, 2024 1

@dotansimha, I've devised an alternative solution. Can you please check if it works for you? Here's the link: #201

from minitrace-rust.

dotansimha avatar dotansimha commented on June 16, 2024 1

@dotansimha, I've devised an alternative solution. Can you please check if it works for you? Here's the link: #201

Interesting, thanks @andylokandy !

So I guess I should use Span now just like before? with the new single-thread feature enabled? (instead or with enabled?)

from minitrace-rust.

andylokandy avatar andylokandy commented on June 16, 2024 1

You may set both enable and single-thread, and use minitrace::flush() to manually report.

from minitrace-rust.

dotansimha avatar dotansimha commented on June 16, 2024

I assume you're interested in tracing a single thread within an asynchronous runtime, correct? Could you describe what kind of results or data you expect to collect from this process?

Yeah, that's exactly what I'm building! A single-threaded (WASM, CF Worker) with async runtime (wasm-bindgen).

The main issue is that some parts of the codebase are fully agnostic to the runtime, so it's using Span and in_span for the Futures. The main issue is that these are fully ignored when LocalSpan and the LocalCollector are used. I only get SpanRecords for traces created by #[trace] or LocalSpan::enter_with_local_parent.

from minitrace-rust.

andylokandy avatar andylokandy commented on June 16, 2024

Local span can support concurrency but may not be easy... Currently, when a local span exits(drops), the parent of it will become the local parent. We need to add a logical parent to local span that are used to be the parent in SpanRecord, while keeping the real parent unchanged.

from minitrace-rust.

dotansimha avatar dotansimha commented on June 16, 2024

Local span can support concurrency but may not be easy... Currently, when a local span exits(drops), the parent of it will become the local parent. We need to add a logical parent to local span that are used to be the parent in SpanRecord, while keeping the real parent unchanged.

I see. Any insight on why #[trace] does work fine in my case? I'm putting it on async functions and it seems to work fine so far πŸ€” My current workaround is to split my code to functions and add #[trace].

from minitrace-rust.

andylokandy avatar andylokandy commented on June 16, 2024

Any insight on why #[trace] does work fine in my case?

could you give a minimum reprodicible example?

from minitrace-rust.

dotansimha avatar dotansimha commented on June 16, 2024

@andylokandy see https://github.com/dotansimha/minitrace-localspan-reproduce

Basically, I'm facing several issues here (all mentioned in code comments in the repo):

  1. I can't use in_span (FutureExt) with LocalSpan for async functions.
  2. I can't create LocalSpan with an explicit parent (missing LocalSpan::enter_with_parent)

UPDATE 1:
Just noticed a weird behavior, where I have an async function with #[trace] and it doesn't have any traces reported πŸ€” Adding enter_on_poll = true seems to partially fix it. Now I have more than one span created for each function call πŸ€”

UPDATE 2:
I think the main issue is the async runtime as you mentioned @andylokandy . Seems like the async function with the #[trace] is eventually using the minitrace::future::FutureExt::in_span wrapper, so it's using Span which is not being collected by the LocalCollector.

sync functions with the macro are wrapped with LocalSpan::enter_with_local_parent so I assume that's why it's working.

@andylokandy so I guess the issue is the missing async handling for LocalSpan? When I'm creating the spans manually with LocalSpan::enter_with_local_parent, it seems to work pretty well with the async functions.

from minitrace-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.