Skip to content

ActivitySource started activities aren't using an accurate utcnow on framework. #45111

Closed
@cg110

Description

@cg110

Description

Activity source started events on .net framework don't have accurate duration. This appears to be due to the use of DateTime.UtcNow:

activity.StartTimeUtc = startTime == default ? DateTime.UtcNow : startTime.UtcDateTime;

In other code paths GetUtcNow() is used to get an accurate timestamp.

This can be observed by durations being 00:00:00.0000001 on .net framework.

Configuration

.net framework 4.8
Windows 10 2004.
x64

Regression?

Not a regression, as activity source is new, but diagnostic source had accurate durations.

Other information

I suspect the only workaround is to provide an accurate timestamp to the calls to StartActivity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions