forked from pinpoint-apm/pinpoint-node-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice-type.js
44 lines (38 loc) · 1.01 KB
/
service-type.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
44
/**
* Pinpoint Node.js Agent
* Copyright 2020-present NAVER Corp.
* Apache License v2.0
*/
'use strict'
const serviceTypeConstant = require('../constant/service-type')
const ServiceTypeProperty = serviceTypeConstant.ServiceTypeProperty
class ServiceType {
constructor (code, ...properties) {
this.code = code
this.name = null
this.terminal = false
this.queue = false
this.recordStatistics = false
this.includeDestinationId = false
this.setProperties(properties)
}
setProperties (properties = []) {
properties.forEach(p => {
switch (p) {
case ServiceTypeProperty.TERMINAL:
this.terminal = true
break
case ServiceTypeProperty.QUEUE:
this.queue = true
break
case ServiceTypeProperty.RECORD_STATISTICS:
this.recordStatistics = true
break
case ServiceTypeProperty.INCLUDE_DESTINATION_ID:
this.includeDestinationId = true
break
}
})
}
}
module.exports = ServiceType