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/metrics-util / src / process / ProcessSnapshotDataSource.js
Size: Mime:
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.
"use strict";const os=require("os"),DataSource=require("../DataSource"),pid=process.pid,env=process.env,exec=process.execPath,args=process.argv;let user,group;try{const userInfo=os.userInfo();user=userInfo.username,group=userInfo.gid}catch(ignored){}const start=Math.floor(Date.now()-1e3*process.uptime());class ProcessSnapshotDataSource extends DataSource{constructor(containerType,hostName){super(3e5),this.snapshotData={pid:pid,env:env,exec:exec,args:args,user:user,group:group,start:start,containerType:containerType||"docker","com.instana.plugin.host.pid":pid},hostName&&(this.snapshotData["com.instana.plugin.host.name"]=hostName)}setExternalSnapshotData(containerInstanceId,hostName){this.snapshotData.container=containerInstanceId,hostName&&(this.snapshotData["com.instana.plugin.host.name"]=hostName),this._refresh()}doRefresh(callback){process.nextTick(()=>callback(null,this.snapshotData))}}module.exports=exports=ProcessSnapshotDataSource;