Variables can be set in any of the following places within the Gateway Setup Editor:
- Advanced tab of Managed Entity Groups
- Advanced tab of Managed Entities
- Advanced tab of Types
- Environment
- Operating Environment
This can get tricky when the same variable name is defined in multiple places and holds different values. To help figure out which value the variable is resolved to, we rely on the following Variable Scoping Rules:
- When a sampler or sampler include is referenced by a Type, we look for the variable in the following order:
-
- The environment specified when the type was added to that managed entity or managed entity group
- Variables defined directly in the type
- The environment referenced by the type
- When a Type is not used and the sampler or sampler include is referenced in the Managed Entity or Entity group, we look for the variable in the following order:
-
- Variables defined in (or inherited by) the managed entity
- The environment referenced by the managed entity
- The operating environment
Examples and scenarios
To help better understand variable scoping rules, we will be using the below toolkit dataview that will echo out the following table. Notice the "Variable value" column is currently blank for the variable name "variableReso."
The following rule will be used to set the resolved variable value for "variableReso."
The below scenarios have the "variableReso" defined in multiple places throughout the setup. Using variable scoping rules will help determine which value the variable resolves to.
The configuration files for these examples can be found in the bottom of the page.
Scenario 01
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > addTypes > type > environment
- managedEntities > managedEntity > environment
- managedEntities > managedEntity > var > name
- types > type > environment
- types > type > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #1 (managedEntities > managedEntity > addTypes > type > environment):
Scenario 02
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > environment
- managedEntities > managedEntity > var > name
- types > type > environment
- types > type > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #4 (types > type > var > name):
Scenario 03
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > environment
- managedEntities > managedEntity > var > name
- types > type > environment
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #3 (types > type > environment):
Scenario 04
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > environment
- managedEntities > managedEntity > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #2 (managedEntities > managedEntity > var > name):
Scenario 05
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > environment
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #1 (managedEntities > managedEntity > environment):
Scenario 06
- The Sampler is defined on a Type.
- The variable variableReso is defined on the following:
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #1 (operatingEnvironment > var):
Scenario 07
- The Sampler is defined on a Managed Entity.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > addTypes > type > environment
- managedEntities > managedEntity > environment
- managedEntities > managedEntity > var > name
- types > type > environment
- types > type > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #3 (managedEntities > managedEntity > var > name):
Scenario 08
- The Sampler is defined on a Managed Entity.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > addTypes > type > environment
- managedEntities > managedEntity > environment
- types > type > environment
- types > type > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #2 (managedEntities > managedEntity > environment):
Scenario 09
- The Sampler is defined on a Managed Entity.
- The variable variableReso is defined on the following:
- managedEntities > managedEntity > addTypes > type > environment
- types > type > environment
- types > type > var > name
- operatingEnvironment > var
- The variable variableReso is defined on the following:
- Result: The variable used is #4 (operatingEnvironment > var):
Related Articles
Variable Scoping and Resolution
If you have further questions:
- Please contact our Client Services team via the chat service box available in any of our websites or email us at support@itrsgroup.com
- Make sure you provide to us:
- Dataview Screenshot
- Screenshot of "Show Rules" output
- Gateway Diagnostics file
Comments
0 comments
Please sign in to leave a comment.