指定 traceOn 監控參數。
包括指定子產品、斷點、線程号、函數以及線程類型等參數。
文法
SdbTraceOption() [.components( <component1> [,component2...] )]
[.breakPoints( <breakPoint1> [,breakPoint2...] )]
[.tids( <tid1> [,tid2...] )]
[.functionNames( <functionName1> [,functionName2...] )]
[.threadTypes( <threadType1> [,threadType2...] )]
SdbTraceOption() [.components( [ <component1>, <component2>, ... ] )]
[.breakPoints( [ <breakPoint1>, <breakPoint2>, ... ] )]
[ .tids( [ <tid1>, <tid2>, ... ] )]
[.functionNames( [ <functionName1>, <functionName2>, ... ] )]
[.threadTypes( [ <threadType1>, <threadType2>, ... ] )]
方法
components(<component>)
子產品方法
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
conponent | string / string array | 所有子產品 | 指定子產品 | 否 |
conponent 參數的可選值如下表:
可選值 | 描述 |
---|---|
auth | Authentication |
bps | BufferPool Services |
cat | Catalog Services |
cls | Cluster Services |
dps | Data Protection Services |
mig | Migration Services |
msg | Messaging Services |
net | Network Services |
oss | Operating System Services |
pd | Problem Determination |
rtn | RunTime |
sql | SQL Parser |
tools | Tools |
bar | Backup And Recovery |
client | Client |
coord | Coord Services |
dms | Data Management Services |
ixm | Index Management Services |
mon | Monitoring Services |
mth | Methods Services |
opt | Optimizer |
pmd | Process Model |
rest | RESTful Services |
spt | Scripting |
util | Utilities |
breakPoints(<breakPoint>)
斷點方法
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
breakPoint | string / string array | --- | 于函數處打斷點進行跟蹤 | 否 |
tids(<tid>)
線程方法
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
tid | int / int array | 所有線程 | 指定線程 | 否 |
functionNames(<functionName>)
函數方法
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
functionName | string / string array | --- | 指定函數名 | 否 |
threadTypes(<threadType>)
線程類型方法
參數名 | 參數類型 | 預設值 | 描述 | 是否必填 |
---|---|---|---|---|
threadType | string / string array | --- | 指定線類型 | 否 |
threadType 參數的可選值詳見線程類型
Note:
- SdbTraceOption 可同時連續指定多個方法,其中子產品方法的參數和函數方法的參數是并集關系,線程類型方法的參數和線程方法的參數也是并集關系;
- 當同時不指定 components 方法和 functionNames 方法,預設監控所有子產品,但是如果指定 functionNames 方法,不指定 components 方法,則監控指定的函數;
- 以上各個方法中的參數最多隻能指定 10 個參數。
傳回值
傳回自身,類型為 SdbTraceOption。
錯誤
常見錯誤可參考錯誤碼
示例
- 開啟監控程式
Copy> db = new Sdb( "localhost", 50000 ) > var option = new SdbTraceOption().components( "dms", "rtn" ).breakPoints( "_coordCMDEval::execute", "_dmsStorageUnit::insertRecord" ).tids( [ 15923, 35712 ] ).threadTypes( "RestListener", "LogWriter" ).functionNames( "_coordCMDEval::execute", "_dmsStorageUnit::insertRecord" ) > db.traceOn( 1000, option )
- 以上 SdbTraceOption 各個方法的參數還可以以字元串數組的形式給出
Copy> db = new Sdb( "localhost", 50000 ) > var option = new SdbTraceOption().components( [ "dms", "rtn" ] ).breakPoints( [ "_coordCMDEval::execute", "_dmsStorageUnit::insertRecord" ] ).tids( [ 15923, 35712 ] ).threadTypes( [ "RestListener", "LogWriter" ] ).functionNames( [ "_coordCMDEval::execute", "_dmsStorageUnit::insertRecord" ] ) > db.traceOn( 1000, option )
- 對于方法中存在多個參數的情況,可以通過多次調用該方法指定參數
> db = new Sdb( "localhost", 50000 ) > var option = new SdbTraceOption().components( [ "dms", "rtn" ] ).components( [ "dps", "cls" ] ).components( "pd" ) > db.traceOn( 1000, option )
相關内容:
SdbQueryOption