Removed MaxTraceSeverityLevelValuesToDiscover
This commit is contained in:
Родитель
19b175eec6
Коммит
b330514f51
|
@ -2,8 +2,6 @@ Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTra
|
|||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleNameValuesToDiscover.get -> int
|
||||
|
|
|
@ -2,8 +2,6 @@ Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTra
|
|||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleNameValuesToDiscover.get -> int
|
||||
|
|
|
@ -2,8 +2,6 @@ Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTra
|
|||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleNameValuesToDiscover.get -> int
|
||||
|
|
|
@ -2,8 +2,6 @@ Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTra
|
|||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceCloudRoleNameValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxTraceSeverityLevelValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.get -> int
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleInstanceValuesToDiscover.set -> void
|
||||
Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor.MaxExceptionCloudRoleNameValuesToDiscover.get -> int
|
||||
|
|
|
@ -1222,68 +1222,6 @@
|
|||
Assert.AreEqual(4, telemetrySentToChannel.Count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Trace_TelemetryRespectsDimLimitSeverityLevel()
|
||||
{
|
||||
List<ITelemetry> telemetrySentToChannel = new List<ITelemetry>();
|
||||
Func<ITelemetryProcessor, AutocollectedMetricsExtractor> extractorFactory =
|
||||
(nextProc) => {
|
||||
var metricExtractor = new AutocollectedMetricsExtractor(nextProc);
|
||||
metricExtractor.MaxTraceSeverityLevelValuesToDiscover = 0;
|
||||
return metricExtractor;
|
||||
};
|
||||
|
||||
TelemetryConfiguration telemetryConfig = CreateTelemetryConfigWithExtractor(telemetrySentToChannel, extractorFactory);
|
||||
using (telemetryConfig)
|
||||
{
|
||||
TelemetryClient client = new TelemetryClient(telemetryConfig);
|
||||
// Track 3 traces with 3 different values for Severity Level - Error, Critical, Verbose.
|
||||
// As MaxTraceSeverityLevelValuesToDiscover = 0, we expect all severity level to be rolled into Other
|
||||
client.TrackTrace("Test 1", SeverityLevel.Error);
|
||||
client.TrackTrace("Test 2", SeverityLevel.Critical);
|
||||
client.TrackTrace("Test 3", SeverityLevel.Verbose);
|
||||
}
|
||||
|
||||
Assert.AreEqual(4, telemetrySentToChannel.Count);
|
||||
|
||||
AssertEx.IsType<TraceTelemetry>(telemetrySentToChannel[0]);
|
||||
Assert.AreEqual("Test 1", ((TraceTelemetry)telemetrySentToChannel[0]).Message);
|
||||
Assert.AreEqual(true, ((TraceTelemetry)telemetrySentToChannel[0]).Properties.ContainsKey("_MS.ProcessedByMetricExtractors"));
|
||||
Assert.AreEqual("(Name:'Traces', Ver:'1.1')",
|
||||
((TraceTelemetry)telemetrySentToChannel[0]).Properties["_MS.ProcessedByMetricExtractors"]);
|
||||
|
||||
AssertEx.IsType<TraceTelemetry>(telemetrySentToChannel[1]);
|
||||
Assert.AreEqual("Test 2", ((TraceTelemetry)telemetrySentToChannel[1]).Message);
|
||||
Assert.AreEqual(true, ((TraceTelemetry)telemetrySentToChannel[1]).Properties.ContainsKey("_MS.ProcessedByMetricExtractors"));
|
||||
Assert.AreEqual("(Name:'Traces', Ver:'1.1')",
|
||||
((TraceTelemetry)telemetrySentToChannel[1]).Properties["_MS.ProcessedByMetricExtractors"]);
|
||||
|
||||
AssertEx.IsType<TraceTelemetry>(telemetrySentToChannel[2]);
|
||||
Assert.AreEqual("Test 3", ((TraceTelemetry)telemetrySentToChannel[2]).Message);
|
||||
Assert.AreEqual(true, ((TraceTelemetry)telemetrySentToChannel[2]).Properties.ContainsKey("_MS.ProcessedByMetricExtractors"));
|
||||
Assert.AreEqual("(Name:'Traces', Ver:'1.1')",
|
||||
((TraceTelemetry)telemetrySentToChannel[2]).Properties["_MS.ProcessedByMetricExtractors"]);
|
||||
|
||||
AssertEx.IsType<MetricTelemetry>(telemetrySentToChannel[3]);
|
||||
var metricTel = telemetrySentToChannel[3] as MetricTelemetry;
|
||||
// validate standard fields
|
||||
Assert.IsTrue(metricTel.Properties.ContainsKey("_MS.AggregationIntervalMs"));
|
||||
Assert.IsTrue(metricTel.Context.GlobalProperties.ContainsKey("_MS.IsAutocollected"));
|
||||
Assert.AreEqual("True", metricTel.Context.GlobalProperties["_MS.IsAutocollected"]);
|
||||
Assert.IsTrue(metricTel.Context.GlobalProperties.ContainsKey("_MS.MetricId"));
|
||||
Assert.AreEqual("traces/count", metricTel.Context.GlobalProperties["_MS.MetricId"]);
|
||||
|
||||
// validate dimensions exist
|
||||
Assert.AreEqual(true, metricTel.Properties.ContainsKey("trace/severityLevel"));
|
||||
Assert.AreEqual(true, metricTel.Properties.ContainsKey("cloud/roleInstance"));
|
||||
Assert.AreEqual(true, metricTel.Properties.ContainsKey("cloud/roleName"));
|
||||
Assert.AreEqual(true, metricTel.Properties.ContainsKey("operation/synthetic"));
|
||||
|
||||
var resultCodeDimension = metricTel.Properties["trace/severityLevel"];
|
||||
// As MaxTraceSeverityLevelValuesToDiscover = 0, we expect all severity level to be rolled into Other
|
||||
Assert.AreEqual("Other", resultCodeDimension);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Trace_TelemetryRespectsDimLimitCloudRoleInstance()
|
||||
{
|
||||
|
@ -1542,7 +1480,6 @@
|
|||
public void Trace_DefaultDimensionLimitsValidation()
|
||||
{
|
||||
var traceExtractor = new TraceMetricsExtractor();
|
||||
Assert.AreEqual(5, traceExtractor.MaxTraceSeverityLevelValuesToDiscover);
|
||||
Assert.AreEqual(2, traceExtractor.MaxCloudRoleNameValuesToDiscover);
|
||||
Assert.AreEqual(2, traceExtractor.MaxCloudRoleInstanceValuesToDiscover);
|
||||
}
|
||||
|
|
|
@ -290,29 +290,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum distinct values for SeverityLevel for Trace telemetry.
|
||||
/// Values encountered after this limit is hit will be collapsed into a single value DIMENSION_CAPPED.
|
||||
/// Setting 0 will all values to be replaced with a single value "Other".
|
||||
/// </summary>
|
||||
public int MaxTraceSeverityLevelValuesToDiscover
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.extractorForTraceMetrics.MaxTraceSeverityLevelValuesToDiscover;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(value), value, "MaxTraceSeverityLevelValuesToDiscover value may not be negative.");
|
||||
}
|
||||
|
||||
this.extractorForTraceMetrics.MaxTraceSeverityLevelValuesToDiscover = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum distinct values for CloudRoleInstance for Request telemetry.
|
||||
/// Values encountered after this limit is hit will be collapsed into a single value DIMENSION_CAPPED.
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
{
|
||||
public const string DimensionCapFallbackValue = "DIMENSION-CAPPED";
|
||||
public const string Unknown = "Unknown";
|
||||
public const string Unspecified = "Unspecified";
|
||||
public const string Other = "Other";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
|
||||
internal class TraceSeverityLevelDimensionExtractor : IDimensionExtractor
|
||||
{
|
||||
public int MaxValues { get; set; }
|
||||
public int MaxValues { get; set; } = 6;
|
||||
|
||||
public string DefaultValue { get; set; } = MetricTerms.Autocollection.Common.PropertyValues.Unknown;
|
||||
public string DefaultValue { get; set; } = MetricTerms.Autocollection.Common.PropertyValues.Unspecified;
|
||||
|
||||
public string Name { get; set; } = MetricTerms.Autocollection.TraceCount.PropertyNames.SeverityLevel;
|
||||
|
||||
public string ExtractDimension(ITelemetry item)
|
||||
{
|
||||
var trace = item as TraceTelemetry;
|
||||
if (trace != null)
|
||||
if (trace?.SeverityLevel != null)
|
||||
{
|
||||
var sevLevel = (int)trace.SeverityLevel.GetValueOrDefault();
|
||||
var sevLevel = (int)trace.SeverityLevel;
|
||||
return sevLevel.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -14,11 +14,6 @@
|
|||
/// </summary>
|
||||
internal class TraceMetricsExtractor : ISpecificAutocollectedMetricsExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// The default value for the <see cref="MaxTraceSeverityLevelValuesToDiscover"/> property.
|
||||
/// </summary>
|
||||
public const int MaxTraceSeverityLevelValuesToDiscoverDefault = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The default value for the <see cref="MaxCloudRoleInstanceValuesToDiscover"/> property.
|
||||
/// </summary>
|
||||
|
@ -46,11 +41,6 @@
|
|||
|
||||
public string ExtractorVersion { get; } = "1.1";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of auto-discovered trace types.
|
||||
/// </summary>
|
||||
public int MaxTraceSeverityLevelValuesToDiscover { get; set; } = MaxTraceSeverityLevelValuesToDiscoverDefault;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of auto-discovered Cloud RoleInstance values.
|
||||
/// </summary>
|
||||
|
@ -76,7 +66,7 @@
|
|||
if (!this.isInitialized)
|
||||
{
|
||||
this.dimensionExtractors.Add(new TraceMetricIdDimensionExtractor());
|
||||
this.dimensionExtractors.Add(new TraceSeverityLevelDimensionExtractor() { MaxValues = this.MaxTraceSeverityLevelValuesToDiscover });
|
||||
this.dimensionExtractors.Add(new TraceSeverityLevelDimensionExtractor());
|
||||
this.dimensionExtractors.Add(new SyntheticDimensionExtractor());
|
||||
this.dimensionExtractors.Add(new CloudRoleInstanceDimensionExtractor() { MaxValues = this.MaxCloudRoleInstanceValuesToDiscover });
|
||||
this.dimensionExtractors.Add(new CloudRoleNameDimensionExtractor() { MaxValues = this.MaxCloudRoleNameValuesToDiscover });
|
||||
|
|
Загрузка…
Ссылка в новой задаче