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

This product reached the end of support date on March 31, 2021.

Manual Injection Issue

jose_iglesias
Dynatrace Organizer
Dynatrace Organizer

Hi.

I'm having an issue trying to inject the JS agent manually. Following the manual (DT 6.2), there's a point in the System Profile / User Experience that allows to configure and download the JS agent. The isse is that the only thing that is here is a copy to clipboard button with the reference to the JS, but not a place to download the agent. How could I download the agent and the tag?

9 REPLIES 9

florent_duchate
Dynatrace Pro
Dynatrace Pro

Hi

yes the documentation is indeed wrong.

The easiest way is to open a web browser and go to the link as seen in your screenshot. It should let you download and save the file. The link should look something like this:

http://yourIntrusmentedServer/lib/dynatrace/dt_bo...

jose_iglesias
Dynatrace Organizer
Dynatrace Organizer

Yes, it should work. The issue is that although the JS could be sent, I've to specify what kind of JS frameworks (for instance in my case I've to use Angular)... I mean... the JS, should have more or less this aspect:

<script type="text/javascript" src="/dtagent621_bijnpr23_1027.js" data-dtconfig="rid=RID_2418|rpid=-1401634508|tp=500,50,0|bandwidth=300|reportUrl=http://banco-popular-espanol.dynatracesaas.com/dyn...">

The question is, where I get this tag?

All the best

JMI

florent_duchate
Dynatrace Pro
Dynatrace Pro

Hi

My earlier example was for the new bootstrap agent URL. If you want to use the old way, then the name is at the top of your screenshot. It is greyed out but I agree it is missing all the other parameters.

Have a look here if you want more information about the switches and the new bootstrap agent:

https://community.dynatrace.com/community/display/...

I hope this helps.

Flo

jose_iglesias
Dynatrace Organizer
Dynatrace Organizer

Hi, Flo.

My question is more to understand how it works. The bootstrap JS tag that is in Dynatrace, have only this aspect:

<script src='/lib/dynatrace/dtagent_bootstrap.js'></script>

In this tag, the dynaTraceMonitor is not included, and also I don't know how it knows what frameworks have we selected... is this tag doing it automatically? In my case, the web server for UEM is not the same than the Web Server for the application.

Thanks in advance and best regards

JMI

florent_duchate
Dynatrace Pro
Dynatrace Pro

Hi

that's what the link explains, all the information about the frameworks is taken care of by this new type of javascript agent. Hopefully it should have the information you need.

Regards

Flo

guenter_huber
Inactive

OK, guys,

Edit: Apparently there are quite some variants to do manual injection.

Out of personal interest I tried to manually inject the JS Agent last week in a lab-rat self-experiment <g> 😉 with the documentation and quite some Dynatrace experience and failed miserably <sigh>, that´s why I was planning to go over the JavaScript Agent page ASAP! (Will have a look at System Profile - User+Experience as well!)

My luck is that I got the UEM guys next door, so I kept bugging them.

I´m not an expert on that now (or in Angular in any case) but here are the three pivotal things in a nutshell for a BASIC manual instrumentation (here, before I amend the documentation) which should give you the hang.

Edit: The injection *I* was after: Instrument a TV app where I couldn´t auto-inject the Agent.

Edit <System Profile> > User Experience vertical tab > Default Application horizontal tab > Manual Injection link right top

Edit: 1 and 3 Agent source an data sink corrected

1 - Monitor Request Path: http://webServerToSendMonitoringDataTo

2 - Check Send the Dynatrace monitor request to a foreign domain!!!!

3 - Insert <script src='http://<yourInstrumentedWebServerToSendAgent>/dtagent_bootstrap.js'></script> into header

Total hurry.

Cheers

G.

Edit: @JMI: Do you have an instrumented web server that can serve the bootstrap Agent dynamically, or do you really need to inject the core Agent?

guenter_huber
Inactive


Hi guys,


there is the one or other thing I would like to mention here, because it may be not obvious (at all) and before I go about and try to improve the documentation, which will take some time to get it really right.

Edit after another round of input from Gernot, who answered below:

What actually is misleading is the UI. When you change the address in JavaScript Agent > Agent Location to non-localhost, then the Manual Injection copy / paste sample will change accordingly from

<script src='/dtagent_bootstrap.js'></script>

to

<script src='[http://<instrumentedWebServer>]/dtagent_bootstrap.js'></script>

Edit: You dynamically get the bootstrapper (WITH THE RIGHT FEATURE HASHES!) from the instrumented server. (step 3 above)

The next UI bummer is that in *debug mode* you get two buttons at Manual Injection to download the bootstrap Agent code and / or the actual core Agent (code).

Mail me (first.last@dynatrace.com) if you don´t know how to switch to debug.

Engineering says there is a use case for manual manual (manual squared
<g>) injection: Shave off some milliseconds. <g>

I´m sure I will soon follow up, because I think of something else pivotal, but I want to get this out now.

Sorry for any inconveniences, JMI!

G.

gernot_raudner
Dynatrace Helper
Dynatrace Helper

hi jose,

to explain the bootstrap mechanism:

the previous approach where you manually have to inject the whole script tag including the features, version information, configuration and so on is kind of hard to maintain, that's why we introduced the jsagent bootstrapper.

in your example, where the dt-webserver agent and your webserver are on two different locations, you'd have to provide the correct settings for the javascript agent location and the dynatrace monitor request path. these have to point to the dt-webserver agent (an instrumented webserver) that is linked to your system profile. the "copy to clipboard" example should change accordingly and you just have to add it to the head of your page.

how it works:

the bootstrapper is delivered via the dt-webserver agent (not the webserver that delivers your actual website). this agent knows about your configuration, the enabled features and the request paths, so the actual content of the bootstrapper file is changed accordingly. it looks like this:

{app:"#APP#",agentLocation:"#AGENTLOCATION#",name:"dtagent",config:"pui=1|reportUrl=dynaTraceMonitor",featureHash:"xjnt",version:"622",buildNumber:"1017",lastModification:"1442558194749"}

as soon as the bootstrapper is loaded, it dynamically creates the javascript agent script tag, including version, enabled features and configuration, as you know it.

should your configuration ever change and the bootstrapper is still in your browser's cache, the updated configuration will be sent via the next dynaTraceMonitor response and stored in your browser's localstorage. the (cached) bootstrapper (currently using the old config) will check the localStorage, acknowledge the new settings and inject an updated js agent.

regards,

gernot

guenter_huber
Inactive

OK, guys,

due to the confusion here and my own one while trying a manual instrumentation I rewrote the 6.2 JavaScript Agent page.

Further feedback would be appreciated! Thanks!

G.