-
-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support to include the Activity distributed tracing information into …
…the Audit Event. Adding Configuration.Reset() method to reset the global settings to the default.
- Loading branch information
Federico Colombo
authored and
Federico Colombo
committed
Dec 1, 2023
1 parent
c00949f
commit a293e25
Showing
17 changed files
with
430 additions
and
60 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#if NET5_0_OR_GREATER | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Audit.Core | ||
{ | ||
public class AuditActivityTrace : IAuditOutput | ||
{ | ||
/// <summary> | ||
/// Date and time when the Activity started | ||
/// </summary> | ||
public DateTime StartTimeUtc { get; set; } | ||
|
||
/// <summary> | ||
/// SPAN part of the Id | ||
/// </summary> | ||
public string SpanId { get; set; } | ||
|
||
/// <summary> | ||
/// TraceId part of the Id | ||
/// </summary> | ||
public string TraceId { get; set; } | ||
|
||
/// <summary> | ||
/// Id of the activity's parent | ||
/// </summary> | ||
public string ParentId { get; set; } | ||
|
||
/// <summary> | ||
/// Operation name | ||
/// </summary> | ||
public string Operation { get; set; } | ||
|
||
/// <summary> | ||
/// List of tags (key/value pairs) associated to the activity | ||
/// </summary> | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public List<AuditActivityTag> Tags { get; set; } | ||
|
||
/// <summary> | ||
/// List of events (timestamped messages) attached to the activity | ||
/// </summary> | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public List<AuditActivityEvent> Events { get; set; } | ||
|
||
[JsonExtensionData] | ||
public Dictionary<string, object> CustomFields { get; set; } | ||
|
||
/// <summary> | ||
/// Serializes this Activity Info entity as a JSON string | ||
/// </summary> | ||
public string ToJson() | ||
{ | ||
return Configuration.JsonAdapter.Serialize(this); | ||
} | ||
|
||
/// <summary> | ||
/// Parses an AuditActivityInfo entity from its JSON string representation. | ||
/// </summary> | ||
/// <param name="json">JSON string with the AuditActivityInfo entity representation.</param> | ||
public static AuditActivityTrace FromJson(string json) | ||
{ | ||
return Configuration.JsonAdapter.Deserialize<AuditActivityTrace>(json); | ||
} | ||
} | ||
|
||
public class AuditActivityTag | ||
{ | ||
public string Key { get; set; } | ||
public object Value { get; set; } | ||
} | ||
|
||
public class AuditActivityEvent | ||
{ | ||
public DateTimeOffset Timestamp { get; set; } | ||
public string Name { get; set; } | ||
} | ||
} | ||
#endif |
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
Oops, something went wrong.