-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added activities and events, moving on to metrics
- Loading branch information
1 parent
8ae4451
commit fd1cdf2
Showing
285 changed files
with
2,832 additions
and
439 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1019:Define accessors for attribute arguments")] | ||
sealed public class CounterAttribute : MetricAttributeBase { | ||
public CounterAttribute() { | ||
} | ||
|
||
public CounterAttribute(bool autoIncrement) { | ||
AutoIncrement = autoIncrement; | ||
} | ||
|
||
public CounterAttribute(string name, string? unit = null, string? description = null, bool autoIncrement = false) | ||
: base(name, unit, description) { | ||
AutoIncrement = autoIncrement; | ||
} | ||
|
||
public bool AutoIncrement { get; set; } | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Purview.Telemetry.Shared/Metrics/HistogramAttribute.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,12 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class HistogramAttribute : MetricAttributeBase { | ||
public HistogramAttribute() { | ||
} | ||
|
||
public HistogramAttribute(string name, string? unit = null, string? description = null) | ||
: base(name, unit, description) { | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Purview.Telemetry.Shared/Metrics/MeasurementTagAttribute.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,18 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1019:Define accessors for attribute arguments")] | ||
sealed public class MeasurementTagAttribute : Attribute { | ||
public MeasurementTagAttribute() { | ||
} | ||
|
||
public MeasurementTagAttribute(string name) { | ||
Name = name; | ||
} | ||
|
||
/// <summary> | ||
/// Optional. Gets the overridden name of the tag. | ||
/// </summary> | ||
public string? Name { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Purview.Telemetry.Shared/Metrics/MeasurementValueAttribute.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,6 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class MeasurementValueAttribute : Attribute { | ||
} |
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,18 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1019:Define accessors for attribute arguments")] | ||
sealed public class MeterAttribute : Attribute { | ||
public MeterAttribute() { | ||
} | ||
|
||
public MeterAttribute(string name) { | ||
Name = name; | ||
} | ||
|
||
/// <summary> | ||
/// Optional. Gets/ sets the name of the metric. | ||
/// </summary> | ||
public string? Name { get; set; } | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Purview.Telemetry.Shared/Metrics/MetricAttributeBase.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,19 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
abstract public class MetricAttributeBase : Attribute { | ||
protected MetricAttributeBase() { | ||
} | ||
|
||
protected MetricAttributeBase(string name, string? unit = null, string? description = null) { | ||
Name = name; | ||
Unit = unit; | ||
Description = description; | ||
} | ||
|
||
public string? Name { get; set; } | ||
|
||
public string? Unit { get; set; } | ||
|
||
public string? Description { get; set; } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Purview.Telemetry.Shared/Metrics/MetricExcludeAttribute.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,6 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class MetricExcludeAttribute : Attribute { | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Purview.Telemetry.Shared/Metrics/ObservableCounterAttribute.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,12 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class ObservableCounterAttribute : MetricAttributeBase { | ||
public ObservableCounterAttribute() { | ||
} | ||
|
||
public ObservableCounterAttribute(string name, string? unit = null, string? description = null) | ||
: base(name, unit, description) { | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Purview.Telemetry.Shared/Metrics/ObservableGaugeAttribute.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,12 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class ObservableGaugeAttribute : MetricAttributeBase { | ||
public ObservableGaugeAttribute() { | ||
} | ||
|
||
public ObservableGaugeAttribute(string name, string? unit = null, string? description = null) | ||
: base(name, unit, description) { | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Purview.Telemetry.Shared/Metrics/ObservableUpDownCounterAttribute.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,12 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class ObservableUpDownCounterAttribute : MetricAttributeBase { | ||
public ObservableUpDownCounterAttribute() { | ||
} | ||
|
||
public ObservableUpDownCounterAttribute(string name, string? unit = null, string? description = null) | ||
: base(name, unit, description) { | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Purview.Telemetry.Shared/Metrics/UpDownCounterAttribute.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,12 @@ | ||
namespace Purview.Telemetry.Metrics; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
[System.Diagnostics.Conditional(Constants.EmbedAttributesHashDefineName)] | ||
sealed public class UpDownCounterAttribute : MetricAttributeBase { | ||
public UpDownCounterAttribute() { | ||
} | ||
|
||
public UpDownCounterAttribute(string name, string? unit, string? description) | ||
: base(name, unit, description) { | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
...rate_GivenBasicGenWithReturningActivity_GeneratesActivity#ActivityAttribute.g.verified.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,57 @@ | ||
//HintName: ActivityAttribute.g.cs | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by the Purview.Telemetry.SourceGenerator | ||
// on {Scrubbed}. | ||
// | ||
// Changes to this file may cause incorrect behaviour and will be lost | ||
// when the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
#pragma warning disable 1591 // publicly visible type or member must be documented | ||
|
||
#if PURVIEW_TELEMETRY_EMBED_ATTRIBUTES | ||
|
||
namespace Purview.Telemetry.Activities; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1019:Define accessors for attribute arguments")] | ||
sealed class ActivityAttribute : Attribute { | ||
|
||
public ActivityAttribute() { | ||
} | ||
|
||
public ActivityAttribute(string name) { | ||
Name = name; | ||
} | ||
|
||
public ActivityAttribute(ActivityGeneratedKind kind) { | ||
Kind = kind; | ||
} | ||
|
||
public ActivityAttribute(string name, ActivityGeneratedKind kind, bool createOnly = false) { | ||
Name = name; | ||
Kind = kind; | ||
CreateOnly = createOnly; | ||
} | ||
|
||
/// <summary> | ||
/// Optional. Gets the name of the activity. | ||
/// </summary> | ||
public string? Name { get; set; } | ||
|
||
/// <summary> | ||
/// Optional. Gets the <see cref="ActivityGeneratedKind">kind</see> of the | ||
/// activity. Defaults to <see cref="ActivityGeneratedKind.Internal"/>. | ||
/// </summary> | ||
public ActivityGeneratedKind Kind { get; set; } = ActivityGeneratedKind.Internal; | ||
|
||
/// <summary> | ||
/// If true, the Activity is crated via ActivitySource.CreateActivity, meaning it is not started by default. Otherwise | ||
/// ActivitySource.StartActivity is used. The default is false. | ||
/// </summary> | ||
public bool CreateOnly { get; set; } | ||
} | ||
|
||
#endif |
35 changes: 35 additions & 0 deletions
35
...GivenBasicGenWithReturningActivity_GeneratesActivity#ActivityEventAttribute.g.verified.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,35 @@ | ||
//HintName: ActivityEventAttribute.g.cs | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by the Purview.Telemetry.SourceGenerator | ||
// on {Scrubbed}. | ||
// | ||
// Changes to this file may cause incorrect behaviour and will be lost | ||
// when the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
#pragma warning disable 1591 // publicly visible type or member must be documented | ||
|
||
#if PURVIEW_TELEMETRY_EMBED_ATTRIBUTES | ||
|
||
namespace Purview.Telemetry.Activities; | ||
|
||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1019:Define accessors for attribute arguments")] | ||
sealed class ActivityEventAttribute : Attribute { | ||
|
||
public ActivityEventAttribute() { | ||
} | ||
|
||
public ActivityEventAttribute(string name) { | ||
Name = name; | ||
} | ||
|
||
/// <summary> | ||
/// Optional. Gets/ sets the name of the event. | ||
/// </summary> | ||
public string? Name { get; set; } | ||
} | ||
|
||
#endif |
25 changes: 25 additions & 0 deletions
25
...venBasicGenWithReturningActivity_GeneratesActivity#ActivityExcludeAttribute.g.verified.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,25 @@ | ||
//HintName: ActivityExcludeAttribute.g.cs | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by the Purview.Telemetry.SourceGenerator | ||
// on {Scrubbed}. | ||
// | ||
// Changes to this file may cause incorrect behaviour and will be lost | ||
// when the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
#pragma warning disable 1591 // publicly visible type or member must be documented | ||
|
||
#if PURVIEW_TELEMETRY_EMBED_ATTRIBUTES | ||
|
||
namespace Purview.Telemetry.Activities; | ||
|
||
/// <summary> | ||
/// Excludes the method from any activity generation. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
sealed class ActivityExcludeAttribute : Attribute { | ||
} | ||
|
||
#endif |
Oops, something went wrong.