2 Replies Latest reply on May 2, 2016 3:40 AM by mchancevet@gmail.com

    Nested Scripts (subscripts) and context dependent script parameters

    mchancevet@gmail.com

      Hello,

      I'm planning for a system to monitor performance in my scripts and business processes. This follows from another discussion

       

      Hosted file metadata, and performance monitoring - script or relationships?

       

      A new question on this issue.

       

      In the interests of modularity, I am thinking of developing a single script that captures data and creates Performance Log records for all scripts or other monitored processes.

      I Imagine creating this script and then nesting all monitored scripts within it as subscripts. Lets call this the 'shell script' as it encapsulates the functional scripts. 

      I am thinking this way because the first thing I need for monitoring is a start time  (Beginning) and then I need to capture the end time (finish) for any given process to see how long it takes. SO my functional scripts need to sit within a start and end of a monitoring script/s . At least that's what I think.

       

      The Problem

       

      I'm also concerned with modularity in all other domains of scripting.

      So the functional parts (non monitoring) of any process are going to need context parameters. So far that's no worries using script parameters set up as list values passing field names etc.

      But - my monitoring function is also contextual - (by record, script name, table, (maybe layout)).

       

      So I'm going to need to pass parameters to the shell script to determine it's own context. But also information like

      • The functional script name (subscript)
      • The record id
      • reference fields for values
      • other data

      As an example - one functional script I use calls a plugin and the script parameter I need to make this work dynamically (modularity) requires a list with 9 values.

       

      Questions

       

      Am I thinking about this the wrong way?

      Should I just have my functional scripts each call 2 subscripts - one to get start values and one to get end values and build more parameter 'list' values to pass monitoring context to the two subscripts?

       

      Welcome thoughts on this,

       

      Morgan

        • 1. Re: Nested Scripts (subscripts) and context dependent script parameters
          Mike_Mitchell

          mchancevet@gmail.com wrote:

           

          In the interests of modularity, I am thinking of developing a single script that captures data and creates Performance Log records for all scripts or other monitored processes.

          I Imagine creating this script and then nesting all monitored scripts within it as subscripts. Lets call this the 'shell script' as it encapsulates the functional scripts.

          I am thinking this way because the first thing I need for monitoring is a start time (Beginning) and then I need to capture the end time (finish) for any given process to see how long it takes. SO my functional scripts need to sit within a start and end of a monitoring script/s . At least that's what I think.

           

           

           

          Not necessarily. In fact, this is pretty poor from the standpoint of modularity. One of the principles of modularity is that each function / method / procedure should be independent. The calling process should pass to that chunk of code everything it needs, and it should return the result.

           

          Another problem with this approach is it makes it difficult to capture performance within just a portion of the script.

           

          Should I just have my functional scripts each call 2 subscripts - one to get start values and one to get end values and build more parameter 'list' values to pass monitoring context to the two subscripts?

           

          Yes, this is a much better approach. Another (probably better) option would be to capture start and end times in variables and then pass them to the logging script as parameters. That way, you need only to create and save the log record (instead of needing to keep track of which record in the log needs to receive the end time).

          • 2. Re: Nested Scripts (subscripts) and context dependent script parameters
            mchancevet@gmail.com

            Thanks Mike,

            I like the 3rd idea - variables - with this approach I can just make 1 logging script and pass it the variables and any other context data I need.

             

            Morgan