cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.NET Core (Linux) and JavaScript agent injection

gmichels
Contributor

Hello everyone,


I have a .NET Core application running in a Linux container in a Kubernetes cluster. I've got the Dynatrace Operator deployed and instrumentation for the application using OneAgent works just fine. My problem is the JavaScript agent is not being loaded, and I would like to understand the reason.


The documentation in https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/basic-concepts/rum-... states:


OneAgent JavaScript tag injection is performed automatically during installation for Java, Apache HTTP Server, IIS, NGINX, and Node.js.

Since the .NET Core application is in a Linux container, it's using Kestrel as the webserver, so I am unsure if that's the reason it's not being automatically injected.


Can anyone confirm if auto-injection for the JavaScript agent is supposed to work on .NET Core in Linux?


Thank you


8 REPLIES 8

You didn't have any webserver that works as reverse proxy that is in front of kestrel? To be honest I've never tested auto injection in kestrel itself, I've always had nginx or IIS before 🙂 But it may be as you've said that auto-injection (at least for now) will not work here.

Sebastian


In this case the traffic flows through 2 reverse proxies (first an F5 and then nginx as the ingress controller for Kubernetes), but they are external to the container. Nothing other than Kestrel in the application container for the agent to hook into.


Install OneAgent on Nginx, it should work without any problem, trust me 🙂


Unfortunately auto-instrumentation for the nginx container doesn't work, I get this in the progress group screen in Dynatrace:


Activation of deep monitoring was unsuccessful
Monitoring of statically linked Go programs that do not load libc is not supported

Any other ideas?


Thanks




I noticed I had selected the wrong process group for the previous reply regarding nginx, and now I got the correct one which shows up as being instrumented in the Dynatrace UI (nginx ingress controller pod needed a bounce), however I still see no auto-injection happening for the .NET Core application.

So unfortunately it didn't work even with OneAgent on nginx 😞


If you are sure that you are connecting to .net core web application via nginx it has to work. This is because Ngon is serving HTML content generated by .net core. Agent than should detect multiple domains (if it’s reverse proxy for more than one application) and RUM should work.

It can be different issue, did you try to go to default application? If you don’t have rum configured at all you should see there information about potential reasons why RUM wasn’t injected.

Sebastian


Unfortunately it still not working, I don't see any requests in the browser's developer tools for the javascript agent.


I am sure both nginx (in blue) and the .net core application (in red) are being instrumented, see purepath and service backtrace from the .net core application:




My application detection setup is correct, there is a rule pointing to the FQDN being used by the nginx service (the blue part below matches the blue part above):


Thank you


gmichels
Contributor

To close the loop here, my problem was compression was enabled between nginx and kestrel, and auto-injection will not work when there is compression.


I was able to fix it by disabling compression via this ingress annotation:


    nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Accept-Encoding identity;


Injection worked just fine after the ingress was updated.


Thanks