• Build a endtoend log to record system performance.


    1. Web Trigger point .(the time point when user  click button)

      1>If the click is ajax post back

     Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
            function BeginRequestHandler(sender, args)
            {
                  pageCover.startProcessing('');
                  var elem = args.get_postBackElement();
                   //set begin time point and button id
            }

       2>If click is normal postback

           $(window).bind('beforeunload', handleOnbeforeunload);

    2.IIS Request point (the time point when begin to execute in IIS)

            protected override void OnInit(EventArgs e)
            {
               preInitTime = DateTime.Now;//set the iis request time
               base.OnInit(e);
            }

    3.IIS Response point (the time point when the business logic have finished)

            1>If it's ajax postback protected override object SaveViewState()
            {
              object obj = base.SaveViewState();
              //here add cookie for ajax postback 
              ActionLogHelper.SetCookieInResponse(preInitTime);//here set the time point
              return obj;
           }

           2>If it's normal postback

              protected override void Render(HtmlTextWriter writer)
             {
               base.Render(writer);
               //here for postback
               ActionLogHelper.SetCookieInResponse(preInitTime);
              }

    4.Page begin to Render (Begin to render page.)

           1>If it's normal postback   add a javascript at the bottom of page

               <script type="text/javascript" language="javascript">
                var getRep=new Date();
              </script>

           2>If it's a ajax postback

                Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler)
                function pageLoadingHandler(sender, args)
               {
                   getRep=new Date();
               }

    5.Finish page render.

        1>If it's ajax postback

          Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            function EndRequestHandler(sender, args)
            {

              SendLogAndClear();

            }           

       2>If it's normal postback

            <script type="text/javascript" language="javascript">
             //rem the time get response
             $(window).bind('load', function() {SendLogAndClear();});
            </script>

    6.After the above five step call method to save the data .

     $.post($I('ctl00_actionLogUrl').value+'?  userId='+userId+'&ipAddress='+ipAddress+'&accessWebPage='+accessWebPage+'&lastWebPage='+lastWebPage+'&requestType='+requestType+'&eventSource='+eventSource+'&webTriggerPoint='+webTriggerPoint+'&webGetRepPoint='+webGetRepPoint+'&webLoadedPoint='+webLoadedPoint+'&iisRecReqPoint='+iisRecReqPoint+'&iisResponsePoint='+iisResponsePoint+'&reqSize='+reqSize+'&respSize='+respSize);

     

    Remark:

    We can get these five time point after ia transaction, And

    D2-D1: url request time

    D3-D2: business logic execute time.

    D5-D4: Page render ui time.

     

  • 相关阅读:
    python 导出 mongodb 两张表数据并合并
    堡垒机安装pytorch,mmcv,mmclassification,并训练自己的数据集
    大咖授课+项目实战+工作offer,2022数据智能夏令营火热招募!
    个推CTO谈数据智能与元宇宙:从概念、成因到核心技术
    个推TechDay直播预告 | 6月22日,开启大数据降本提效的破局之道!
    windows10 CUDA11.4+CUDnn+torch+tensorflow环境配置
    linux服务器(centos 7.8)配置深度学习环境
    CentOS 基本命令
    MySQL8.0的my.ini文件位置 windos下
    md5,获取字符串MD5
  • 原文地址:https://www.cnblogs.com/Excellentchen/p/1644130.html
Copyright © 2020-2023  润新知