Open
Description
Description
I am getting Collection rule '__rule__' filters do not match the process.
error when running dotnet-monitor
to automatically collect trace of an application upon high cpu usage.
Steps to Repro
- Start the process to be monitored.
DOTNET_DiagnosticPorts=/tmp/port.sock dotnet App.dll
- Start dotnet-monitor in listen mode:
dotnet-monitor collect --configuration-file-path settings.json
I get this in the logs and the collection doesn't happen.
23:51:39 info: Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService[42]
=> TargetProcessId:313967 TargetRuntimeInstanceCookie:d2fc35cb90f24e27985e2884822c8832 CollectionRuleName:HighCpuRule
Collection rule 'HighCpuRule' filters do not match the process.
The settings.json
{
"$schema": "https://aka.ms/dotnet-monitor-schema",
"DiagnosticPort": {
"ConnectionMode": "Listen",
"EndpointName": "/tmp/port.sock"
},
"CollectionRules": {
"HighCpuRule": {
"Filters": [
{
"CommandLine": "App.dll",
"MatchType": "Contains"
}],
"Trigger": {
"Type": "EventCounter",
"Settings": {
"ProviderName": "System.Runtime",
"CounterName": "cpu-usage",
"GreaterThan": 0, <------------------ To ensure the collection of trace happens immediately.
"SlidingWindowDuration": "00:00:10"
}
},
"Actions": [{
"Type": "CollectTrace",
"Settings": {
"Profile": "Cpu",
"Duration": "00:01:00",
"Egress": "monitorFile"
}
}],
"Limits": {
"ActionCount": 2,
"ActionCountSlidingWindowDuration": "1:00:00"
}
}
},
"Egress": {
"FileSystem": {
"monitorFile": {
"directoryPath": "/tmp"
}
}
}
}
Configuration
Ubuntu 22.04.4 LTS (Jammy Jellyfish) on Windows 11 WSL
dotnet-monitor version: 8.0.0+8c7f7afdfa9b2472bb1d791e953480f214586ae6
dotnet version: 8.0.112
Output of dotnet --info
.NET SDK:
Version: 8.0.112
Commit: 3f0c4a16e5
Workload version: 8.0.100-manifests.784cc8f7
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/sdk/8.0.112/
.NET workloads installed:
Workload version: 8.0.100-manifests.784cc8f7
There are no installed workloads to display.
Host:
Version: 8.0.12
Architecture: x64
Commit: 89ef51c5d8
.NET SDKs installed:
7.0.119 [/usr/lib/dotnet/sdk]
8.0.112 [/usr/lib/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.12 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Regression?
Didn't try on an earlier release.
Workaround
It works if I restart the dotnet-monitor
.
- Start the process to be monitored.
DOTNET_DiagnosticPorts=/tmp/port.sock dotnet App.dll
- Start dotnet-monitor in listen mode:
dotnet-monitor collect --configuration-file-path settings.json
. This will throw the "filters do not match the process" error. - Kill dotnet-monitor via
pkill -f 'dotnet-monitor collect'
- Start dotnet-monitor again
dotnet-monitor collect --configuration-file-path settings.json
. This time it works.
00:07:22 info: Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService[29]
=> TargetProcessId:313967 TargetRuntimeInstanceCookie:d2fc35cb90f24e27985e2884822c8832 CollectionRuleName:HighCpuRule
Collection rule 'HighCpuRule' started.
00:07:22 info: Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService[35]
=> TargetProcessId:313967 TargetRuntimeInstanceCookie:d2fc35cb90f24e27985e2884822c8832 CollectionRuleName:HighCpuRule => CollectionRuleTriggerType:EventCounter
Collection rule 'HighCpuRule' trigger 'EventCounter' started.