forked from pinpoint-apm/pinpoint-node-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent-info.js
43 lines (38 loc) · 1.15 KB
/
agent-info.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Pinpoint Node.js Agent
* Copyright 2020-present NAVER Corp.
* Apache License v2.0
*/
'use strict'
const os = require('os')
const internalIp = require('internal-ip')
const agentPackage = require('../../../package')
class AgentInfo {
constructor(initData = {}) {
this.agentId = initData.agentId
this.applicationName = initData.applicationName
this.serviceType = initData.serviceType
this.applicationServiceType = initData.serviceType
this.container = initData.container
this.startTimestamp = initData.agentStartTime
this.agentStartTime = initData.agentStartTime
this.agentVersion = agentPackage.version
this.hostname = os.hostname()
this.ip = internalIp.v4.sync()
this.pid = process.pid
this.ports = ''
this.vmVerson = ''
}
static create(config, agentStartTime) {
return new AgentInfo({
agentId: config.agentId,
applicationName: config.applicationName,
serviceType: config.serviceType,
applicationServiceType: config.serviceType,
container: config.container,
startTimestamp: agentStartTime,
agentStartTime: agentStartTime,
})
}
}
module.exports = AgentInfo