Skip to content

Accurate self-time for migrated async functions #94

@rocketman-code

Description

@rocketman-code

Context

When a Guard detects thread migration on drop, it sets self_ns = elapsed_ns (wall time). This overcounts self-time when migrated children exist, because children_ms tracking happens via TLS parent updates which don't work cross-thread.

The current behavior is documented in a code comment in collector.rs: "No children info available on the drop thread, so self = wall. May overcount when migrated children exist."

Scope

This is a known limitation of the initial async support (PR #82). Accurate self-time for migrated functions would require cross-thread child time attribution, likely via atomic counters or channels in SpanContext.

Discovered during code review of PR #82.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions