Trigger trace based on collection rules #3144
-
I am trying to configure dotnet monitor to run trace based on collection rules. According to the docs, I have setup my dotnet container as follows using env basically putting the dotnet monitor in listen mode: env:
and I have configured my dotnet app with the following inside the container image: export DOTNET_DiagnosticPorts="/diag/port.sock,suspend" I setup the CPU threshold very low to trigger the trace, but I get the following in the logs for the app container: The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port. DOTNET_DiagnosticPorts="/tmp/port.sock,suspend" DOTNET_DefaultDiagnosticPortSuspend=0 Just wondering, what am I doing wrong here? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
You should probably be using ENV to add environment variables to your container image, otherwise I think they are only available at image build time. However, in general, I would not recommend setting this environment variable as part of your container image; it should be set by your deployment mechanism as an environment variable on the container.
This tells me that some other aspect of your deployment is setting the |
Beta Was this translation helpful? Give feedback.
-
Thanks. I will check the deployment and see what is setting DOTNET_DiagnosticPorts environment variable on the container and will use ENV rather than export. |
Beta Was this translation helpful? Give feedback.
-
I made the necessary changes and my deployment manifest looks like this: apiVersion: apps/v1 Now when I deploy it in the kubernetes cluster, I get the following in the sample dotnet app log: The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port. and I get the following errors in the dotnet monitor container logs: at Microsoft.Diagnostics.NETCore.Client.IpcServerTransport.Create(String address, Int32 maxConnections, Boolean enableTcpIpProtocol, IIpcServerTransportCallbackInternal transportCallback) Looks like the environment variable DOTNET_DiagnosticPorts is not getting set. |
Beta Was this translation helpful? Give feedback.
-
I deployed. This time I am not getting any errors in app container. In the collection rules I setup very small threshold of CPU usage greater than 0. Here are my collection rules:
~ |
Beta Was this translation helpful? Give feedback.
-
The error is related to Egress provider: Message":"Collection rule \u0027HighCpuRule\u0027 failed.","Exception":"Microsoft.Extensions.Options.OptionsValidationException: Egress provider \u0027diagvol\u0027 does not exist I have tried the Egress provide "TmpDir" and I get the same error that says the Egress provider does not exist. |
Beta Was this translation helpful? Give feedback.
-
I added the following in the env section for the dotnet monitor container for the Filesystem egress provider.
Now I am getting the error below which says "An egress provider must be specified if there is no default egress provider". {"Timestamp":"2022-12-19T21:41:33.2337393Z","EventId":30,"LogLevel":"Error","Category":"Microsoft.Diagnostics.Tools.Monitor.CollectionRules.CollectionRuleService","Message":"Collection rule \u0027HighCpuRule\u0027 failed.","Exception":"Microsoft.Extensions.Options.OptionsValidationException: |
Beta Was this translation helpful? Give feedback.
You should probably be using ENV to add environment variables to your container image, otherwise I think they are only available at image build time. However, in general, I would not recommend setting this environment variable as part of your container image; it should be set by your deployment mechanism as an environment variable on the container.