Class EventMetricCollector
Base class for all System.Diagnostics.Tracing.EventListener based IMetricCollector instances.
Implements
Namespace: Eco.Core.DebugStatistic.Collectors
Assembly: Eco.Core.dll
Syntax
public class EventMetricCollector : EventListener, IMetricCollector
Constructors
EventMetricCollector(Int32, String)
Declaration
public EventMetricCollector(int listenerKeyword, string metricPrefix)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | listenerKeyword | |
System.String | metricPrefix |
Fields
listenerKeyword
Integer keyword value used to initialize our System.Diagnostics.Tracing.EventListener instance.
Declaration
protected int listenerKeyword
Field Value
Type | Description |
---|---|
System.Int32 |
metricPrefix
Represents the prefix value used to store metrics with PerformancePlugin. MetricPrefix.XXXX = Value.
Declaration
protected string metricPrefix
Field Value
Type | Description |
---|---|
System.String |
Methods
GetMetric(String)
Retrieves the generic key/value metric currently being stored for reports/publishing.
Declaration
protected double GetMetric(string metricName)
Parameters
Type | Name | Description |
---|---|---|
System.String | metricName |
Returns
Type | Description |
---|---|
System.Double | Stored value if the metric exists. Otherwise 0. |
Initialize()
Declaration
public void Initialize()
OnEventSourceCreated(EventSource)
Declaration
protected override void OnEventSourceCreated(EventSource eventSource)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Tracing.EventSource | eventSource |
Shutdown()
Declaration
public void Shutdown()
StoreEventData(EventWrittenEventArgs)
Stores the payload of an System.Diagnostics.Tracing.EventWrittenEventArgs object from the System.Diagnostics.Tracing.EventListener as metrics in the PerformancePlugin singleton instance.
Declaration
protected void StoreEventData(EventWrittenEventArgs eventData)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Tracing.EventWrittenEventArgs | eventData | Event payload to store as metrics. |
StoreMetric(String, Double)
Stores a generic key/value metric for generating reports/publishing to external sources.
Declaration
protected void StoreMetric(string metricName, double value)
Parameters
Type | Name | Description |
---|---|---|
System.String | metricName | |
System.Double | value | Current value of the metric. |