This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return Id generation algorithm, use Machine name on platforms which s…
…upport that
- Loading branch information
Liudmila Molkova
committed
Feb 8, 2017
1 parent
62c7055
commit 3864212
Showing
7 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Id.MachineName.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace System.Diagnostics | ||
{ | ||
public partial class Activity | ||
{ | ||
#region private | ||
private string generateUniquePrefix() | ||
{ | ||
int uniqNum = (int)Stopwatch.GetTimestamp(); | ||
return $"{s_rootIdPrefix}{Environment.MachineName}_{uniqNum:x}"; | ||
} | ||
#endregion | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Id.Random.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace System.Diagnostics | ||
{ | ||
public partial class Activity | ||
{ | ||
#region private | ||
private string generateUniquePrefix() | ||
{ | ||
byte[] bytes = new byte[8]; | ||
s_random.Value.NextBytes(bytes); | ||
|
||
return $"{s_rootIdPrefix}{BitConverter.ToUInt64(bytes, 0):x}"; | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters