Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@supertenant/collector / src / uncaught / syncHttp.js
Size: Mime:
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.
"use strict";const http=require("http"),agentHost=process.env.INSTANA_AGENT_HOST,agentPort=process.env.INSTANA_AGENT_PORT,path1=process.env.PATH1,payload1=process.env.PAYLOAD1,path2=process.env.PATH2,payload2=process.env.PAYLOAD2;function sendRequest(endpoint,payload,callback){if(!endpoint||!payload)return callback();var payload=Buffer.from(payload,"utf8"),contentLength=payload.length;const req=http.request({host:agentHost,port:agentPort,path:endpoint,method:"POST",headers:{Accept:"application/json","Content-Type":"application/json; charset=UTF-8","Content-Length":contentLength}});function onRequestTimeout(){callback()}req.setTimeout(150,onRequestTimeout),req.write(payload,"utf8"),req.end(()=>{req.removeListener("timeout",onRequestTimeout),callback()})}agentHost&&agentPort||process.exit(1),sendRequest(path1,payload1,()=>{sendRequest(path2,payload2,()=>{process.exit(0)})});