43
Views
4
Comments
[Dynatrace RUM for Mobile] How to configure for dev/test/prod
Question
dynatrace-rum-for-mobile
Mobile icon
Forge asset by Vanguard Labs
Application Type
Mobile

We would like to have different dynatrace configurations for UAT and Prod.

Currently when configuring the plugin, the only way is to  add a file called dynatrace.config.js to the resources however when pushed into UAT and eventually Production, the same config is used across environments. 

Is there a way to specify the config file per environment?

2022-08-03 04-32-50
Ravi Punjwani

Hi Tye,

  1. Add all three files of different environments in your mobile application from service studio.
  2. Get your current ServerName by calling GetServerName (Custom Server Action to find out your Server Name)
  3. Then pass the correct path as a parameter to Dynatrace_Initialize.

Find the attached OML file for ready reference.


PS: I missed out adding the folder name in the ConfigURL variable. So use the following expression

GetOwnerURLPath() + "Dynatrace/" + GetServerName.Name + ".config.js"


DynatraceDemo.oml
2022-08-03 04-32-50
Ravi Punjwani

Hi @Tye Peck,

Were you able to use the OML sample I provided?

I wanted to suggest some more changes but let me know if the first one played well or not?

You can mark as solution if it already resolved your query.

Thanks

Ravi

UserImage.jpg
Tye Peck

Hi @Ravi Punjwani 

Unfortunately we had attempted the dynamic configuration and when generating a native build we noticed the build kept failing due to the expectation of a file called dyantrace.config.js.

We have this configuration file but rename it according to the environments and dynamically load it as you suggested above i.e. dyantrace.dev.config.js, dyantrace.test.config.js etc however it seems the actual underlying plugin expects it to be called "dyantrace.config.js"

This is supported by investigating the dynatrace cordova package https://www.npmjs.com/package/@dynatrace/cordova-plugin 

There does seem to be a way to specify a different dynatrace.config.js path (here) however as we don't have access to the underlying build system to pass any arguments, this does not seem possible. 

Keen on hearing your thoughts on this, we are happy to use the one app for dev/test/prod however we will need a way of at least filtering out any telemetry from dev/test to not skew any reports. 

UserImage.jpg
Jonathan Lui

As a quick and dirty way, so we don't need to make changes to the original plugin source, we did the following:

  1. Clone the repository to our own github account
  2. find the file scripts/Outsystems/copyConfig.js and change the configPath 
    var configPath = path.join(wwwPath, "dynatraceConfig-nonprod"); 
  3. commit the change to your own repository
  4. In your app, add another dynatrace.config.js to resources, but set the Target Directory to the configPath that you used
  5. in LifeTime > Application Settings for Dynatrace RUM for Mobile, copy-paste the extensibility configuration into the custom configuration, and change the URL to point to your own github repo. Set the custom configuration for your non-prod envs. Leave it default for prod.



  

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.