Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -485,5 +485,50 @@ public void CustomerSdkStatsInitializationFailed(Exception ex)

[Event(48, Message = "Customer SDK stats initialization failed due to an exception. This is only for internal telemetry and can safely be ignored. {0}", Level = EventLevel.Warning)]
public void CustomerSdkStatsInitializationFailed(string exceptionMessage) => WriteEvent(48, exceptionMessage);

[Event(51, Message = "Failure to calculate CPU Counter. Unexpected negative timespan: PreviousCollectedTime: {0}. RecentCollectedTime: {1}. Not user actionable.", Level = EventLevel.Error)]
public void ProcessCountersUnexpectedNegativeTimeSpan(long previousCollectedTime, long recentCollectedTime) => WriteEvent(51, previousCollectedTime, recentCollectedTime);

[Event(52, Message = "Failure to calculate CPU Counter. Unexpected negative value: PreviousCollectedValue: {0}. RecentCollectedValue: {1}. Not user actionable.", Level = EventLevel.Error)]
public void ProcessCountersUnexpectedNegativeValue(long previousCollectedValue, long recentCollectedValue) => WriteEvent(52, previousCollectedValue, recentCollectedValue);

[Event(53, Message = "Calculated Cpu Counter: Period: {0}. DiffValue: {1}. CalculatedValue: {2}. ProcessorCount: {3}. NormalizedValue: {4}", Level = EventLevel.Verbose)]
public void ProcessCountersCpuCounter(long period, long diffValue, double calculatedValue, int processorCount, double normalizedValue) => WriteEvent(53, period, diffValue, calculatedValue, processorCount, normalizedValue);

[NonEvent]
public void FailedToCollectProcessPrivateBytes(System.Exception ex)
{
if (IsEnabled(EventLevel.Error))
{
FailedToCollectProcessPrivateBytes(ex.FlattenException().ToInvariantString());
}
}

[Event(54, Message = "Failed to collect Process Private Bytes due to an exception. {0}", Level = EventLevel.Warning)]
public void FailedToCollectProcessPrivateBytes(string exceptionMessage) => WriteEvent(54, exceptionMessage);

[NonEvent]
public void FailedToCalculateRequestRate(Exception ex)
{
if (IsEnabled(EventLevel.Warning))
{
FailedToCalculateRequestRate(ex.FlattenException().ToInvariantString());
}
}

[Event(55, Message = "Failed to calculate request rate due to an exception. {0}", Level = EventLevel.Warning)]
public void FailedToCalculateRequestRate(string exceptionMessage) => WriteEvent(55, exceptionMessage);

[NonEvent]
public void FailedToCalculateExceptionRate(Exception ex)
{
if (IsEnabled(EventLevel.Warning))
{
FailedToCalculateExceptionRate(ex.FlattenException().ToInvariantString());
}
}

[Event(56, Message = "Failed to calculate exception rate due to an exception. {0}", Level = EventLevel.Warning)]
public void FailedToCalculateExceptionRate(string exceptionMessage) => WriteEvent(56, exceptionMessage);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Monitor.OpenTelemetry.Exporter.Internals
{
internal static class PerfCounterConstants
{
internal const string PerfCounterMeterName = "PerfCounterMeter";
internal const string RequestRateInstrumentationName = "RequestCounterRate";
internal const string ProcessCpuInstrumentationName = "ProcessCpu";
internal const string ProcessCpuNormalizedInstrumentationName = "ProcessCpuNormalized";
internal const string ProcessPrivateBytesInstrumentationName = "ProcessPrivateBytes";
internal const string ExceptionRateName = "AzureMonitorExceptionRate";

// Breeze perf counter names
internal const string ExceptionRateMetricIdValue = "\\.NET CLR Exceptions(??APP_CLR_PROC??)\\# of Exceps Thrown / sec";
internal const string RequestRateMetricIdValue = "\\ASP.NET Applications(??APP_W3SVC_PROC??)\\Requests/Sec";
internal const string ProcessCpuMetricIdValue = "\\Process(??APP_WIN32_PROC??)\\% Processor Time";
internal const string ProcessCpuNormalizedMetricIdValue = "\\Process(??APP_WIN32_PROC??)\\% Processor Time Normalized";
internal const string ProcessPrivateBytesMetricIdValue = "\\Process(??APP_WIN32_PROC??)\\Private Bytes";
}
}
Loading
Loading