Skip to content

Commit

Permalink
Proposed new System.Diagnostics APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekgh committed Feb 25, 2020
1 parent 634b348 commit 0033a42
Show file tree
Hide file tree
Showing 13 changed files with 855 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace System.Diagnostics
{
public partial class Activity
public partial class Activity : IDisposable
{
public Activity(string operationName) { }
public System.Diagnostics.ActivityTraceFlags ActivityTraceFlags { get { throw null; } set { } }
Expand All @@ -34,6 +34,7 @@ public string? Id
get { throw null; }
}
public System.Diagnostics.ActivityIdFormat IdFormat { get { throw null; } }
public System.Diagnostics.ActivityKind Kind { get; set; }
public string OperationName { get { throw null; } }
public System.Diagnostics.Activity? Parent { get { throw null; } }
public string? ParentId { get { throw null; } }
Expand All @@ -43,9 +44,11 @@ public string? Id
public System.Diagnostics.ActivitySpanId SpanId { get { throw null; } }
public System.DateTime StartTimeUtc { get { throw null; } }
public System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>> Tags { get { throw null; } }
public System.Collections.Generic.IEnumerable<ActivityLink> Links { get { throw null; } }
public System.Diagnostics.ActivityTraceId TraceId { get { throw null; } }
public string? TraceStateString { get { throw null; } set { } }
public System.Diagnostics.Activity AddBaggage(string key, string? value) { throw null; }
public System.Diagnostics.Activity AddLink(ActivityLink link) { throw null; }
public System.Diagnostics.Activity AddTag(string key, string? value) { throw null; }
public string? GetBaggageItem(string key) { throw null; }
public System.Diagnostics.Activity SetEndTime(System.DateTime endTimeUtc) { throw null; }
Expand All @@ -55,6 +58,9 @@ public string? Id
public System.Diagnostics.Activity SetStartTime(System.DateTime startTimeUtc) { throw null; }
public System.Diagnostics.Activity Start() { throw null; }
public void Stop() { }
public void Dispose() { }
public void SetCustomProperty(string propertyName, object? propertyValue) { }
public object? GetCustomProperty(string propertyName) { throw null; }
}
public enum ActivityIdFormat
{
Expand Down Expand Up @@ -121,4 +127,55 @@ public virtual void OnActivityImport(System.Diagnostics.Activity activity, objec
public System.Diagnostics.Activity StartActivity(System.Diagnostics.Activity activity, object? args) { throw null; }
public void StopActivity(System.Diagnostics.Activity activity, object? args) { }
}
public enum ActivitySourceEventOperation
{
SourceCreated = 0,
ActivityStarted = 1,
ActivityStopped = 2
}
public enum ActivityKind
{
Internal = 1,
Server = 2,
Client = 3,
Producer = 4,
Consumer = 5,
}
public sealed class ActivitySourceEventArgs : System.EventArgs
{
private ActivitySourceEventArgs() { throw null; }
public System.Diagnostics.ActivitySourceEventOperation Operation { get; }
}
public readonly struct ActivityContext : IEquatable<ActivityContext>
{
public ActivityContext(System.Diagnostics.ActivityTraceId traceId, System.Diagnostics.ActivitySpanId spanId, System.Diagnostics.ActivityTraceFlags traceOptions, string? traceState = null) { throw null; }
public System.Diagnostics.ActivityTraceId TraceId { get; }
public System.Diagnostics.ActivitySpanId SpanId { get; }
public System.Diagnostics.ActivityTraceFlags TraceFlags { get; }
public string? TraceState { get; }
public static bool operator ==(System.Diagnostics.ActivityContext context1, System.Diagnostics.ActivityContext context2) { throw null; }
public static bool operator !=(System.Diagnostics.ActivityContext context1, System.Diagnostics.ActivityContext context2) { throw null; }
public bool Equals(System.Diagnostics.ActivityContext context) { throw null; }
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public readonly struct ActivityLink
{
public ActivityLink(System.Diagnostics.ActivityContext context) { throw null; }
public ActivityLink(System.Diagnostics.ActivityContext context, System.Collections.Generic.IDictionary<string, object>? attributes) { throw null; }
public System.Diagnostics.ActivityContext Context { get; }
public System.Collections.Generic.IDictionary<string, object>? Attributes { get; }
}
public sealed class ActivitySource : IDisposable
{
private ActivitySource() { throw null; }
public ActivitySource(string name) { throw null; }
public static event EventHandler<System.Diagnostics.ActivitySourceEventArgs>? OperationEvent { add { } remove { } }
public event EventHandler<System.Diagnostics.ActivitySourceEventArgs>? ActivityEvent { add { } remove { } }
public static System.Collections.Generic.IEnumerable<System.Diagnostics.ActivitySource> ActiveList => throw null;
public string Name { get; }
public Activity? CreateActivity() { throw null; }
public Activity? CreateActivity(System.Diagnostics.ActivityContext context, System.Collections.Generic.IEnumerable<ActivityLink>? links = null, System.DateTimeOffset startTime = default) { throw null; }
public void Dispose() { }
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -144,9 +144,15 @@
<data name="SetFormatOnStartedActivity" xml:space="preserve">
<value>"Can not change format for an activity that was already started"</value>
</data>
<data name="SetLinkInvalid" xml:space="preserve">
<value>"Can not add link to activity after it has been started"</value>
</data>
<data name="SetParentIdOnActivityWithParent" xml:space="preserve">
<value>"Can not set ParentId on activity which has parent"</value>
</data>
<data name="SpanIdOrTraceIdInvalid" xml:space="preserve">
<value>"Invalid SpanId or TraceId"</value>
</data>
<data name="StartTimeNotUtc" xml:space="preserve">
<value>"StartTime is not UTC"</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<Link>Common\System\HexConverter.cs</Link>
</Compile>
<Compile Include="System\Diagnostics\Activity.cs" />
<Compile Include="System\Diagnostics\ActivityContext.cs" />
<Compile Include="System\Diagnostics\ActivityKind.cs" />
<Compile Include="System\Diagnostics\ActivityLink.cs" />
<Compile Include="System\Diagnostics\ActivitySource.cs" />
<Compile Include="System\Diagnostics\ActivitySourceEventArgs.cs" />
<Compile Include="System\Diagnostics\DiagnosticSourceActivity.cs" />
<Reference Include="System.Memory" />
<Reference Include="System.Runtime.CompilerServices.Unsafe" />
Expand Down
Loading

0 comments on commit 0033a42

Please sign in to comment.