You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,24 @@
1
1
# elastic-apm-http-client changelog
2
2
3
+
## v11.0.0
4
+
5
+
- Add support for coordinating data flushing in an AWS Lambda environment. The
6
+
following two API additions are used to ensure that (a) the Elastic Lambda
7
+
extension is signaled at invocation end [per spec](https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-aws-lambda.md#data-flushing)
8
+
and (b) a new intake request is not started when a Lambda function invocation
9
+
is not active.
10
+
11
+
-`Client#lambdaStart()` should be used to indicate when a Lambda function
12
+
invocation begins.
13
+
-`Client#flush([opts,] cb)` now supports an optional `opts.lambdaEnd`
14
+
boolean. Set it to true to indicate this is a flush at the end of a Lambda
15
+
function invocation.
16
+
17
+
This is a **BREAKING CHANGE**, because current versions of elastic-apm-node
18
+
depend on `^10.4.0`. If this were released as another 10.x, then usage of
19
+
current elastic-apm-node with this version of the client would break
20
+
behavior in a Lambda environment.
21
+
3
22
## v10.4.0
4
23
5
24
- Add APM Server version checking to the client. On creation the client will
Copy file name to clipboardExpand all lines: README.md
+33-1Lines changed: 33 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,6 +341,33 @@ is provided. For example, in an AWS Lambda function some metadata is not
341
341
available until the first function invocation -- which is some async time after
342
342
Client creation.
343
343
344
+
### `client.lambdaStart()`
345
+
346
+
Tells the client that a Lambda function invocation has started.
347
+
348
+
#### Notes on Lambda usage
349
+
350
+
To properly handle [data flushing for instrumented Lambda functions](https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-aws-lambda.md#data-flushing)
351
+
this Client should be used as follows in a Lambda environment.
352
+
353
+
- When a Lambda invocation starts, `client.lambdaStart()` must be called.
354
+
355
+
The Client prevents intake requests to APM Server when in a Lambda environment
356
+
when a function invocation is *not* active. This is to ensure that an intake
357
+
request does not accidentally span a period when a Lambda VM is frozen,
358
+
which can lead to timeouts and lost APM data.
359
+
360
+
- When a Lambda invocation finishes, `client.flush({lambdaEnd: true}, cb)` must
361
+
be called.
362
+
363
+
The `lambdaEnd: true` tells the Client to (a) mark the lambda as inactive so
364
+
a subsequent intake request is not started until the next invocation, and
365
+
(b) signal the Elastic AWS Lambda Extension that this invocation is done.
366
+
The user's Lambda handler should not finish until `cb` is called. This
367
+
ensures that the extension receives tracing data and the end signal before
368
+
the Lambda Runtime freezes the VM.
369
+
370
+
344
371
### `client.sendSpan(span[, callback])`
345
372
346
373
Send a span to the APM Server.
@@ -381,7 +408,7 @@ Arguments:
381
408
-`callback` - Callback is called when the `metricset` have been flushed to
382
409
the underlying system
383
410
384
-
### `client.flush([callback])`
411
+
### `client.flush([opts,] [callback])`
385
412
386
413
Flush the internal buffer and end the current HTTP request to the APM
387
414
Server. If no HTTP request is in process nothing happens. In an AWS Lambda
@@ -390,6 +417,11 @@ because the APM agent always flushes at the end of a Lambda handler.
390
417
391
418
Arguments:
392
419
420
+
-`opts`:
421
+
-`opts.lambdaEnd` - An optional boolean to indicate if this is the final
422
+
flush at the end of the Lambda function invocation. The client will do
423
+
some extra handling if this is the case. See notes in `client.lambdaStart()`
424
+
above.
393
425
-`callback` - Callback is called when the internal buffer has been
394
426
flushed and the HTTP request ended. If no HTTP request is in progress
0 commit comments