log to indicated Authentication Policy caught the response from ingestion (#2319)

This commit is contained in:
Timothy Mothra 2021-07-09 10:26:22 -07:00 коммит произвёл GitHub
Родитель 7c6589e2c5
Коммит dfa51220a5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -565,6 +565,12 @@
this.WriteEvent(77, exception ?? string.Empty, this.ApplicationName);
}
[Event(78, Message = "AuthenticatedTransmissionError. Received a failed ingestion response. TransmissionId: {0}. Status Code: {1}. Status Description: {2}", Level = EventLevel.Warning)]
public void AuthenticationPolicyCaughtFailedIngestion(string transmissionId, string statusCode, string statusDescription, string appDomainName = "Incorrect")
{
this.WriteEvent(78, transmissionId ?? string.Empty, statusCode ?? string.Empty, statusDescription ?? string.Empty, this.ApplicationName);
}
private static string GetApplicationName()
{
//// We want to add application name to all events BUT

Просмотреть файл

@ -1,6 +1,7 @@
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.TransmissionPolicy
{
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.Channel.Implementation;
@ -65,6 +66,10 @@
{
case ResponseStatusCodes.Unauthorized:
case ResponseStatusCodes.Forbidden:
TelemetryChannelEventSource.Log.AuthenticationPolicyCaughtFailedIngestion(
transmissionId: e.Transmission.Id,
statusCode: e.Response.StatusCode.ToString(CultureInfo.InvariantCulture),
statusDescription: e.Response.StatusDescription);
this.ApplyThrottlePolicy(e);
break;
}