datadog-lambda 3.26.0 → 3.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 235f4d57b486d61592d478b2e12ea42d13ea00146520a973b75534a6f778f803
4
- data.tar.gz: 84bd271dbb4d5507f442c4bce2a426f8a25f922e06f35e7350577eb465a4ddc2
3
+ metadata.gz: 327f22524c28715a772eae6ea159c4b39c2bdc5ce8ceca2c5f665f45d3ecaa72
4
+ data.tar.gz: 325f5f3d40f965f34b9474df80580e6e8664dfedcfa8e072c24bcf065d0992e0
5
5
  SHA512:
6
- metadata.gz: 1e3357b9471d5f3da25b344f4b23e3eb1c123d9f8308e6eee61d398cb9ddc0fb683c0cc9099b3f0bc27e329cd607d64d1471acf1d0487c83686085bd9cc2335a
7
- data.tar.gz: ef9828a5509e0aa5940cf45e706734bc5ec077e32c9387b5c4aace5699e82cdd09a48fbdd0bf7318394d8172f6ecc953f0d1de4eb2ff5ee665fc459081067d3c
6
+ metadata.gz: 1f2d0d594085a1c719d62329369706e0febc232aab59c8bb3fd56de050d6419dc74f07d692b294443ab80a6693d756515c09f71909741a9cd693632a330f9b8c
7
+ data.tar.gz: cf47002396c9583e3afe62c4bb1ea654c4644e1b073ec13356b17c87e5f44bea8bda1a6335c3e2dfe71bb56a429a476f837b4ab89af0559b8810f1c2d69a5d70
@@ -42,7 +42,7 @@ module Datadog
42
42
  options[:service] = 'aws.lambda'
43
43
  options[:type] = 'serverless'
44
44
 
45
- trace_digest = Datadog::Utils.send_start_invocation_request(event:)
45
+ trace_digest = Datadog::Utils.send_start_invocation_request(event:, request_context:)
46
46
  # Only continue trace from a new one if it exist, or else,
47
47
  # it will create a new trace, which is not ideal here.
48
48
  options[:continue_from] = trace_digest if trace_digest
@@ -53,8 +53,8 @@ module Datadog
53
53
  end
54
54
  # rubocop:enable Metrics/AbcSize
55
55
 
56
- def on_end(response:)
57
- Datadog::Utils.send_end_invocation_request(response:, span_id: @trace.id)
56
+ def on_end(response:, request_context:)
57
+ Datadog::Utils.send_end_invocation_request(response:, span_id: @trace.id, request_context:)
58
58
  @trace&.finish
59
59
  end
60
60
 
@@ -22,6 +22,8 @@ module Datadog
22
22
  DD_SPAN_ID_HEADER = 'x-datadog-span-id'
23
23
  DD_PARENT_ID_HEADER = Datadog::Tracing::Distributed::Datadog::PARENT_ID_KEY
24
24
 
25
+ LAMBDA_RUNTIME_AWS_REQUEST_HEADER_ID = 'lambda-runtime-aws-request-id'
26
+
25
27
  START_INVOCATION_URI = URI(EXTENSION_BASE_URL + START_INVOCATION_PATH).freeze
26
28
  END_INVOCATION_URI = URI(EXTENSION_BASE_URL + END_INVOCATION_PATH).freeze
27
29
 
@@ -40,10 +42,13 @@ module Datadog
40
42
  File.exist?(EXTENSION_PATH)
41
43
  end
42
44
 
43
- def self.send_start_invocation_request(event:)
45
+ def self.send_start_invocation_request(event:, request_context:)
44
46
  return unless extension_running?
45
47
 
46
- response = Net::HTTP.post(START_INVOCATION_URI, event.to_json, request_headers)
48
+ headers = request_headers
49
+ headers[LAMBDA_RUNTIME_AWS_REQUEST_HEADER_ID] = request_context.aws_request_id
50
+ response = Net::HTTP.post(START_INVOCATION_URI, event.to_json, headers)
51
+
47
52
  # Add origin, since tracer expects it for extraction
48
53
  response[Datadog::Trace::DD_ORIGIN] = 'lambda'
49
54
 
@@ -53,7 +58,7 @@ module Datadog
53
58
  end
54
59
 
55
60
  # rubocop:disable Metrics/AbcSize
56
- def self.send_end_invocation_request(response:, span_id:)
61
+ def self.send_end_invocation_request(response:, span_id:, request_context:)
57
62
  return unless extension_running?
58
63
 
59
64
  request = Net::HTTP::Post.new(END_INVOCATION_URI)
@@ -66,6 +71,9 @@ module Datadog
66
71
  # Propagator doesn't inject span_id, so we do it manually
67
72
  # It is needed for the extension to take this span id
68
73
  request[DD_SPAN_ID_HEADER] = span_id.to_s
74
+
75
+ request[LAMBDA_RUNTIME_AWS_REQUEST_HEADER_ID] = request_context.aws_request_id
76
+
69
77
  # Remove Parent ID if it is the same as the Span ID
70
78
  request.delete(DD_PARENT_ID_HEADER) if request[DD_PARENT_ID_HEADER] == span_id.to_s
71
79
  Datadog::Utils.logger.debug "End invocation request headers: #{request.to_hash}"
@@ -12,7 +12,7 @@ module Datadog
12
12
  module Lambda
13
13
  module VERSION
14
14
  MAJOR = 3
15
- MINOR = 26
15
+ MINOR = 27
16
16
  PATCH = 0
17
17
  PRE = nil
18
18
 
@@ -66,7 +66,7 @@ module Datadog
66
66
  record_enhanced('errors', context)
67
67
  raise e
68
68
  ensure
69
- @listener&.on_end(response: @response)
69
+ @listener&.on_end(response: @response, request_context: context)
70
70
  @is_cold_start = false
71
71
  @metrics_client.close
72
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.26.0
4
+ version: 3.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-07-25 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-xray-sdk