tom-pytel edited a comment on pull request #2:
URL: https://github.com/apache/skywalking-nodejs/pull/2#issuecomment-735256060


   Ready for merge I think, tests need to be changed since I added tags which 
weren't previously being returned. I couldn't really come up with a 
ready-to-use example vs. the previous version since it is so limited that it 
really only did one thing, but I did hack it to try with the sever and client 
examples I will post here and it didn't work well at all, so yes this PR is an 
improvement.
   
   Server example:
   ```julia
   const {default: Agent, ContextManager} = require('skywalking');
   
   Agent.start({
     serviceName: '',
     serviceInstance: '',
     collectorAddress: '',
     authorization: '',
     maxBufferSize: 1000,
   });
   
   const http = require('http');
   
   let count = 0;
   
   const server = http.createServer(function (req, res) {
     if (count++ & 1)
       res.writeHead(404, {'Content-Type': 'text/html'});
   
     res.write('Hello World...\n');
   
     res.end();
   }).listen(8000);
   ```
   
   Client example:
   ```julia
   const {default: Agent, ContextManager} = require('skywalking');
   
   Agent.start({
     serviceName: '',
     serviceInstance: '',
     collectorAddress: '',
     authorization: '',
     maxBufferSize: 1000,
   });
   
   var http = require('http');
   
   callback = function(response) {
     var str = '';
   
     response.on('data', function (chunk) {
       str += chunk;
     });
   
     response.on('end', function () {
       console.log(str);
     });
   }
   
   ContextManager.withSpan(ContextManager.current.newLocalSpan('local'), () => {
     http.request({host: 'localhost', path: '/1', port: '8000', methof: 'GET'}, 
callback).end();
     http.request({host: 'localhost', path: '/2', port: '8000', methof: 'GET'}, 
callback).end();
     http.request({host: 'localhost', path: '/3', port: '8000', methof: 'GET'}, 
callback).end();
   });
   
   setTimeout(() => null, 2500);  // allow time for BG update
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to