@@ -20,17 +20,17 @@ const layerExtensionPort = process.env.INSTANA_LAYER_EXTENSION_PORT
20
20
const timeoutEnvVar = 'INSTANA_TIMEOUT' ;
21
21
22
22
// NOTE: The heartbeat is usually really, really fast (<30ms).
23
- const heartbeatTimeout = 200 ;
23
+ const layerExtensionHeartbeatTimeout = 200 ;
24
24
25
25
// NOTE: The initial heartbeat can be very slow when the Lambda is in cold start.
26
- const initialHeartbeatTimeout = 2000 ;
26
+ const initialLayerExtensionHeartbeatTimeout = 2000 ;
27
27
28
28
// NOTE: When lambda is in cold start, the communication between the handler
29
29
// and the extension can take a while. We need to have a bigger timeout
30
30
// for the initially.
31
- const initialLayerExtensionTimeout = 2000 ;
31
+ const initialLayerExtensionRequestTimeout = 2000 ;
32
32
33
- const layerExtensionTimeout = process . env . INSTANA_LAMBDA_EXTENSION_TIMEOUT_IN_MS
33
+ const layerExtensionRequestTimeout = process . env . INSTANA_LAMBDA_EXTENSION_TIMEOUT_IN_MS
34
34
? Number ( process . env . INSTANA_LAMBDA_EXTENSION_TIMEOUT_IN_MS )
35
35
: 500 ;
36
36
@@ -208,7 +208,7 @@ function scheduleLambdaExtensionHeartbeatRequest(heartbeatOpts = {}) {
208
208
} ) ;
209
209
210
210
// CASE: socket is open but no data is sent (should not happen from we know but we need to handle it)
211
- req . setTimeout ( heartbeatTimeout , ( ) => {
211
+ req . setTimeout ( layerExtensionHeartbeatTimeout , ( ) => {
212
212
// req.destroyed indicates that we have run into a timeout and have already handled the timeout error.
213
213
if ( req . destroyed ) {
214
214
return ;
@@ -225,10 +225,10 @@ function scheduleLambdaExtensionHeartbeatRequest(heartbeatOpts = {}) {
225
225
226
226
// call immediately
227
227
// timeout is bigger because of possible coldstart
228
- executeHeartbeat ( { heartbeatTimeout : initialHeartbeatTimeout } ) ;
228
+ executeHeartbeat ( { heartbeatTimeout : initialLayerExtensionHeartbeatTimeout } ) ;
229
229
230
230
heartbeatInterval = setInterval ( ( ) => {
231
- executeHeartbeat ( { heartbeatTimeout : heartbeatTimeout } ) ;
231
+ executeHeartbeat ( { heartbeatTimeout : layerExtensionHeartbeatTimeout } ) ;
232
232
} , 300 ) ;
233
233
234
234
heartbeatInterval . unref ( ) ;
@@ -247,9 +247,9 @@ function getBackendTimeout(localUseLambdaExtension) {
247
247
if ( localUseLambdaExtension ) {
248
248
if ( firstRequestToExtension ) {
249
249
firstRequestToExtension = false ;
250
- return initialLayerExtensionTimeout ;
250
+ return initialLayerExtensionRequestTimeout ;
251
251
} else {
252
- return layerExtensionTimeout ;
252
+ return layerExtensionRequestTimeout ;
253
253
}
254
254
}
255
255
0 commit comments