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

Local development setup

Dominik_Jenik
Visitor

Hi

I have tried some simple examples:

 

if (dtrum) {
    const actionId = dtrum.enterAction('some_action_name');
    dtrum.leaveAction(actionId);
}

 

and adding

                <script
                    type="text/javascript"
                    src="https://{environmentid}.live.dynatrace.com/" target=_blank>https://{environmentid}.live.dynatrace.com/

But I see that request goes to localhost, where I would expect it will go to https://{environmentid}.live.dynatrace.com/ 

Dominik_Jenik_2-1678803844370.png

Is that possible or do I have to run some instance of Dynatrace locally?

11 REPLIES 11

radek_jasinski
DynaMight Guru
DynaMight Guru

Dominik,

Can you write more details what you want to do?
Do you want to use JavaScript API for monitoring your WWW ?

Radek

Have a nice day!

yes, I want to use JavaScript API. (its Next JS Typescript APP but I think that does not matter much)

I want to test it running localhost and afterward deploy to cloud.

Of course, you can redirect your local machine to DT in SaaS.
Did you put a script with the address to Dynatrace in the header?

In general, I have not encountered a situation where traffic is redirected to localhost:9000. I suspect a placement error in the script or perhaps a mechanism on the WWW that substitutes this (I have encountered such a situation with F5).

Please read the examples you can find here:

  1. In the Dynatrace menu, go to Settings > Web and mobile monitoring > Advanced setup.
  2. Under JavaScript tag API, select Download documentation and samples.

https://www.dynatrace.com/support/help/shortlink/api-rum#documentation

Have a nice day!

Thanks for reply.

Dominik_Jenik_0-1678880577826.png

It is there in the header and its loaded OK

Dominik_Jenik_1-1678880605258.png

But the outgoing communication is going to localhost.

I think I am not doing anything special in the usage of dtrum.

 

Now, I have tried one of the examples dynatraceapi-1.255.1.20221104-040649.zip

Dominik_Jenik_2-1678899370765.png

 

But here I get little bit different behaviour:

Dominik_Jenik_3-1678899404044.png

Access to XMLHttpRequest at 'file:///C:/rb_bf33897nam?type=js3&flavor......m172lcx&end=1' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.

 

 

Do you think it can have something with one of the following configurations:

Dominik_Jenik_0-1678899684759.pngDominik_Jenik_1-1678899703319.png

etc.

Dominik_Jenik_2-1678899745567.png

 

It looks like our Next JS app is routing it to its default route:

Dominik_Jenik_0-1678901594510.png

Dominik_Jenik_1-1678901628730.png

(and Yes it is properly loaded)

Dominik_Jenik_2-1678901699404.png

 

Using example from dynatraceapi-1.255.1.20221104-040649.zip adding it to Header of that testing example file

Dominik_Jenik_0-1678904347927.png

 I am getting this error:

Dominik_Jenik_1-1678904461238.png

From what I see that your script is always using the domain where it is run from (in this case filesystem c:/).

 

It seems to me that you are injecting the script incorrectly. Because the URL tenant is not generated correctly.  

You can generate a JS script for agentless rum and compare syntaxes.

See the screen I presented below:

Screenshot 2023-03-15 at 19.40.37.png

<script type="text/javascript" src="https://js-cdn.dynatrace.com/jstag/{id}/ruxitagent_ICA2NVfqru_{id}.js" data-dtconfig="app={id}|cors=1|featureHash=ICA2NVfqru|vcv=2|reportUrl=https://{id}.bf.dynatrace.com/bf|rdnt=1|uxrgce=1|bp=3|cuc={id}|mel=100000|dpvc=1|ssv=4|lastModification={id}|dtVersion=10259230221142207|tp=500,50,0,1|agentUri=https://js-cdn.dynatrace.com/jstag/{id}/ruxitagent_ICA2NVfqru_{id}.js" crossorigin="anonymous"></script>

Have a nice day!

I have tried also your way, to use "OneAgent Javascript Tag"

Dominik_Jenik_3-1680600216067.png

 

Dominik_Jenik_0-1680600003407.pngDominik_Jenik_1-1680600027619.png

But that lead still to localhost with the same error 404.

And not just that but it does not import the dtrum (which "Javascript tag" does)

Dominik_Jenik_2-1680600120118.png

 

Radoslaw_Szulgo
Inactive

I guess you've tried this one? 

https://www.dynatrace.com/support/help/extend-dynatrace/openkit/instrument-your-application-using-dy...

 

Senior Product Manager,
Dynatrace Managed expert

Where can I find my endpointURL, applicationID, clientIP and what about credentials for authentification/authorization?

Use the downloaded library and the Beacon URL and Application ID provided in the instrumentation wizard to instrument your application.

 

ClientIP is your IP. Put anything that you want to be identified.

Senior Product Manager,
Dynatrace Managed expert

Featured Posts