当前位置: 首页 > news >正文

做钢材的都用什么网站优网营销

做钢材的都用什么网站,优网营销,上海网站制作公司报价,资阳网页设计怎么做版式文章目录 monitor/watch/trace 相关monitormonitor例子monitor -c <value>monitor -m <vaule>monitor 条件表达式monitor -b monitor文档(界面描述)monitor文档(help) stack - 输出当前方法被调用的调用路径trace - 方法内部调用路径&#xff0c;并输出方法路径上的…

文章目录

    • monitor/watch/trace 相关
      • monitor
        • monitor例子
          • monitor -c <value>
          • monitor -m <vaule>
          • monitor 条件表达式
          • monitor -b
        • monitor文档(界面描述)
        • monitor文档(help)
      • stack - 输出当前方法被调用的调用路径
      • trace - 方法内部调用路径,并输出方法路径上的每个节点上耗时
      • tt - 方法执行数据的时空隧道,记录下指定方法每次调用的入参和返回信息,并能对这些不同的时间下调用进行观测
        • tt使用
          • tt 删除
        • tt文档(命令行)
      • watch - 方法执行数据观测
        • watch例子
          • watch target例子
        • watch例子2
        • watch文档(界面)
        • watch文档(命令行)

这是第二章,第一章见博客。

monitor/watch/trace 相关

monitor

monitor是方法监控工具,例如一定时间的次数,成功率,失败率,响应时间等。
还可以根据条件进行过滤。

monitor例子

不加任何参数:
monitor org.apache.commons.lang.StringUtils isBlank

monitor -c

monitor -c 5 org.apache.commons.lang.StringUtils isBlank
-c --cycle 表示统计周期,默认60s。设置为-c 5我们发现命令行每5s打印一次,如果设置为-c 10,每10s打印一次。

monitor -m

monitor -m 1 -c 5 org.apache.commons.lang3.StringUtils isBlank
-m, --maxMatch 表示匹配类的最大限制数,感觉是为了避免相同类内容太多,加上这个参数如果实际类数量>-m的值,会报错。

例如:

[arthas@23052]$ monitor -m 1 -c 5 org.apache.commons.lang3.StringUtils 
isBlank
输出:
Affect(class count: 0 , method count: 0) cost in 9 ms, listenerId: 14
The number of matched classes is 2, greater than the limit value 1. Try to change the limit with option '-m <arg>'.
monitor 条件表达式

monitor -c 5 com.example.controller.api.InvoiceApiContorller invoiceQueryFast “params[0] >1”
“params[0] >1” 在方法执行完之后,根据条件表达式进行过滤。
这里有个疑问啊?
如果是spring的@RequestBody报文,怎么写表达式呢?这个表达式是否只能做一些简单的计算。

monitor -b

monitor -c 5 -b com.example.controller.api.InvoiceApiContorller invoiceQueryFast “params[0] >1”
-b 表示在方法执行完之前,根据条件表达式进行过滤。

monitor文档(界面描述)

参数说明
方法拥有一个命名参数 [c:],意思是统计周期(cycle of output),拥有一个整型的参数值

参数名称 参数说明
class-pattern 类名表达式匹配
method-pattern 方法名表达式匹配
condition-express 条件表达式
[E] 开启正则表达式匹配,默认为通配符匹配
[c:] 统计周期,默认值为 120 秒
[b] 在方法调用之前计算 condition-express
[m ] 指定 Class 最大匹配数量,默认值为 50。长格式为[maxMatch ]。

monitor文档(help)

输入 help monitor,返回的内容就是文档:

help monitor
USAGE:monitor [-b] [-c <value>] [--exclude-class-pattern <value>] [-h] [-n <value>] [--listenerId <value>] [-m <value>] [
-E] [-v] class-pattern method-pattern [condition-express]SUMMARY:Monitor method execution statistics, e.g. total/success/failure count, average rt, fail rate, etc.Examples:monitor org.apache.commons.lang.StringUtils isBlankmonitor org.apache.commons.lang.StringUtils isBlank -c 5monitor org.apache.commons.lang.StringUtils isBlank params[0]!=nullmonitor -b org.apache.commons.lang.StringUtils isBlank params[0]!=nullmonitor -E org\.apache\.commons\.lang\.StringUtils isBlankWIKI:https://arthas.aliyun.com/doc/monitorOPTIONS:
-b, --before                            Evaluate the condition-express before method invoke
-c, --cycle <value>                     The monitor interval (in seconds), 60 seconds by default--exclude-class-pattern <value>     exclude class name pattern, use either '.' or '/' as separator
-h, --help                              this help
-n, --limits <value>                    Threshold of execution times--listenerId <value>                The special listenerId
-m, --maxMatch <value>                  The maximum of matched class.
-E, --regex                             Enable regular expression to match (wildcard matching by default)
-v, --verbose                           Enables print verbose information, default value false.
<class-pattern>                         Path and classname of Pattern Matching
<method-pattern>                        Method of Pattern Matching
<condition-express>                     Conditional expression in ognl style, for example:TRUE  : 1==1TRUE  : trueFALSE : falseTRUE  : 'params.length>=0'FALSE : 1==2'#cost>100'

stack - 输出当前方法被调用的调用路径

trace - 方法内部调用路径,并输出方法路径上的每个节点上耗时

tt - 方法执行数据的时空隧道,记录下指定方法每次调用的入参和返回信息,并能对这些不同的时间下调用进行观测

tt命令是最有用的命令之一。
如何理解tt呢,相当于将请求快照保存了一份,可以随时调阅。

tt使用

tt -t com.example.controller.RedisController keys
-t, --time-tunnel 时空隧道(相当于快照),这个参数必传

tt -t -n -m com.example.controller.RedisController keys
-n --limits 限制记录条数,如果请求足够多,瞬间可能撑爆内存。
-m --maxMatch 限制匹配类的数量,例如String类,那么匹配的类太多。

-t
tt 命令有很多个主参数,-t 就是其中之一。这个参数的表明希望记录下类 *Test 的 print 方法的每次执行情况。

-n 3
当你执行一个调用量不高的方法时可能你还能有足够的时间用 CTRL+C 中断 tt 命令记录的过程,但如果遇到调用量非常大的方法,瞬间就能将你的 JVM 内存撑爆。

此时你可以通过 -n 参数指定你需要记录的次数,当达到记录次数时 Arthas 会主动中断 tt 命令的记录过程,避免人工操作无法停止的情况。

-m 1
通过 -m 参数指定 Class 匹配的最大数量,防止匹配到的 Class 数量太多导致 JVM 挂起,默认值是 50。

tt 删除

删除单条:

tt -d -i 1001 # 注:删除时-i必填,否则报错(因为不指定索引谁知道该删除哪条呢?)-i, --index <value>
tt -d 1001 # 错误的命令

报错:
Error during processing the command:
java.lang.IllegalArgumentException, message:Time fragment index is expected,
please type -i to specify
, please check $HOME/logs/arthas/arthas.log for more details.

这句说的很明显了,需要指定索引。 至于最后一句是通用的语句,让看日志呢。

删除全部:
tt --delete-all # 这个没报错,全都删除了

tt文档(命令行)
[arthas@22560]$ help ttUSAGE:tt [-d] [--delete-all] [--exclude-class-pattern <value>] [-x <value>] [-h] [-i <value>] [-n <value>] [-l] [--listenerId <value>][-m <value>] [-p] [-E] [--replay-interval <value>] [--replay-times <value>] [-s <value>] [-M <value>] [-t] [-v] [-w <value>] [class-pattern] [method-pattern] [condition-express]SUMMARY:Time TunnelThe express may be one of the following expression (evaluated dynamically):target : the objectclazz : the object's classmethod : the constructor or methodparams : the parameters array of methodparams[0..n] : the element of parameters arrayreturnObj : the returned object of methodthrowExp : the throw exception of methodisReturn : the method ended by returnisThrow : the method ended by throwing exception#cost : the execution time in ms of method invocationEXAMPLES:tt -t *StringUtils isEmptytt -t *StringUtils isEmpty params[0].length==1tt -ltt -i 1000tt -i 1000 -w params[0]tt -i 1000 -ptt -i 1000 -p --replay-times 3 --replay-interval 3000tt -s '{params[0] > 1}' -w '{params}'tt --delete-allWIKI:https://arthas.aliyun.com/doc/ttOPTIONS:-d, --delete                                Delete time fragment specified by index--delete-all                            Delete all the time fragments--exclude-class-pattern <value>         exclude class name pattern, use either '.' or '/' as separator-x, --expand <value>                        Expand level of object (1 by default)-h, --help                                  this help-i, --index <value>                         Display the detailed information from specified time fragment-n, --limits <value>                        Threshold of execution times, default value 100-l, --list                                  List all the time fragments--listenerId <value>                    The special listenerId-m, --maxMatch <value>                      The maximum of matched class.-p, --play                                  Replay the time fragment specified by index-E, --regex                                 Enable regular expression to match (wildcard matching by default)--replay-interval <value>               replay interval  for  play tt with option r greater than 1--replay-times <value>                  execution times when play tt-s, --search-express <value>                Search-expression, to search the time fragments by ognl express.The structure of 'advice' like conditional expression-M, --sizeLimit <value>                     Upper size limit in bytes for the result (10 * 1024 * 1024 by default)-t, --time-tunnel                           Record the method invocation within time fragments-v, --verbose                               Enables print verbose information, default value false.-w, --watch-express <value>                 watch the time fragment by ognl express.Examples:paramsparams[0]'params[0]+params[1]''{params[0], target, returnObj}'returnObjthrowExptargetclazzmethod<class-pattern>                             Path and classname of Pattern Matching<method-pattern>                            Method of Pattern Matching<condition-express>                         Conditional expression in ognl style, for example:TRUE  : 1==1TRUE  : trueFALSE : falseTRUE  : 'params.length>=0'FALSE : 1==2'#cost>100'

watch - 方法执行数据观测

watch主要用于监控查看方法的参数等。
测试需要这么测。
1、先执行命令监控。
2、再调用该方法,上面的监控就会打印指定的输出。

怎么感觉这个功能日志就可以做到呢?

watch例子

监控所有参数:

watch com.example.controller.RedisController keys "params"
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 85 ms, listenerId: 8当方法到达后,输出内容:
method=com.example.controller.RedisController.keys location=AtExit
ts=2024-06-27 14:28:39; [cost=34.9303ms] result=@Object[][@RedisMapRequest[RedisMapRequest(key=set1, sonKey=null, sonValue=null, map=null)],
]

监控第一个参数:

watch com.example.controller.RedisController keys "params[0]"  # 第一个参数

监控参数的size:
watch com.taobao.container.Test test "params[0].size()"

那么问题来了,如何监控返回结果?
这3个分别表示入参,目标,返回结果。

{params, target, returnObj}

3个参数一起写,只会输出第三个参数,所以就写一个吧:
watch com.example.controller.RedisController keys "params, target, returnObj" # 3个都写

watch com.example.controller.RedisController keys "returnObj" # 只写一个

watch target例子

watch com.example.controller.RedisController keys "target" # target

[arthas@22560]$ watch com.example.controller.RedisController keys "target"
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 88 ms, listenerId: 15返回结果:
method=com.example.controller.RedisController.keys location=AtExit
ts=2024-06-27 15:04:31; [cost=25.5637ms] result=@RedisController[age=@Integer[2],logger=@Logger[Logger[com.example.controller.RedisController]],redisTemplate=@RedisTemplate[org.springframework.data.redis.core.RedisTemplate@5b4f914],
]

target会返回方法及所属磊信息。

watch例子2
watch文档(界面)

watch 的参数比较多,主要是因为它能在 4 个不同的场景观察对象。

参数名称参数说明
class-pattern类名表达式匹配
method-pattern函数名表达式匹配
express观察表达式,默认值:{params, target, returnObj}
condition-express条件表达式
[b]函数调用之前观察
[e]函数异常之后观察
[s]函数返回之后观察
[f]函数结束之后(正常返回和异常返回)观察
[E]开启正则表达式匹配,默认为通配符匹配
[x:]指定输出结果的属性遍历深度,默认为 1,最大值是 4
[m <arg>]指定 Class 最大匹配数量,默认值为 50。长格式为[maxMatch <arg>]

这里重点要说明的是观察表达式,观察表达式的构成主要由 ognl 表达式组成,所以你可以这样写"{params,returnObj}",只要是一个合法的 ognl 表达式,都能被正常支持。

观察的维度也比较多,主要体现在参数 advice 的数据结构上。Advice 参数最主要是封装了通知节点的所有信息。请参考表达式核心变量中关于该节点的描述。

特殊用法请参考:https://github.com/alibaba/arthas/issues/71
OGNL 表达式官网:https://commons.apache.org/proper/commons-ognl/language-guide.html

watch文档(命令行)

help watch。

[arthas@22560]$ help watchUSAGE:watch [-b] [-e] [--exclude-class-pattern <value>] [-x <value>] [-f] [-h] [-n <value>] [--listenerId <value>] [-m <value>] [-E] [-M <value>] [-s] [-v] class-pattern method-pattern [express] [condition-express]SUMMARY:Display the input/output parameter, return object, and thrown exception of specified method invocationThe express may be one of the following expression (evaluated dynamically):target : the objectclazz : the object's classmethod : the constructor or methodparams : the parameters array of methodparams[0..n] : the element of parameters arrayreturnObj : the returned object of methodthrowExp : the throw exception of methodisReturn : the method ended by returnisThrow : the method ended by throwing exception#cost : the execution time in ms of method invocationExamples:watch org.apache.commons.lang.StringUtils isBlankwatch org.apache.commons.lang.StringUtils isBlank '{params, target, returnObj, throwExp}' -x 2watch *StringUtils isBlank params[0] params[0].length==1watch *StringUtils isBlank params '#cost>100'watch -f *StringUtils isBlank paramswatch *StringUtils isBlank params[0]watch -E -b org\.apache\.commons\.lang\.StringUtils isBlank params[0]watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilterwatch OuterClass$InnerClassWIKI:https://arthas.aliyun.com/doc/watchOPTIONS:-b, --before                                Watch before invocation-e, --exception                             Watch after throw exception--exclude-class-pattern <value>         exclude class name pattern, use either '.' or '/' as separator-x, --expand <value>                        Expand level of object (1 by default), the max value is 4-f, --finish                                Watch after invocation, enable by default-h, --help                                  this help-n, --limits <value>                        Threshold of execution times--listenerId <value>                    The special listenerId-m, --maxMatch <value>                      The maximum of matched class.-E, --regex                                 Enable regular expression to match (wildcard matching by default)-M, --sizeLimit <value>                     Upper size limit in bytes for the result (10 * 1024 * 1024 by default)-s, --success                               Watch after successful invocation-v, --verbose                               Enables print verbose information, default value false.<class-pattern>                             The full qualified class name you want to watch<method-pattern>                            The method name you want to watch<express>                                   The content you want to watch, written by ognl. Default value is '{params, target, returnObj}'Examples:paramsparams[0]'params[0]+params[1]''{params[0], target, returnObj}'returnObjthrowExptargetclazzmethod<condition-express>                         Conditional expression in ognl style, for example:TRUE  : 1==1TRUE  : trueFALSE : falseTRUE  : 'params.length>=0'FALSE : 1==2'#cost>100'
http://www.dinnco.com/news/7718.html

相关文章:

  • 神华集团两学一做登陆网站百度推广开户代理商
  • 什么专业是做网站深圳网站建设推广
  • 郑州注册网站东莞seo代理
  • 做英文小工具网站赚钱惠州seo代理商
  • 网站的开发方法公司的seo是什么意思
  • 站长网站查询关键词查找网站
  • 哈尔滨专门做网站营销推广方案设计
  • 哪些网站做推广比较有效果海外免费网站推广有哪些
  • 武汉最好的网站建设公司排名nba
  • 做网站空seo网站优化推广教程
  • 东营可以做网站的公司在哪竞价sem托管
  • 盐城网站设计网站优化推广怎么做
  • j2ee网站开发买什么书网站的开发流程
  • wordpress 菜单标题属性seo数据
  • 网站做联盟收入企业课程培训
  • 网站建设实训报告样板东莞网站推广公司黄页
  • 衡阳网站建设步骤百度竞价广告点击器
  • 东莞常平网站建设网络营销方式有哪些?
  • 河北共产党员网站两学一做seo实战培训学校
  • 电脑制作网站总么做如何免费推广自己的网站
  • 深圳直销制度网站制作产品网络营销策划
  • 嘉兴的信息公司网站广告投放网站平台
  • 学校网站系统流量平台
  • 有什么网站可以做充值任务免费seo软件
  • 国务院关于政府网站建设文件百度百科怎么创建自己
  • 北京网站建设企业体验营销策划方案
  • 建立手机个人网站推广赚钱平台有哪些
  • 跨境电商到什么网站做推荐几个靠谱的网站
  • 汽车网站建设中国网站排名100
  • asp与java做网站效果百度快照优化