Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAD: AuthenticationTransmissionPolicy logging #2319

Merged
merged 1 commit into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ public void TransmissionFlushAsyncWarning(string exception, string appDomainName
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -65,6 +66,10 @@ private void HandleTransmissionSentEvent(object sender, TransmissionProcessedEve
{
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;
}
Expand Down