datadog-lambda 2.21.0 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff16978e295234189602cab59d2c4f2adbff91edc9bcb9a52bbde91fb744369
|
4
|
+
data.tar.gz: 4e89c094a7c0fb2e6161f7179266831df23dd4f665ccaafcc9b1d233fcce0860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3738d873ac92162f632b6457ad1d188397eec4a3a59d9a523fcdf9b2f53eadd559f92f388f8d5d4a96da6cc38024124efb828b714c0cd44ed050a347eb246150
|
7
|
+
data.tar.gz: 37cfd0a36ae52012ebdc14cab31b1d22b20e968413ef136010fa21f0ee6be2b965257b2066d5d93ed7c3eabdf9989a2a40c84e5341f48aa1bb1ae0e0cffb29d9
|
@@ -17,6 +17,7 @@ module Datadog
|
|
17
17
|
DD_TRACE_ID_HEADER = 'x-datadog-trace-id'
|
18
18
|
DD_PARENT_ID_HEADER = 'x-datadog-parent-id'
|
19
19
|
DD_SAMPLING_PRIORITY_HEADER = 'x-datadog-sampling-priority'
|
20
|
+
DD_ORIGIN = 'x-datadog-origin'
|
20
21
|
DD_XRAY_SUBSEGMENT_NAME = 'datadog-metadata'
|
21
22
|
DD_XRAY_SUBSEGMENT_KEY = 'trace'
|
22
23
|
DD_XRAY_SUBSEGMENT_NAMESPACE = 'datadog'
|
@@ -42,8 +42,13 @@ module Datadog
|
|
42
42
|
options[:service] = 'aws.lambda'
|
43
43
|
options[:span_type] = 'serverless'
|
44
44
|
Datadog::Trace.apply_datadog_trace_context(Datadog::Trace.trace_context)
|
45
|
+
|
46
|
+
trace_digest = Datadog::Utils.send_start_invocation_request(event: event)
|
47
|
+
# Only continue trace from a new one if it exist, or else,
|
48
|
+
# it will create a new trace, which is not ideal here.
|
49
|
+
options[:continue_from] = trace_digest if trace_digest
|
50
|
+
|
45
51
|
@trace = Datadog::Tracing.trace('aws.lambda', **options)
|
46
|
-
Datadog::Utils.send_start_invocation_request(event: event)
|
47
52
|
end
|
48
53
|
# rubocop:enable Metrics/AbcSize
|
49
54
|
|
@@ -8,6 +8,7 @@
|
|
8
8
|
# Copyright 2023 Datadog, Inc.
|
9
9
|
#
|
10
10
|
require 'net/http'
|
11
|
+
require 'datadog/tracing/contrib/http/distributed/fetcher'
|
11
12
|
|
12
13
|
module Datadog
|
13
14
|
# Utils contains utility functions shared between modules
|
@@ -21,6 +22,11 @@ module Datadog
|
|
21
22
|
START_INVOCATION_URI = URI(EXTENSION_BASE_URL + START_INVOCATION_PATH).freeze
|
22
23
|
END_INVOCATION_URI = URI(EXTENSION_BASE_URL + END_INVOCATION_PATH).freeze
|
23
24
|
|
25
|
+
# Internal communications use Datadog tracing headers
|
26
|
+
PROPAGATOR = Tracing::Distributed::Datadog.new(
|
27
|
+
fetcher: Tracing::Contrib::HTTP::Distributed::Fetcher
|
28
|
+
)
|
29
|
+
|
24
30
|
def self.extension_running?
|
25
31
|
return @is_extension_running unless @is_extension_running.nil?
|
26
32
|
|
@@ -35,11 +41,10 @@ module Datadog
|
|
35
41
|
return unless extension_running?
|
36
42
|
|
37
43
|
response = Net::HTTP.post(START_INVOCATION_URI, event.to_json, request_headers)
|
44
|
+
# Add origin, since tracer expects it for extraction
|
45
|
+
response[Datadog::Trace::DD_ORIGIN] = 'lambda'
|
38
46
|
|
39
|
-
|
40
|
-
# Only continue trace from a new one if it exist, or else,
|
41
|
-
# it will create a new trace, which is not ideal here.
|
42
|
-
Tracing.continue_trace!(trace_digest) if trace_digest
|
47
|
+
PROPAGATOR.extract(response)
|
43
48
|
rescue StandardError => e
|
44
49
|
Datadog::Utils.logger.debug "failed on start invocation request to extension: #{e}"
|
45
50
|
end
|
@@ -51,8 +56,9 @@ module Datadog
|
|
51
56
|
request.body = response.to_json
|
52
57
|
request[Datadog::Core::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST] = 1
|
53
58
|
|
54
|
-
|
55
|
-
|
59
|
+
trace_digest = Datadog::Tracing.active_trace&.to_digest
|
60
|
+
|
61
|
+
PROPAGATOR.inject!(trace_digest, request)
|
56
62
|
Net::HTTP.start(END_INVOCATION_URI.host, END_INVOCATION_URI.port) do |http|
|
57
63
|
http.request(request)
|
58
64
|
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: 2.
|
4
|
+
version: 2.22.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: 2023-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-xray-sdk
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.17.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.17.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|