-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathApplicationInsightsOptions.cs
131 lines (114 loc) · 6.33 KB
/
ApplicationInsightsOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using Lombiq.Hosting.Azure.ApplicationInsights.Models;
using Microsoft.ApplicationInsights.DataContracts;
using System;
using System.Text.RegularExpressions;
namespace Lombiq.Hosting.Azure.ApplicationInsights;
/// <summary>
/// Further configuration options for the module.
/// </summary>
public class ApplicationInsightsOptions
{
/// <summary>
/// Gets or sets a value indicating whether to collect SQL queries' command texts as well during dependency
/// tracking. See: <see
/// href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-dependencies#advanced-sql-tracking-to-get-full-sql-query"/>.
/// </summary>
public bool EnableSqlCommandTextInstrumentation { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to enable a middleware that'll produce log entries on requests
/// containing the "logtest" query string parameter (i.e. "?logtest" or "&logtest" being there in the URL), as a
/// test.
/// </summary>
public bool EnableLoggingTestMiddleware { get; set; }
/// <summary>
/// Gets or sets the API key to authenticate the control channel for Quick Pulse (Live Metrics Stream). See the
/// documentation for more info: <see
/// href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/live-stream#secure-the-control-channel"/>.
/// </summary>
[Obsolete("Microsoft Entra authentication is the only supported method from 30 September 2025. API key authentication will be removed.")]
public string QuickPulseTelemetryModuleAuthenticationApiKey { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to collect authenticated user's user name, if available, on every
/// request. Note that the user name might be sensitive personally identifiable information (PII); see the official
/// documentation on handling PII: <see
/// href="https://docs.microsoft.com/en-us/azure/azure-monitor/platform/personal-data-mgmt"/>.
/// </summary>
public bool EnableUserNameCollection { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to collect the browser user agent on every request. Note that the user
/// agent might be sensitive personally identifiable information (PII); see the official documentation on handling
/// PII: <see href="https://docs.microsoft.com/en-us/azure/azure-monitor/platform/personal-data-mgmt"/>.
/// </summary>
public bool EnableUserAgentCollection { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to collect the client IP address on every request. Note that the IP
/// address might be sensitive personally identifiable information (PII); see the official documentation on handling
/// PII: <see href="https://docs.microsoft.com/en-us/azure/azure-monitor/platform/personal-data-mgmt"/>.
/// </summary>
public bool EnableIpAddressCollection { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to collect telemetry about Orchard background tasks.
/// </summary>
public bool EnableBackgroundTaskTelemetryCollection { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to enable a background task that'll produce log entries every minute.
/// Entries will only show up in AI if <see cref="EnableBackgroundTaskTelemetryCollection"/> is also <see
/// langword="true"/>.
/// </summary>
public bool EnableLoggingTestBackgroundTask { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to inject the client-side AI tracking script.
/// </summary>
public bool EnableClientSideTracking { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to use Entra authentication and which type.
/// </summary>
public EntraAuthenticationType EntraAuthenticationType { get; set; }
/// <summary>
/// Gets or sets the ServicePrincipalCredentials of the Microsoft Entra application used to secure the control
/// channel.
/// </summary>
public ServicePrincipalCredentials ServicePrincipalCredentials { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to work in kind of a debug mode completely offline. Telemetry will still
/// show up in the Debug window.
/// </summary>
public bool EnableOfflineOperation { get; set; }
/// <summary>
/// Gets or sets <see cref="RequestIgnoreFailureRegex"/> by compiling the given string into a regular expression.
/// This will be used for <see cref="RequestTelemetry"/> types.
/// </summary>
/// <example>
/// You should use a regex pattern like "(?:\\/favicon.ico$)|(?:\\.well-known)". Use non-capturing groups to improve
/// performance.
/// </example>
public string RequestIgnoreFailureRegexPattern
{
get => RequestIgnoreFailureRegex?.ToString();
set => RequestIgnoreFailureRegex = new Regex(value, RegexOptions.Compiled, TimeSpan.FromSeconds(1));
}
/// <summary>
/// Gets or sets a regular expression that will be used to set telemetry to success if it matches
/// <see cref="RequestTelemetry.Url"/>. This is useful if you have a lot of 404s or other errors that you don't want
/// to see as failures in Application Insights. This will be used for <see cref="RequestTelemetry"/> types.
/// </summary>
public Regex RequestIgnoreFailureRegex { get; set; }
/// <summary>
/// Gets or sets <see cref="DependencyIgnoreFailureRegex"/> by compiling the given string into a regular expression.
/// This will be used for <see cref="DependencyTelemetry"/> types.
/// </summary>
/// <example>
/// You should use a regex pattern like "\\/media\\/".
/// </example>
public string DependencyIgnoreFailureRegexPattern
{
get => DependencyIgnoreFailureRegex?.ToString();
set => DependencyIgnoreFailureRegex = new Regex(value, RegexOptions.Compiled, TimeSpan.FromSeconds(1));
}
/// <summary>
/// Gets or sets a regular expression that will be used to set telemetry to success if it matches
/// <see cref="DependencyTelemetry.Data"/>. This is useful if you have a lot of 404s or other errors that you don't
/// want to see as failures in Application Insights. This will be used for <see cref="DependencyTelemetry"/> types.
/// </summary>
public Regex DependencyIgnoreFailureRegex { get; set; }
}