File tree 2 files changed +5
-17
lines changed
2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,7 @@ const dgram = require('dgram');
3
3
const net = require ( 'net' ) ;
4
4
const dns = require ( 'dns' ) ;
5
5
const { PROTOCOL } = require ( './constants' ) ;
6
-
7
- // Imported below, only if needed
8
- let unixDgram ;
6
+ const unixDgram = require ( 'unix-dgram' ) ;
9
7
10
8
const UDS_PATH_DEFAULT = '/var/run/datadog/dsd.socket' ;
11
9
@@ -87,16 +85,6 @@ const createUdpTransport = args => {
87
85
} ;
88
86
89
87
const createUdsTransport = args => {
90
- try {
91
- // This will not always be available, as noted in the error message below
92
- unixDgram = require ( 'unix-dgram' ) ; // eslint-disable-line global-require
93
- } catch ( err ) {
94
- throw new Error (
95
- 'The library `unix_dgram`, needed for the uds protocol to work, is not installed. ' +
96
- 'You need to pick another protocol to use hot-shots. ' +
97
- 'See the hot-shots README for additional details.'
98
- ) ;
99
- }
100
88
const udsPath = args . path ? args . path : UDS_PATH_DEFAULT ;
101
89
const socket = unixDgram . createSocket ( 'unix_dgram' ) ;
102
90
Original file line number Diff line number Diff line change 34
34
"lint" : " eslint lib/**/*.js test/**/*.js" ,
35
35
"pretest" : " npm run lint"
36
36
},
37
- "optionalDependencies" : {
38
- "unix-dgram" : " 2.0.x"
39
- },
37
+ "optionalDependencies" : {},
40
38
"devDependencies" : {
41
39
"eslint" : " 5.9.x" ,
42
40
"mocha" : " 6.2.x" ,
43
41
"nyc" : " 15.x"
44
42
},
45
43
"license" : " MIT" ,
46
- "dependencies" : {}
44
+ "dependencies" : {
45
+ "unix-dgram" : " 2.0.x"
46
+ }
47
47
}
You can’t perform that action at this time.
0 commit comments