artillery-performance-mcp-server
Version:
MCP server for performance testing with Artillery.io
1 lines • 6.63 kB
JavaScript
(function(_0x207c0f,_0x5cdc4d){const _0x2c4635=a7_0x45c1,_0x3f8e17=_0x207c0f();while(!![]){try{const _0x542eb9=-parseInt(_0x2c4635(0x1ec))/0x1*(parseInt(_0x2c4635(0x204))/0x2)+-parseInt(_0x2c4635(0x218))/0x3+parseInt(_0x2c4635(0x1ff))/0x4*(parseInt(_0x2c4635(0x228))/0x5)+-parseInt(_0x2c4635(0x227))/0x6*(parseInt(_0x2c4635(0x206))/0x7)+parseInt(_0x2c4635(0x208))/0x8*(parseInt(_0x2c4635(0x1fc))/0x9)+parseInt(_0x2c4635(0x1ee))/0xa+parseInt(_0x2c4635(0x229))/0xb;if(_0x542eb9===_0x5cdc4d)break;else _0x3f8e17['push'](_0x3f8e17['shift']());}catch(_0x2f51ed){_0x3f8e17['push'](_0x3f8e17['shift']());}}}(a7_0x59bc,0x45130));import{exec}from'child_process';import a7_0x3c6d14 from'util';function a7_0x45c1(_0x3f388d,_0x815e4e){const _0x59bc3d=a7_0x59bc();return a7_0x45c1=function(_0x45c126,_0x309f29){_0x45c126=_0x45c126-0x1e7;let _0x508846=_0x59bc3d[_0x45c126];return _0x508846;},a7_0x45c1(_0x3f388d,_0x815e4e);}function a7_0x59bc(){const _0x33c24a=['vusers.failed','map','partial_failure','\x20failed','aggregate','1530954uAAGTX','15bMyXWa','1061896DZtJjW','push','\x20\x20-\x20','toISOString','completed','fs/promises','3bggjmc','\x20-o\x20','2134110CJMjOD','Error\x20running\x20Artillery\x20test:\x20','\x20seconds','error','toFixed','parse','No\x20errors\x20detected.','Invalid\x20Artillery\x20results:\x20missing\x20aggregate\x20data','Generating\x20report:\x20','string','entries','firstCounterAt','Request\x20rate:\x20','duration','9jGMdMX','message','successRate','319888qpLElA','filter','Failed\x20to\x20run\x20Artillery\x20test:\x20','counters','info','248960rKQRJF','\x20completed,\x20','7GJbwXu','Error\x20parsing\x20Artillery\x20results:\x20','3585832evUmQs','startsWith','\x20req/sec','round','requestsPerSecond','Errors:\x0a','npx\x20artillery\x20report\x20--output\x20','Virtual\x20users\x20failed:\x20','join','length','Virtual\x20users\x20created:\x20','Errors\x20detected:','keys','lastCounterAt','errors','Virtual\x20users:\x20','259695bniYlj','forEach','Virtual\x20users\x20completed:\x20','Failed\x20to\x20parse\x20Artillery\x20results:\x20','warn','errors.','npx\x20artillery\x20run\x20','Error\x20generating\x20Artillery\x20report:\x20','Test\x20duration:\x20','Command\x20stderr:\x20'];a7_0x59bc=function(){return _0x33c24a;};return a7_0x59bc();}import a7_0xa6d5d7 from'./logger.js';const execPromise=a7_0x3c6d14['promisify'](exec);export async function runArtilleryTest(_0x119ac3,_0x4da40d){const _0x51fc07=a7_0x45c1;try{let _0x8128f5=_0x51fc07(0x21e)+_0x119ac3;_0x4da40d&&(_0x8128f5+=_0x51fc07(0x1ed)+_0x4da40d);a7_0xa6d5d7[_0x51fc07(0x203)]('Executing\x20command:\x20'+_0x8128f5);const {stdout:_0x5ba858,stderr:_0x42b7c4}=await execPromise(_0x8128f5);return _0x42b7c4&&a7_0xa6d5d7[_0x51fc07(0x21c)](_0x51fc07(0x221)+_0x42b7c4),_0x5ba858;}catch(_0x313017){a7_0xa6d5d7['error'](_0x51fc07(0x1ef)+_0x313017['message']);throw new Error(_0x51fc07(0x201)+_0x313017[_0x51fc07(0x1fd)]);}}export async function generateArtilleryReport(_0x1e574a,_0x1a0e31){const _0x2b928b=a7_0x45c1;try{const _0x2e2b89=_0x2b928b(0x20e)+_0x1a0e31+'\x20'+_0x1e574a;a7_0xa6d5d7[_0x2b928b(0x203)](_0x2b928b(0x1f6)+_0x2e2b89);const {stdout:_0x36638d,stderr:_0x5932da}=await execPromise(_0x2e2b89);return _0x5932da&&a7_0xa6d5d7[_0x2b928b(0x21c)]('Report\x20generation\x20stderr:\x20'+_0x5932da),_0x36638d;}catch(_0x29ac4f){a7_0xa6d5d7[_0x2b928b(0x1f1)](_0x2b928b(0x21f)+_0x29ac4f['message']);throw new Error('Failed\x20to\x20generate\x20Artillery\x20report:\x20'+_0x29ac4f[_0x2b928b(0x1fd)]);}}export async function parseArtilleryResults(_0x498f4f){const _0x39f401=a7_0x45c1;try{if(typeof _0x498f4f===_0x39f401(0x1f7))try{_0x498f4f=JSON[_0x39f401(0x1f3)](_0x498f4f);}catch(_0x33a92f){const _0x2714f4=await import(_0x39f401(0x1eb)),_0x437a3e=await _0x2714f4['readFile'](_0x498f4f,'utf-8');_0x498f4f=JSON['parse'](_0x437a3e);}const _0x229117=_0x498f4f[_0x39f401(0x226)];if(!_0x229117)throw new Error(_0x39f401(0x1f5));const _0x488de2=_0x229117[_0x39f401(0x202)]||{},_0x7d8c3c=_0x488de2['vusers.created']||0x0,_0x299d3a=_0x488de2[_0x39f401(0x222)]||0x0,_0x57aa3e=_0x488de2['vusers.completed']||0x0,_0x284df6=Object[_0x39f401(0x214)](_0x488de2)[_0x39f401(0x200)](_0xa4e322=>_0xa4e322[_0x39f401(0x209)](_0x39f401(0x21d))),_0x2c1bb4={};_0x284df6['forEach'](_0x41c3c0=>{const _0x5ae235=_0x41c3c0['replace']('errors.','');_0x2c1bb4[_0x5ae235]=_0x488de2[_0x41c3c0];});const _0x5b17b9=(_0x229117[_0x39f401(0x215)]||0x0)-(_0x229117[_0x39f401(0x1f9)]||0x0),_0x4856c1=_0x5b17b9>0x0?_0x5b17b9/0x3e8:0x0,_0x53e96f=['Test\x20duration:\x20'+_0x4856c1[_0x39f401(0x1f2)](0x2)+_0x39f401(0x1f0),_0x39f401(0x212)+_0x7d8c3c,_0x39f401(0x20f)+_0x299d3a,_0x39f401(0x21a)+_0x57aa3e,_0x284df6[_0x39f401(0x211)]?_0x39f401(0x20d)+Object[_0x39f401(0x1f8)](_0x2c1bb4)[_0x39f401(0x223)](([_0x414ab6,_0x223d60])=>_0x39f401(0x1e8)+_0x414ab6+':\x20'+_0x223d60)[_0x39f401(0x210)]('\x0a'):_0x39f401(0x1f4)][_0x39f401(0x210)]('\x0a');return{'timestamp':new Date()[_0x39f401(0x1e9)](),'duration':_0x5b17b9,'vusers':{'created':_0x7d8c3c,'completed':_0x57aa3e,'failed':_0x299d3a},'errors':_0x2c1bb4,'summary':_0x53e96f,'resultType':_0x299d3a===0x0?'success':_0x57aa3e>0x0?_0x39f401(0x224):'complete_failure'};}catch(_0x1934dd){a7_0xa6d5d7['error'](_0x39f401(0x207)+_0x1934dd[_0x39f401(0x1fd)]);throw new Error(_0x39f401(0x21b)+_0x1934dd[_0x39f401(0x1fd)]);}}function generateHumanReadableSummary(_0x391505){const _0x4416f1=a7_0x45c1;if(!_0x391505)return'No\x20metrics\x20data\x20available';let _0x4c5f1a=[];const _0x10f7ba=_0x391505[_0x4416f1(0x1fb)]?Math[_0x4416f1(0x20b)](_0x391505[_0x4416f1(0x1fb)]/0x3e8):0x0;_0x4c5f1a[_0x4416f1(0x1e7)](_0x4416f1(0x220)+_0x10f7ba+'\x20seconds');const _0x599e8c=_0x391505['vusers']||{'created':0x0,'completed':0x0,'failed':0x0};_0x4c5f1a['push'](_0x4416f1(0x217)+_0x599e8c['created']+'\x20created,\x20'+_0x599e8c[_0x4416f1(0x1ea)]+_0x4416f1(0x205)+_0x599e8c['failed']+_0x4416f1(0x225));const _0x192db8=_0x391505[_0x4416f1(0x1fe)]!==undefined?parseFloat(_0x391505[_0x4416f1(0x1fe)][_0x4416f1(0x1f2)](0x2))+'%':'N/A';_0x4c5f1a[_0x4416f1(0x1e7)]('Success\x20rate:\x20'+_0x192db8);const _0x1b7fb4=_0x391505['requestsPerSecond']!==undefined?parseFloat(_0x391505[_0x4416f1(0x20c)][_0x4416f1(0x1f2)](0x2))+_0x4416f1(0x20a):'N/A';return _0x4c5f1a['push'](_0x4416f1(0x1fa)+_0x1b7fb4),_0x391505[_0x4416f1(0x216)]&&Object[_0x4416f1(0x214)](_0x391505[_0x4416f1(0x216)])[_0x4416f1(0x211)]>0x0&&(_0x4c5f1a['push'](_0x4416f1(0x213)),Object['entries'](_0x391505[_0x4416f1(0x216)])[_0x4416f1(0x219)](([_0x45ca5f,_0x25032b])=>{const _0xbc936e=_0x4416f1;_0x4c5f1a['push'](_0xbc936e(0x1e8)+_0x45ca5f+':\x20'+_0x25032b);})),_0x4c5f1a[_0x4416f1(0x210)]('\x0a');}