datadog-lambda 1.10.0 → 1.14.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: f0299ef3a855a65e1b2bd066dca1bc81421d6173118775a8be556f497762a7e5
|
4
|
+
data.tar.gz: 8193383951539a3db0043f10141b228ba4dd51ee9f806d2f5e1570e4c58a2306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22e350877b7fb4fc6ace6523c67d4e6283f4acc2b5af6db6393f86a3168b66c8a471b3365eb9c07ca8e995972afc29ea4c6c6eb1e95114cc7887601d221efbb9
|
7
|
+
data.tar.gz: 19650c82c373aa12c399b5196d0b6f6d5713451b68e26fe502bbde8cd6395972e38c37a79c90e3cfe41d2866d56de297806e4a674c70b72fe2d0a5b9f3e4c8c4
|
@@ -56,17 +56,19 @@ module Datadog
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def get_option_tags(request_context:, cold_start:)
|
59
|
-
function_arn = request_context.invoked_function_arn.downcase
|
59
|
+
function_arn = request_context.invoked_function_arn.to_s.downcase
|
60
60
|
tk = function_arn.split(':')
|
61
61
|
function_arn = tk.length > 7 ? tk[0, 7].join(':') : function_arn
|
62
62
|
function_version = tk.length > 7 ? tk[7] : '$LATEST'
|
63
|
+
function_name = request_context.function_name
|
63
64
|
options = {
|
64
65
|
tags: {
|
65
66
|
cold_start: cold_start,
|
66
67
|
function_arn: function_arn,
|
67
68
|
function_version: function_version,
|
68
69
|
request_id: request_context.aws_request_id,
|
69
|
-
|
70
|
+
functionname: function_name.nil? || function_name.empty? ? nil : function_name.downcase,
|
71
|
+
resource_names: function_name
|
70
72
|
}
|
71
73
|
}
|
72
74
|
options
|
@@ -30,7 +30,6 @@ module Datadog
|
|
30
30
|
# NetExtensions contains patches which add tracing context to http calls
|
31
31
|
module NetExtensions
|
32
32
|
def request(req, body = nil, &block)
|
33
|
-
logger = Datadog::Utils.logger
|
34
33
|
begin
|
35
34
|
context = Datadog::Trace.current_trace_context(
|
36
35
|
Datadog::Trace.trace_context
|
@@ -39,7 +38,7 @@ module Datadog
|
|
39
38
|
req = add_ctx_to_req(req, context)
|
40
39
|
rescue StandardError => e
|
41
40
|
trace = e.backtrace.join("\n ")
|
42
|
-
logger.debug(
|
41
|
+
Datadog::Utils.logger.debug(
|
43
42
|
"couldn't add tracing context #{context} to request #{e}:\n#{trace}"
|
44
43
|
)
|
45
44
|
end
|
@@ -53,7 +52,7 @@ module Datadog
|
|
53
52
|
context[:sample_mode]
|
54
53
|
req[Datadog::Trace::DD_PARENT_ID_HEADER.to_sym] = context[:parent_id]
|
55
54
|
req[Datadog::Trace::DD_TRACE_ID_HEADER.to_sym] = context[:trace_id]
|
56
|
-
logger.debug("added context #{context} to request")
|
55
|
+
Datadog::Utils.logger.debug("added context #{context} to request")
|
57
56
|
req
|
58
57
|
end
|
59
58
|
end
|
data/lib/datadog/lambda.rb
CHANGED
@@ -14,6 +14,7 @@ require 'datadog/lambda/utils/logger'
|
|
14
14
|
require 'datadog/lambda/trace/patch_http'
|
15
15
|
require 'json'
|
16
16
|
require 'time'
|
17
|
+
require 'datadog/lambda/version'
|
17
18
|
|
18
19
|
module Datadog
|
19
20
|
# Instruments AWS Lambda functions with Datadog distributed tracing and
|
@@ -101,7 +102,7 @@ module Datadog
|
|
101
102
|
# @return [hash] a hash of the enhanced metrics tags
|
102
103
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
103
104
|
def self.gen_enhanced_tags(context)
|
104
|
-
arn_parts = context.invoked_function_arn.split(':')
|
105
|
+
arn_parts = context.invoked_function_arn.to_s.split(':')
|
105
106
|
# Check if we have an alias or version
|
106
107
|
function_alias = arn_parts[7].nil? ? nil : arn_parts[7]
|
107
108
|
|
@@ -112,8 +113,14 @@ module Datadog
|
|
112
113
|
memorysize: context.memory_limit_in_mb,
|
113
114
|
cold_start: @is_cold_start,
|
114
115
|
runtime: "Ruby #{RUBY_VERSION}",
|
115
|
-
resource: context.function_name
|
116
|
+
resource: context.function_name,
|
117
|
+
datadog_lambda: Datadog::Lambda::VERSION::STRING.to_sym
|
116
118
|
}
|
119
|
+
begin
|
120
|
+
tags[:dd_trace] = Gem.loaded_specs['ddtrace'].version
|
121
|
+
rescue StandardError
|
122
|
+
Datadog::Utils.logger.debug 'dd-trace unavailable'
|
123
|
+
end
|
117
124
|
# If we have an alias...
|
118
125
|
unless function_alias.nil?
|
119
126
|
# If the alis version is $Latest, drop the $ for ddog tag convention.
|
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: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-xray-sdk
|
@@ -118,7 +118,7 @@ licenses:
|
|
118
118
|
- Apache-2.0
|
119
119
|
metadata:
|
120
120
|
allowed_push_host: https://rubygems.org
|
121
|
-
post_install_message:
|
121
|
+
post_install_message:
|
122
122
|
rdoc_options: []
|
123
123
|
require_paths:
|
124
124
|
- lib
|
@@ -133,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
136
|
+
rubygems_version: 3.1.6
|
137
|
+
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Instruments your Ruby AWS Lambda functions with Datadog
|
140
140
|
test_files: []
|