diff --git a/documentation/schema.json b/documentation/schema.json
index 4ebe00bac0a..849324850ae 100644
--- a/documentation/schema.json
+++ b/documentation/schema.json
@@ -403,6 +403,7 @@
},
"Limits": {
"description": "The set of limits to constrain the execution of the rule and its components.",
+ "default": {},
"oneOf": [
{
"type": "null"
@@ -482,7 +483,12 @@
"Type": {
"type": "string",
"description": "The type of trigger used to monitor for a condition in the target process.",
- "minLength": 1
+ "minLength": 1,
+ "oneOf": [
+ {
+ "$ref": "#/definitions/CollectionRuleTriggerType"
+ }
+ ]
},
"Settings": {
"description": "The settings to pass to the trigger when it is executed. Settings may be optional if the trigger doesn't require settings or its settings are all optional.",
@@ -493,7 +499,71 @@
}
]
}
- }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "AspNetRequestCount"
+ },
+ "Settings": {
+ "$ref": "#/definitions/AspNetRequestCountOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "AspNetRequestDuration"
+ },
+ "Settings": {
+ "$ref": "#/definitions/AspNetRequestDurationOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "AspNetResponseStatus"
+ },
+ "Settings": {
+ "$ref": "#/definitions/AspNetResponseStatusOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "EventCounter"
+ },
+ "Settings": {
+ "$ref": "#/definitions/EventCounterOptions"
+ }
+ }
+ },
+ {
+ "properties": {
+ "Type": {
+ "const": "Startup"
+ },
+ "Settings": {
+ "type": "null"
+ }
+ }
+ }
+ ]
},
"CollectionRuleActionOptions": {
"type": "object",
@@ -505,7 +575,12 @@
"Type": {
"type": "string",
"description": "The type of action to execute.",
- "minLength": 1
+ "minLength": 1,
+ "oneOf": [
+ {
+ "$ref": "#/definitions/CollectionRuleActionType"
+ }
+ ]
},
"Settings": {
"description": "The settings to pass to the action when it is executed. Settings may be optional if the action doesn't require settings or its settings are all optional.",
@@ -516,7 +591,74 @@
}
]
}
- }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "CollectDump"
+ },
+ "Settings": {
+ "$ref": "#/definitions/CollectDumpOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "CollectGCDump"
+ },
+ "Settings": {
+ "$ref": "#/definitions/CollectGCDumpOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "CollectLogs"
+ },
+ "Settings": {
+ "$ref": "#/definitions/CollectLogsOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "CollectTrace"
+ },
+ "Settings": {
+ "$ref": "#/definitions/CollectTraceOptions"
+ }
+ }
+ },
+ {
+ "required": [
+ "Settings"
+ ],
+ "properties": {
+ "Type": {
+ "const": "Execute"
+ },
+ "Settings": {
+ "$ref": "#/definitions/ExecuteOptions"
+ }
+ }
+ }
+ ]
},
"CollectionRuleLimitsOptions": {
"type": "object",
@@ -528,7 +670,8 @@
"null"
],
"description": "The number of times the action list may be executed before being throttled.",
- "format": "int32"
+ "format": "int32",
+ "default": 5
},
"ActionCountSlidingWindowDuration": {
"type": [
@@ -849,6 +992,508 @@
}
}
},
+ "CollectionRuleActionType": {
+ "type": "string",
+ "enum": [
+ "CollectDump",
+ "CollectGCDump",
+ "CollectLogs",
+ "CollectTrace",
+ "Execute"
+ ]
+ },
+ "CollectDumpOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Egress"
+ ],
+ "properties": {
+ "Type": {
+ "description": "The type of dump to collect from the target process.",
+ "default": "WithHeap",
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/definitions/DumpType"
+ }
+ ]
+ },
+ "Egress": {
+ "type": "string",
+ "description": "The name of the egress provider to which the dump is egressed.",
+ "minLength": 1
+ }
+ }
+ },
+ "DumpType": {
+ "type": "string",
+ "description": "",
+ "x-enumNames": [
+ "Full",
+ "Mini",
+ "WithHeap",
+ "Triage"
+ ],
+ "enum": [
+ "Full",
+ "Mini",
+ "WithHeap",
+ "Triage"
+ ]
+ },
+ "CollectGCDumpOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Egress"
+ ],
+ "properties": {
+ "Egress": {
+ "type": "string",
+ "description": "The name of the egress provider to which the GC dump is egressed.",
+ "minLength": 1
+ }
+ }
+ },
+ "CollectLogsOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Egress"
+ ],
+ "properties": {
+ "DefaultLevel": {
+ "description": "The default log level at which logs are collected for entries in the FilterSpecs that do not have a specified LogLevel value.",
+ "default": "Warning",
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/definitions/LogLevel"
+ }
+ ]
+ },
+ "FilterSpecs": {
+ "type": [
+ "null",
+ "object"
+ ],
+ "description": "A custom mapping of logger categories to log levels that describes at what level a log statement that matches one of the given categories should be captured.",
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/definitions/LogLevel"
+ }
+ ]
+ }
+ },
+ "UseAppFilters": {
+ "type": [
+ "boolean",
+ "null"
+ ],
+ "description": "Specifies whether to capture log statements at the levels as specified in the application-defined filters.",
+ "default": true
+ },
+ "Duration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The duration of time in which logs are collected.",
+ "format": "time-span",
+ "default": "00:00:30"
+ },
+ "Egress": {
+ "type": "string",
+ "description": "The name of the egress provider to which the logs are egressed.",
+ "minLength": 1
+ }
+ }
+ },
+ "CollectTraceOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Egress"
+ ],
+ "properties": {
+ "Profile": {
+ "description": "Use a predefined set of event providers and settings to capture in the trace. More than one profile may be specified at the same time. Either Profile or Providers must be specified, but not both.",
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/definitions/TraceProfile"
+ }
+ ]
+ },
+ "MetricsIntervalSeconds": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "description": "The amount of time (in seconds) between the collection of each sample of the counter. Only applicable when Profile contains Metrics.",
+ "format": "int32",
+ "default": 1,
+ "maximum": 86400.0,
+ "minimum": 1.0
+ },
+ "Providers": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "A list of event providers and settings to capture in the trace. Either Profile or Providers must be specified, but not both.",
+ "items": {
+ "$ref": "#/definitions/EventPipeProvider"
+ }
+ },
+ "RequestRundown": {
+ "type": [
+ "boolean",
+ "null"
+ ],
+ "description": "Indicates that rundown information should be included in the trace.",
+ "default": true
+ },
+ "BufferSizeMegabytes": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "description": "The size of the event pipe buffer to use in the target process. If the event pipe buffer fills with too many events, newer events will be dropped until the buffer is drained to fit new events.",
+ "format": "int32",
+ "default": 256,
+ "maximum": 1024.0,
+ "minimum": 1.0
+ },
+ "Duration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The duration of time in which trace events are collected.",
+ "format": "time-span",
+ "default": "00:00:30"
+ },
+ "Egress": {
+ "type": "string",
+ "description": "The name of the egress provider to which the trace is egressed.",
+ "minLength": 1
+ }
+ }
+ },
+ "TraceProfile": {
+ "type": "string",
+ "description": "",
+ "x-enumFlags": true,
+ "x-enumNames": [
+ "Cpu",
+ "Http",
+ "Logs",
+ "Metrics"
+ ],
+ "enum": [
+ "Cpu",
+ "Http",
+ "Logs",
+ "Metrics"
+ ]
+ },
+ "EventPipeProvider": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Name"
+ ],
+ "properties": {
+ "Name": {
+ "type": "string",
+ "minLength": 1
+ },
+ "Keywords": {
+ "type": [
+ "null",
+ "string"
+ ]
+ },
+ "EventLevel": {
+ "$ref": "#/definitions/EventLevel"
+ },
+ "Arguments": {
+ "type": [
+ "null",
+ "object"
+ ],
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "EventLevel": {
+ "type": "string",
+ "description": "",
+ "x-enumNames": [
+ "LogAlways",
+ "Critical",
+ "Error",
+ "Warning",
+ "Informational",
+ "Verbose"
+ ],
+ "enum": [
+ "LogAlways",
+ "Critical",
+ "Error",
+ "Warning",
+ "Informational",
+ "Verbose"
+ ]
+ },
+ "ExecuteOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "Path"
+ ],
+ "properties": {
+ "Path": {
+ "type": "string",
+ "description": "The path of the executable to start.",
+ "minLength": 1
+ },
+ "Arguments": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The arguments to pass to the executable."
+ }
+ }
+ },
+ "CollectionRuleTriggerType": {
+ "type": "string",
+ "enum": [
+ "AspNetRequestCount",
+ "AspNetRequestDuration",
+ "AspNetResponseStatus",
+ "EventCounter",
+ "Startup"
+ ]
+ },
+ "AspNetRequestCountOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "RequestCount"
+ ],
+ "properties": {
+ "RequestCount": {
+ "type": "integer",
+ "description": "The threshold of the number of requests that start within the sliding window of time.",
+ "format": "int32"
+ },
+ "SlidingWindowDuration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The sliding time window in which the number of requests are counted.",
+ "format": "time-span",
+ "default": "00:01:00"
+ },
+ "IncludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ExcludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "AspNetRequestDurationOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "RequestCount"
+ ],
+ "properties": {
+ "RequestCount": {
+ "type": "integer",
+ "description": "The threshold of the number of slow requests that start within the sliding window of time.",
+ "format": "int32"
+ },
+ "RequestDuration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The threshold of the amount of time in which a request is considered to be slow.",
+ "format": "time-span",
+ "default": "00:00:05"
+ },
+ "SlidingWindowDuration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The sliding time window in which the the number of slow requests are counted.",
+ "format": "time-span",
+ "default": "00:01:00"
+ },
+ "IncludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ExcludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "AspNetResponseStatusOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "StatusCodes",
+ "ResponseCount"
+ ],
+ "properties": {
+ "StatusCodes": {
+ "type": "array",
+ "description": "The list of HTTP response status codes to monitor. Each item of the list can be a single code or a range of codes (e.g. \"400-499\").",
+ "minItems": 1,
+ "items": {
+ "type": "string"
+ }
+ },
+ "ResponseCount": {
+ "type": "integer",
+ "description": "The threshold number of responses with matching status codes.",
+ "format": "int32"
+ },
+ "SlidingWindowDuration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The sliding time window in which the number of responses with matching status codes must occur.",
+ "format": "time-span",
+ "default": "00:01:00"
+ },
+ "IncludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ExcludePaths": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "description": "The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "EventCounterOptions": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "ProviderName",
+ "CounterName"
+ ],
+ "properties": {
+ "ProviderName": {
+ "type": "string",
+ "description": "The name of the event source that provides the counter information.",
+ "minLength": 1
+ },
+ "CounterName": {
+ "type": "string",
+ "description": "The name of the counter to monitor.",
+ "minLength": 1
+ },
+ "GreaterThan": {
+ "type": [
+ "null",
+ "number"
+ ],
+ "description": "The threshold level the counter must maintain (or higher) for the specified duration. Either GreaterThan or LessThan (or both) must be specified.",
+ "format": "double"
+ },
+ "LessThan": {
+ "type": [
+ "null",
+ "number"
+ ],
+ "description": "The threshold level the counter must maintain (or lower) for the specified duration. Either GreaterThan or LessThan (or both) must be specified.",
+ "format": "double"
+ },
+ "SlidingWindowDuration": {
+ "type": [
+ "null",
+ "string"
+ ],
+ "description": "The sliding time window in which the counter must maintain its value as specified by the threshold levels in GreaterThan and LessThan.",
+ "format": "time-span",
+ "default": "00:01:00"
+ },
+ "Frequency": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "description": "The amount of time (in seconds) between the collection of each sample of the counter.",
+ "format": "int32",
+ "default": 5,
+ "maximum": 86400.0,
+ "minimum": 1.0
+ }
+ }
+ },
"JsonConsoleFormatterOptions": {
"type": "object",
"additionalProperties": false,
diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs
index 6b7f6b0c7fc..8bdfd6b58a5 100644
--- a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs
+++ b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs
@@ -78,6 +78,132 @@ public static string DisplayAttributeDescription_ApiAuthenticationOptions_ApiKey
}
}
+ ///
+ /// Looks up a localized string similar to The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestCountOptions_ExcludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestCountOptions_ExcludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestCountOptions_IncludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestCountOptions_IncludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold of the number of requests that start within the sliding window of time..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestCountOptions_RequestCount {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestCountOptions_RequestCount", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The sliding time window in which the number of requests are counted..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestCountOptions_SlidingWindowDuration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestCountOptions_SlidingWindowDuration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestDurationOptions_ExcludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestDurationOptions_ExcludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestDurationOptions_IncludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestDurationOptions_IncludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold of the number of slow requests that start within the sliding window of time..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestDurationOptions_RequestCount {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestDurationOptions_RequestCount", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold of the amount of time in which a request is considered to be slow..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestDurationOptions_RequestDuration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestDurationOptions_RequestDuration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The sliding time window in which the the number of slow requests are counted..
+ ///
+ public static string DisplayAttributeDescription_AspNetRequestDurationOptions_SlidingWindowDuration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetRequestDurationOptions_SlidingWindowDuration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored..
+ ///
+ public static string DisplayAttributeDescription_AspNetResponseStatusOptions_ExcludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetResponseStatusOptions_ExcludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored..
+ ///
+ public static string DisplayAttributeDescription_AspNetResponseStatusOptions_IncludePaths {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetResponseStatusOptions_IncludePaths", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold number of responses with matching status codes..
+ ///
+ public static string DisplayAttributeDescription_AspNetResponseStatusOptions_ResponseCount {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetResponseStatusOptions_ResponseCount", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The sliding time window in which the number of responses with matching status codes must occur..
+ ///
+ public static string DisplayAttributeDescription_AspNetResponseStatusOptions_SlidingWindowDuration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetResponseStatusOptions_SlidingWindowDuration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The list of HTTP response status codes to monitor. Each item of the list can be a single code or a range of codes (e.g. "400-499")..
+ ///
+ public static string DisplayAttributeDescription_AspNetResponseStatusOptions_StatusCodes {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_AspNetResponseStatusOptions_StatusCodes", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The account key used to access the Azure blob storage account..
///
@@ -142,6 +268,33 @@ public static string DisplayAttributeDescription_AzureBlobEgressProviderOptions_
}
}
+ ///
+ /// Looks up a localized string similar to The name of the egress provider to which the dump is egressed..
+ ///
+ public static string DisplayAttributeDescription_CollectDumpOptions_Egress {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectDumpOptions_Egress", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The type of dump to collect from the target process..
+ ///
+ public static string DisplayAttributeDescription_CollectDumpOptions_Type {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectDumpOptions_Type", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The name of the egress provider to which the GC dump is egressed..
+ ///
+ public static string DisplayAttributeDescription_CollectGCDumpOptions_Egress {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectGCDumpOptions_Egress", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The settings to pass to the action when it is executed. Settings may be optional if the action doesn't require settings or its settings are all optional..
///
@@ -242,6 +395,114 @@ public static string DisplayAttributeDescription_CollectionRuleTriggerOptions_Ty
}
}
+ ///
+ /// Looks up a localized string similar to The default log level at which logs are collected for entries in the FilterSpecs that do not have a specified LogLevel value..
+ ///
+ public static string DisplayAttributeDescription_CollectLogsOptions_DefaultLevel {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectLogsOptions_DefaultLevel", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The duration of time in which logs are collected..
+ ///
+ public static string DisplayAttributeDescription_CollectLogsOptions_Duration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectLogsOptions_Duration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The name of the egress provider to which the logs are egressed..
+ ///
+ public static string DisplayAttributeDescription_CollectLogsOptions_Egress {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectLogsOptions_Egress", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to A custom mapping of logger categories to log levels that describes at what level a log statement that matches one of the given categories should be captured..
+ ///
+ public static string DisplayAttributeDescription_CollectLogsOptions_FilterSpecs {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectLogsOptions_FilterSpecs", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Specifies whether to capture log statements at the levels as specified in the application-defined filters..
+ ///
+ public static string DisplayAttributeDescription_CollectLogsOptions_UseAppFilters {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectLogsOptions_UseAppFilters", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The size of the event pipe buffer to use in the target process. If the event pipe buffer fills with too many events, newer events will be dropped until the buffer is drained to fit new events..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_BufferSizeMegabytes {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_BufferSizeMegabytes", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The duration of time in which trace events are collected..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_Duration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_Duration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The name of the egress provider to which the trace is egressed..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_Egress {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_Egress", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The amount of time (in seconds) between the collection of each sample of the counter. Only applicable when Profile contains Metrics..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_MetricsIntervalSeconds {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_MetricsIntervalSeconds", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Use a predefined set of event providers and settings to capture in the trace. More than one profile may be specified at the same time. Either Profile or Providers must be specified, but not both..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_Profile {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_Profile", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to A list of event providers and settings to capture in the trace. Either Profile or Providers must be specified, but not both..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_Providers {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_Providers", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Indicates that rundown information should be included in the trace..
+ ///
+ public static string DisplayAttributeDescription_CollectTraceOptions_RequestRundown {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_CollectTraceOptions_RequestRundown", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Buffer size used when copying data from an egress callback returning a stream to the egress callback that is provided a stream to which data is written..
///
@@ -404,6 +665,78 @@ public static string DisplayAttributeDescription_EgressOptions_Properties {
}
}
+ ///
+ /// Looks up a localized string similar to The name of the counter to monitor..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_CounterName {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_CounterName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The amount of time (in seconds) between the collection of each sample of the counter..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_Frequency {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_Frequency", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold level the counter must maintain (or higher) for the specified duration. Either GreaterThan or LessThan (or both) must be specified..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_GreaterThan {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_GreaterThan", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The threshold level the counter must maintain (or lower) for the specified duration. Either GreaterThan or LessThan (or both) must be specified..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_LessThan {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_LessThan", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The name of the event source that provides the counter information..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_ProviderName {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_ProviderName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The sliding time window in which the counter must maintain its value as specified by the threshold levels in GreaterThan and LessThan..
+ ///
+ public static string DisplayAttributeDescription_EventCounterOptions_SlidingWindowDuration {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_EventCounterOptions_SlidingWindowDuration", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The arguments to pass to the executable..
+ ///
+ public static string DisplayAttributeDescription_ExecuteOptions_Arguments {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_ExecuteOptions_Arguments", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The path of the executable to start..
+ ///
+ public static string DisplayAttributeDescription_ExecuteOptions_Path {
+ get {
+ return ResourceManager.GetString("DisplayAttributeDescription_ExecuteOptions_Path", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The directory path to which the stream data will be egressed..
///
diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx
index 31b5c1f23f7..7ac93d034b4 100644
--- a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx
+++ b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx
@@ -125,6 +125,62 @@
Hash algorithm used to compute ApiKeyHash, typically 'SHA256'. 'SHA1' and 'MD5' are not allowed.
The description provided for the ApiKeyHashType parameter on ApiAuthenticationOptions.
+
+ The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.
+ The description provided for the ExcludePaths parameter on AspNetRequestCountOptions.
+
+
+ The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.
+ The description provided for the IncludePaths parameter on AspNetRequestCountOptions.
+
+
+ The threshold of the number of requests that start within the sliding window of time.
+ The description provided for the RequestCount parameter on AspNetRequestCountOptions.
+
+
+ The sliding time window in which the number of requests are counted.
+ The description provided for the SlidingWindowDuration parameter on AspNetRequestCountOptions.
+
+
+ The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.
+ The description provided for the ExcludePaths parameter on AspNetRequestDurationOptions.
+
+
+ The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.
+ The description provided for the IncludePaths parameter on AspNetRequestDurationOptions.
+
+
+ The threshold of the number of slow requests that start within the sliding window of time.
+ The description provided for the RequestCount parameter on AspNetRequestDurationOptions.
+
+
+ The threshold of the amount of time in which a request is considered to be slow.
+ The description provided for the RequestDuration parameter on AspNetRequestDurationOptions.
+
+
+ The sliding time window in which the the number of slow requests are counted.
+ The description provided for the SlidingWindowDuration parameter on AspNetRequestDurationOptions.
+
+
+ The list of request paths to ignore. A request path must exactly match one of the items in the list to be ignored.
+ The description provided for the ExcludePaths parameter on AspNetResponseStatusOptions.
+
+
+ The list of request paths to monitor. If not specified, all request paths are monitored. A request path must exactly match one of the items in the list to be monitored. Request paths matching the ExcludePaths list will not be monitored.
+ The description provided for the IncludePaths parameter on AspNetResponseStatusOptions.
+
+
+ The threshold number of responses with matching status codes.
+ The description provided for the ResponseCount parameter on AspNetResponseStatusOptions.
+
+
+ The sliding time window in which the number of responses with matching status codes must occur.
+ The description provided for the SlidingWindowDuration parameter on AspNetResponseStatusOptions.
+
+
+ The list of HTTP response status codes to monitor. Each item of the list can be a single code or a range of codes (e.g. "400-499").
+ The description provided for the StatusCodes parameter on AspNetResponseStatusOptions.
+
The account key used to access the Azure blob storage account.
The description provided for the AccountKey parameter on AzureBlobEgressProviderOptions.
@@ -153,6 +209,18 @@
The name of the shared access signature (SAS) used to look up the value from the Egress options Properties map.
The description provided for the SharedAccessSignatureName parameter on AzureBlobEgressProviderOptions.
+
+ The name of the egress provider to which the dump is egressed.
+ The description provided for the Egress parameter on CollectDumpOptions.
+
+
+ The type of dump to collect from the target process.
+ The description provided for the Type parameter on CollectDumpOptions.
+
+
+ The name of the egress provider to which the GC dump is egressed.
+ The description provided for the Egress parameter on CollectGCDumpOptions.
+
The settings to pass to the action when it is executed. Settings may be optional if the action doesn't require settings or its settings are all optional.
The description provided for the Settings parameter on CollectionRuleActionOptions.
@@ -197,6 +265,54 @@
The type of trigger used to monitor for a condition in the target process.
The description provided for the Type parameter on CollectionRuleTriggerOptions.
+
+ The default log level at which logs are collected for entries in the FilterSpecs that do not have a specified LogLevel value.
+ The description provided for the LogLevel parameter on CollectLogsOptions.
+
+
+ The duration of time in which logs are collected.
+ The description provided for the Duration parameter on CollectLogsOptions.
+
+
+ The name of the egress provider to which the logs are egressed.
+ The description provided for the Egress parameter on CollectLogsOptions.
+
+
+ A custom mapping of logger categories to log levels that describes at what level a log statement that matches one of the given categories should be captured.
+ The description provided for the FilterSpecs parameter on CollectLogsOptions.
+
+
+ Specifies whether to capture log statements at the levels as specified in the application-defined filters.
+ The description provided for the UseAppFilters parameter on CollectLogsOptions.
+
+
+ The size of the event pipe buffer to use in the target process. If the event pipe buffer fills with too many events, newer events will be dropped until the buffer is drained to fit new events.
+ The description provided for the BufferSizeMegabytes parameter on CollectTraceOptions.
+
+
+ The duration of time in which trace events are collected.
+ The description provided for the Duration parameter on CollectTraceOptions.
+
+
+ The name of the egress provider to which the trace is egressed.
+ The description provided for the Egress parameter on CollectTraceOptions.
+
+
+ The amount of time (in seconds) between the collection of each sample of the counter. Only applicable when Profile contains Metrics.
+ The description provided for the MetricsIntervalSeconds parameter on CollectTraceOptions.
+
+
+ Use a predefined set of event providers and settings to capture in the trace. More than one profile may be specified at the same time. Either Profile or Providers must be specified, but not both.
+ The description provided for the Profile parameter on CollectTraceOptions.
+
+
+ A list of event providers and settings to capture in the trace. Either Profile or Providers must be specified, but not both.
+ The description provided for the Providers parameter on CollectTraceOptions.
+
+
+ Indicates that rundown information should be included in the trace.
+ The description provided for the RequestRundown parameter on CollectTraceOptions.
+
Buffer size used when copying data from an egress callback returning a stream to the egress callback that is provided a stream to which data is written.
The description provided for the CopyBufferSize parameter on all egress provider options.
@@ -269,6 +385,38 @@
Additional properties, such as secrets, that can be referenced by the provider definitions.
The description provided for the Properties parameter on EgressOptions.
+
+ The name of the counter to monitor.
+ The description provided for the CounterName parameter on EventCounterOptions.
+
+
+ The amount of time (in seconds) between the collection of each sample of the counter.
+ The description provided for the Frequency parameter on EventCounterOptions.
+
+
+ The threshold level the counter must maintain (or higher) for the specified duration. Either GreaterThan or LessThan (or both) must be specified.
+ The description provided for the GreaterThan parameter on EventCounterOptions.
+
+
+ The threshold level the counter must maintain (or lower) for the specified duration. Either GreaterThan or LessThan (or both) must be specified.
+ The description provided for the LessThan parameter on EventCounterOptions.
+
+
+ The name of the event source that provides the counter information.
+ The description provided for the ProviderName parameter on EventCounterOptions.
+
+
+ The sliding time window in which the counter must maintain its value as specified by the threshold levels in GreaterThan and LessThan.
+ The description provided for the SlidingWindowDuration parameter on EventCounterOptions.
+
+
+ The arguments to pass to the executable.
+ The description provided for the Arguments parameter on ExecuteOptions.
+
+
+ The path of the executable to start.
+ The description provided for the Path parameter on ExecuteOptions.
+
The directory path to which the stream data will be egressed.
The description provided for the DirectoryPath parameter on FileSystemEgressProviderOptions.
diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EventPipeProvider.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EventPipeProvider.cs
index 69048db41d8..e77c55fc932 100644
--- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EventPipeProvider.cs
+++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EventPipeProvider.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#if !SCHEMAGEN
using Microsoft.Diagnostics.Monitoring.WebApi.Validation;
+#endif
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.Tracing;
@@ -17,7 +19,9 @@ public class EventPipeProvider
public string Name { get; set; }
[JsonPropertyName("keywords")]
+#if !SCHEMAGEN
[IntegerOrHexString]
+#endif
public string Keywords { get; set; } = "0x" + EventKeywords.All.ToString("X");
[JsonPropertyName("eventLevel")]
diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj
index d40e219e50f..219060fc803 100644
--- a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj
+++ b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj
@@ -3,14 +3,40 @@
Exe
net5.0
+ $(DefineConstants);SCHEMAGEN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs
index b6a3416e7fa..597ff367653 100644
--- a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs
+++ b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs
@@ -4,6 +4,10 @@
using Microsoft.Diagnostics.Monitoring.Options;
using Microsoft.Diagnostics.Tools.Monitor;
+using Microsoft.Diagnostics.Tools.Monitor.CollectionRules;
+using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options;
+using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions;
+using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using NJsonSchema;
@@ -27,6 +31,7 @@ public string GenerateSchema()
//Allow other properties in the schema.
schema.AdditionalPropertiesSchema = JsonSchema.CreateAnySchema();
+ AddCollectionRuleSchemas(context);
AddConsoleLoggerFormatterSubSchemas(context);
//TODO Figure out a better way to add object defaults
@@ -41,6 +46,7 @@ public string GenerateSchema()
schema.Definitions[nameof(LogLevelOptions)].Properties[nameof(LogLevelOptions.LogLevel)].Default = JsonSchema.CreateAnySchema();
schema.Definitions[nameof(ConsoleLoggerOptions)].Properties[nameof(ConsoleLoggerOptions.FormatterOptions)].Default = JsonSchema.CreateAnySchema();
schema.Definitions[nameof(ConsoleLoggerOptions)].Properties[nameof(ConsoleLoggerOptions.LogLevel)].Default = JsonSchema.CreateAnySchema();
+ schema.Definitions[nameof(CollectionRuleOptions)].Properties[nameof(CollectionRuleOptions.Limits)].Default = JsonSchema.CreateAnySchema();
//Make the default for each property an empty object.
foreach (KeyValuePair kvp in schema.Properties)
@@ -96,6 +102,88 @@ private static void AddDefaultConsoleLoggerOptionsSubSchema(GenerationContext co
context.Schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(consoleLoggerOptionsSchema);
}
+ private static void AddCollectionRuleSchemas(GenerationContext context)
+ {
+ JsonSchema actionTypeSchema = new JsonSchema();
+ actionTypeSchema.Type = JsonObjectType.String;
+ context.Schema.Definitions.Add("CollectionRuleActionType", actionTypeSchema);
+
+ JsonSchema collectionRuleActionOptionsTypeSubSchema = new JsonSchema();
+ collectionRuleActionOptionsTypeSubSchema.Reference = actionTypeSchema;
+
+ JsonSchema collectionRuleActionOptionsSchema = context.Schema.Definitions[nameof(CollectionRuleActionOptions)];
+ collectionRuleActionOptionsSchema.Properties[nameof(CollectionRuleActionOptions.Type)].OneOf.Add(collectionRuleActionOptionsTypeSubSchema);
+
+ AddCollectionRuleActionSchema(context, actionTypeSchema, KnownCollectionRuleActions.CollectDump);
+ AddCollectionRuleActionSchema(context, actionTypeSchema, KnownCollectionRuleActions.CollectGCDump);
+ AddCollectionRuleActionSchema(context, actionTypeSchema, KnownCollectionRuleActions.CollectLogs);
+ AddCollectionRuleActionSchema(context, actionTypeSchema, KnownCollectionRuleActions.CollectTrace);
+ AddCollectionRuleActionSchema(context, actionTypeSchema, KnownCollectionRuleActions.Execute);
+
+ JsonSchema triggerTypeSchema = new JsonSchema();
+ triggerTypeSchema.Type = JsonObjectType.String;
+ context.Schema.Definitions.Add("CollectionRuleTriggerType", triggerTypeSchema);
+
+ JsonSchema collectionRuleTriggerOptionsTypeSubSchema = new JsonSchema();
+ collectionRuleTriggerOptionsTypeSubSchema.Reference = triggerTypeSchema;
+
+ JsonSchema collectionRuleTriggerOptionsSchema = context.Schema.Definitions[nameof(CollectionRuleTriggerOptions)];
+ collectionRuleTriggerOptionsSchema.Properties[nameof(CollectionRuleTriggerOptions.Type)].OneOf.Add(collectionRuleTriggerOptionsTypeSubSchema);
+
+ AddCollectionRuleTriggerSchema(context, triggerTypeSchema, KnownCollectionRuleTriggers.AspNetRequestCount);
+ AddCollectionRuleTriggerSchema(context, triggerTypeSchema, KnownCollectionRuleTriggers.AspNetRequestDuration);
+ AddCollectionRuleTriggerSchema(context, triggerTypeSchema, KnownCollectionRuleTriggers.AspNetResponseStatus);
+ AddCollectionRuleTriggerSchema(context, triggerTypeSchema, KnownCollectionRuleTriggers.EventCounter);
+ AddCollectionRuleTriggerSchema(context, triggerTypeSchema, KnownCollectionRuleTriggers.Startup);
+ }
+
+ private static void AddCollectionRuleActionSchema(GenerationContext context, JsonSchema actionTypeSchema, string actionType)
+ {
+ JsonSchema subSchema = new JsonSchema();
+ subSchema.RequiredProperties.Add(nameof(CollectionRuleActionOptions.Settings));
+
+ JsonSchemaProperty settingsProperty = AddDiscriminatedSubSchema(
+ context.Schema.Definitions[nameof(CollectionRuleActionOptions)],
+ nameof(CollectionRuleActionOptions.Type),
+ actionType,
+ nameof(CollectionRuleActionOptions.Settings),
+ subSchema);
+
+ settingsProperty.Reference = context.AddTypeIfNotExist();
+
+ actionTypeSchema.Enumeration.Add(actionType);
+ }
+
+ private static void AddCollectionRuleTriggerSchema(GenerationContext context, JsonSchema triggerTypeSchema, string triggerType)
+ {
+ JsonSchemaProperty settingsProperty = AddDiscriminatedSubSchema(
+ context.Schema.Definitions[nameof(CollectionRuleTriggerOptions)],
+ nameof(CollectionRuleTriggerOptions.Type),
+ triggerType,
+ nameof(CollectionRuleTriggerOptions.Settings));
+
+ settingsProperty.Type = JsonObjectType.Null;
+
+ triggerTypeSchema.Enumeration.Add(triggerType);
+ }
+
+ private static void AddCollectionRuleTriggerSchema(GenerationContext context, JsonSchema triggerTypeSchema, string triggerType)
+ {
+ JsonSchema subSchema = new JsonSchema();
+ subSchema.RequiredProperties.Add(nameof(CollectionRuleTriggerOptions.Settings));
+
+ JsonSchemaProperty settingsProperty = AddDiscriminatedSubSchema(
+ context.Schema.Definitions[nameof(CollectionRuleTriggerOptions)],
+ nameof(CollectionRuleTriggerOptions.Type),
+ triggerType,
+ nameof(CollectionRuleTriggerOptions.Settings),
+ subSchema);
+
+ settingsProperty.Reference = context.AddTypeIfNotExist();
+
+ triggerTypeSchema.Enumeration.Add(triggerType);
+ }
+
private static JsonSchemaProperty AddDiscriminatedSubSchema(
JsonSchema parentSchema,
string discriminatingPropertyName,
diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj
index 3e51d912806..2d79a32d998 100644
--- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj
+++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj
@@ -12,19 +12,28 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/CollectionRuleOptionsTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/CollectionRuleOptionsTests.cs
index 4d0c5adb0a1..222731d31bb 100644
--- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/CollectionRuleOptionsTests.cs
+++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/CollectionRuleOptionsTests.cs
@@ -368,7 +368,7 @@ public Task CollectionRuleOptions_CollectLogsAction_RoundTrip()
.AddCollectLogsAction(ExpectedEgressProvider, out CollectLogsOptions collectLogsOptions);
collectLogsOptions.UseAppFilters = ExpectedUseAppFilters;
- collectLogsOptions.LogLevel = ExpectedLogLevel;
+ collectLogsOptions.DefaultLevel = ExpectedLogLevel;
collectLogsOptions.FilterSpecs = ExpectedFilterSpecs;
collectLogsOptions.Duration = ExpectedDuration;
@@ -378,7 +378,7 @@ public Task CollectionRuleOptions_CollectLogsAction_RoundTrip()
{
CollectLogsOptions collectLogsOptions = ruleOptions.VerifyCollectLogsAction(0, ExpectedEgressProvider);
Assert.Equal(ExpectedUseAppFilters, collectLogsOptions.UseAppFilters);
- Assert.Equal(ExpectedLogLevel, collectLogsOptions.LogLevel);
+ Assert.Equal(ExpectedLogLevel, collectLogsOptions.DefaultLevel);
Assert.NotNull(collectLogsOptions.FilterSpecs);
Assert.Equal(ExpectedFilterSpecs.Count, collectLogsOptions.FilterSpecs.Count);
foreach ((string expectedCategory, LogLevel? expectedLogLevel) in ExpectedFilterSpecs)
@@ -400,14 +400,14 @@ public Task CollectionRuleOptions_CollectLogsAction_PropertyValidation()
.SetStartupTrigger()
.AddCollectLogsAction(egress: null, out CollectLogsOptions collectLogsOptions);
- collectLogsOptions.LogLevel = (LogLevel)100;
+ collectLogsOptions.DefaultLevel = (LogLevel)100;
collectLogsOptions.Duration = TimeSpan.FromDays(3);
},
ex =>
{
string[] failures = ex.Failures.ToArray();
Assert.Equal(3, failures.Length);
- VerifyEnumDataTypeMessage(failures, 0, nameof(CollectLogsOptions.LogLevel));
+ VerifyEnumDataTypeMessage(failures, 0, nameof(CollectLogsOptions.DefaultLevel));
VerifyRangeMessage(failures, 1, nameof(CollectLogsOptions.Duration),
ActionOptionsConstants.Duration_MinValue, ActionOptionsConstants.Duration_MaxValue);
VerifyRequiredMessage(failures, 2, nameof(CollectLogsOptions.Egress));
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptions.cs
index 65a778bee35..9268223942a 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptions.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using Microsoft.Diagnostics.Monitoring.WebApi.Models;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
@@ -14,11 +16,18 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
[DebuggerDisplay("CollectDump")]
internal sealed partial class CollectDumpOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectDumpOptions_Type))]
[EnumDataType(typeof(DumpType))]
+ [DefaultValue(CollectDumpOptionsDefaults.Type)]
public DumpType? Type { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectDumpOptions_Egress))]
[Required]
-#if !UNITTEST
+#if !UNITTEST && !SCHEMAGEN
[ValidateEgressProvider]
#endif
public string Egress { get; set; }
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptionsDefaults.cs
new file mode 100644
index 00000000000..f0cdbb9c600
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectDumpOptionsDefaults.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Microsoft.Diagnostics.Monitoring.WebApi.Models;
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
+{
+ internal static class CollectDumpOptionsDefaults
+ {
+ public const DumpType Type = DumpType.WithHeap;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectGCDumpOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectGCDumpOptions.cs
index 143f19f2a6c..f1531e8b6b9 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectGCDumpOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectGCDumpOptions.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
@@ -13,8 +14,11 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
[DebuggerDisplay("CollectGCDump")]
internal sealed partial class CollectGCDumpOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectGCDumpOptions_Egress))]
[Required]
-#if !UNITTEST
+#if !UNITTEST && !SCHEMAGEN
[ValidateEgressProvider]
#endif
public string Egress { get; set; }
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptions.cs
index e2744d6c060..6c11f0073b1 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptions.cs
@@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
@@ -16,18 +18,36 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
[DebuggerDisplay("CollectLogs")]
internal sealed partial class CollectLogsOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectLogsOptions_DefaultLevel))]
[EnumDataType(typeof(LogLevel))]
- public LogLevel? LogLevel { get; set; }
+ [DefaultValue(CollectLogsOptionsDefaults.DefaultLevel)]
+ public LogLevel? DefaultLevel { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectLogsOptions_FilterSpecs))]
public Dictionary FilterSpecs { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectLogsOptions_UseAppFilters))]
+ [DefaultValue(CollectLogsOptionsDefaults.UseAppFilters)]
public bool? UseAppFilters { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectLogsOptions_Duration))]
[Range(typeof(TimeSpan), ActionOptionsConstants.Duration_MinValue, ActionOptionsConstants.Duration_MaxValue)]
+ [DefaultValue(CollectLogsOptionsDefaults.Duration)]
public TimeSpan? Duration { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectLogsOptions_Egress))]
[Required]
-#if !UNITTEST
+#if !UNITTEST && !SCHEMAGEN
[ValidateEgressProvider]
#endif
public string Egress { get; set; }
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptionsDefaults.cs
new file mode 100644
index 00000000000..619c767e886
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectLogsOptionsDefaults.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
+{
+ internal static class CollectLogsOptionsDefaults
+ {
+ public const Extensions.Logging.LogLevel DefaultLevel = Extensions.Logging.LogLevel.Warning;
+ public const bool UseAppFilters = true;
+ public const string Duration = "00:00:30";
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptions.cs
index 2ef87d59732..06b5df605d1 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptions.cs
@@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using Microsoft.Diagnostics.Monitoring.WebApi.Models;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
@@ -16,24 +18,49 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
[DebuggerDisplay("CollectTrace")]
internal sealed partial class CollectTraceOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_Profile))]
[EnumDataType(typeof(TraceProfile))]
public TraceProfile? Profile { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_MetricsIntervalSeconds))]
[Range(ActionOptionsConstants.MetricsIntervalSeconds_MinValue, ActionOptionsConstants.MetricsIntervalSeconds_MaxValue)]
+ [DefaultValue(CollectTraceOptionsDefaults.MetricsIntervalSeconds)]
public int? MetricsIntervalSeconds { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_Providers))]
public List Providers { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_RequestRundown))]
+ [DefaultValue(CollectTraceOptionsDefaults.RequestRundown)]
public bool? RequestRundown { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_BufferSizeMegabytes))]
[Range(ActionOptionsConstants.BufferSizeMegabytes_MinValue, ActionOptionsConstants.BufferSizeMegabytes_MaxValue)]
+ [DefaultValue(CollectTraceOptionsDefaults.BufferSizeMegabytes)]
public int? BufferSizeMegabytes { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_Duration))]
[Range(typeof(TimeSpan), ActionOptionsConstants.Duration_MinValue, ActionOptionsConstants.Duration_MaxValue)]
+ [DefaultValue(CollectTraceOptionsDefaults.Duration)]
public TimeSpan? Duration { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectTraceOptions_Egress))]
[Required]
-#if !UNITTEST
+#if !UNITTEST && !SCHEMAGEN
[ValidateEgressProvider]
#endif
public string Egress { get; set; }
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptionsDefaults.cs
new file mode 100644
index 00000000000..ad8e453a1cb
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/CollectTraceOptionsDefaults.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
+{
+ internal static class CollectTraceOptionsDefaults
+ {
+ public const int MetricsIntervalSeconds = 1;
+ public const bool RequestRundown = true;
+ public const int BufferSizeMegabytes = 256;
+ public const string Duration = "00:00:30";
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/ExecuteOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/ExecuteOptions.cs
index 1d993af9907..b5f135f053c 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/ExecuteOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Actions/ExecuteOptions.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
@@ -13,9 +14,15 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions
[DebuggerDisplay("Execute: Path = {Path}")]
internal sealed class ExecuteOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_ExecuteOptions_Path))]
[Required]
public string Path { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_ExecuteOptions_Arguments))]
public string Arguments { get; set; }
}
}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs
index b6eebda4e7b..123860229ee 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs
@@ -4,6 +4,7 @@
using Microsoft.Diagnostics.Monitoring.WebApi;
using System;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options
@@ -16,6 +17,7 @@ internal sealed class CollectionRuleLimitsOptions
[Display(
ResourceType = typeof(OptionsDisplayStrings),
Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleLimitsOptions_ActionCount))]
+ [DefaultValue(CollectionRuleLimitsOptionsDefaults.ActionCount)]
public int? ActionCount { get; set; }
[Display(
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptionsDefaults.cs
new file mode 100644
index 00000000000..74b935d94fa
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptionsDefaults.cs
@@ -0,0 +1,11 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options
+{
+ internal static class CollectionRuleLimitsOptionsDefaults
+ {
+ public const int ActionCount = 5;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptions.cs
index b45b0122054..442081db8bc 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptions.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
@@ -10,16 +12,34 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
///
/// Options for the AspNetRequestCount trigger.
///
- internal sealed class AspNetRequestCountOptions
+ internal sealed class AspNetRequestCountOptions :
+ IAspNetActionPathFilters
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestCountOptions_RequestCount))]
[Required]
public int RequestCount { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestCountOptions_SlidingWindowDuration))]
[Range(typeof(TimeSpan), TriggerOptionsConstants.SlidingWindowDuration_MinValue, TriggerOptionsConstants.SlidingWindowDuration_MaxValue)]
+ [DefaultValue(AspNetRequestCountOptionsDefaults.SlidingWindowDuration)]
public TimeSpan? SlidingWindowDuration { get; set; }
- public string IncludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestCountOptions_IncludePaths))]
+ public string[] IncludePaths { get; set; }
- public string ExcludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestCountOptions_ExcludePaths))]
+ public string[] ExcludePaths { get; set; }
}
}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptionsDefaults.cs
new file mode 100644
index 00000000000..ced503e4f62
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestCountOptionsDefaults.cs
@@ -0,0 +1,11 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
+{
+ internal static class AspNetRequestCountOptionsDefaults
+ {
+ public const string SlidingWindowDuration = TriggerOptionsConstants.SlidingWindowDuration_Default;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptions.cs
index c80fda9caaa..d701101cb31 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptions.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
@@ -10,18 +12,40 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
///
/// Options for the AspNetRequestDuration trigger.
///
- internal sealed class AspNetRequestDurationOptions
+ internal sealed class AspNetRequestDurationOptions :
+ IAspNetActionPathFilters
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestDurationOptions_RequestCount))]
[Required]
public int RequestCount { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestDurationOptions_RequestDuration))]
+ [DefaultValue(AspNetRequestDurationOptionsDefaults.RequestDuration)]
public TimeSpan? RequestDuration { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestDurationOptions_SlidingWindowDuration))]
[Range(typeof(TimeSpan), TriggerOptionsConstants.SlidingWindowDuration_MinValue, TriggerOptionsConstants.SlidingWindowDuration_MaxValue)]
+ [DefaultValue(AspNetRequestDurationOptionsDefaults.SlidingWindowDuration)]
public TimeSpan? SlidingWindowDuration { get; set; }
- public string IncludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestDurationOptions_IncludePaths))]
+ public string[] IncludePaths { get; set; }
- public string ExcludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetRequestDurationOptions_ExcludePaths))]
+ public string[] ExcludePaths { get; set; }
}
}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptionsDefaults.cs
new file mode 100644
index 00000000000..a0926f9ddd3
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetRequestDurationOptionsDefaults.cs
@@ -0,0 +1,12 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
+{
+ internal static class AspNetRequestDurationOptionsDefaults
+ {
+ public const string RequestDuration = "00:00:05";
+ public const string SlidingWindowDuration = TriggerOptionsConstants.SlidingWindowDuration_Default;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptions.cs
index 7eb10e68f69..b0a60f78db2 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptions.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
@@ -10,19 +12,41 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
///
/// Options for the AspNetResponseStatus trigger.
///
- internal sealed class AspNetResponseStatusOptions
+ internal sealed class AspNetResponseStatusOptions :
+ IAspNetActionPathFilters
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetResponseStatusOptions_StatusCodes))]
[Required]
- public string StatusCodes { get; set; }
+ [MinLength(1)]
+ public string[] StatusCodes { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetResponseStatusOptions_ResponseCount))]
[Required]
public int ResponseCount { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetResponseStatusOptions_SlidingWindowDuration))]
[Range(typeof(TimeSpan), TriggerOptionsConstants.SlidingWindowDuration_MinValue, TriggerOptionsConstants.SlidingWindowDuration_MaxValue)]
+ [DefaultValue(AspNetResponseStatusOptionsDefaults.SlidingWindowDuration)]
public TimeSpan? SlidingWindowDuration { get; set; }
- public string IncludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetResponseStatusOptions_IncludePaths))]
+ public string[] IncludePaths { get; set; }
- public string ExcludePaths { get; set; }
+ // CONSIDER: Currently described that paths have to exactly match one item in the list.
+ // Consider allowing for wildcard/globbing to simplfy list of matchable paths.
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AspNetResponseStatusOptions_ExcludePaths))]
+ public string[] ExcludePaths { get; set; }
}
}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptionsDefaults.cs
new file mode 100644
index 00000000000..679e68a5eff
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/AspNetResponseStatusOptionsDefaults.cs
@@ -0,0 +1,11 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
+{
+ internal static class AspNetResponseStatusOptionsDefaults
+ {
+ public const string SlidingWindowDuration = TriggerOptionsConstants.SlidingWindowDuration_Default;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptions.cs
index daed120b240..26f2d673f50 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptions.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptions.cs
@@ -2,7 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using Microsoft.Diagnostics.Monitoring.WebApi;
using System;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
@@ -12,20 +14,40 @@ namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
///
internal sealed partial class EventCounterOptions
{
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_ProviderName))]
[Required]
public string ProviderName { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_CounterName))]
[Required]
public string CounterName { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_GreaterThan))]
public double? GreaterThan { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_LessThan))]
public double? LessThan { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_SlidingWindowDuration))]
[Range(typeof(TimeSpan), TriggerOptionsConstants.SlidingWindowDuration_MinValue, TriggerOptionsConstants.SlidingWindowDuration_MaxValue)]
+ [DefaultValue(EventCounterOptionsDefaults.SlidingWindowDuration)]
public TimeSpan? SlidingWindowDuration { get; set; }
+ [Display(
+ ResourceType = typeof(OptionsDisplayStrings),
+ Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_EventCounterOptions_Frequency))]
[Range(TriggerOptionsConstants.CounterFrequency_MinValue, TriggerOptionsConstants.CounterFrequency_MaxValue)]
+ [DefaultValue(EventCounterOptionsDefaults.Frequency)]
public int? Frequency { get; set; }
}
}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptionsDefaults.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptionsDefaults.cs
new file mode 100644
index 00000000000..fa0eab17e78
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterOptionsDefaults.cs
@@ -0,0 +1,12 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
+{
+ internal static class EventCounterOptionsDefaults
+ {
+ public const string SlidingWindowDuration = TriggerOptionsConstants.SlidingWindowDuration_Default;
+ public const int Frequency = 5;
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/IAspNetActionPathFilters.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/IAspNetActionPathFilters.cs
new file mode 100644
index 00000000000..8566ba1931f
--- /dev/null
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/IAspNetActionPathFilters.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers
+{
+ internal interface IAspNetActionPathFilters
+ {
+ public string[] IncludePaths { get; }
+
+ public string[] ExcludePaths { get; }
+ }
+}
diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/TriggerOptionsConstants.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/TriggerOptionsConstants.cs
index dbf0a270cb3..57f52f90fd6 100644
--- a/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/TriggerOptionsConstants.cs
+++ b/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/TriggerOptionsConstants.cs
@@ -13,7 +13,8 @@ internal static class TriggerOptionsConstants
public static readonly string Frequency_MaxValue_String = CounterFrequency_MaxValue.ToString(CultureInfo.InvariantCulture);
public const int CounterFrequency_MinValue = 1; // 1 second
public static readonly string Frequency_MinValue_String = CounterFrequency_MinValue.ToString(CultureInfo.InvariantCulture);
-
+
+ public const string SlidingWindowDuration_Default = "00:01:00"; // 1 minute
public const string SlidingWindowDuration_MaxValue = "1.00:00:00"; // 1 day
public const string SlidingWindowDuration_MinValue = "00:00:01"; // 1 second
}