datadog-lambda 1.10.0 → 1.14.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: c19e8514981117ae88bdaa4d17f7a3a5db19595d39336100ac581e0cf330be1d
4
- data.tar.gz: 5d2c0ef21fb1fb0d33759f0b3430daebe88100e4f626b20f6dd9512739c6b62c
3
+ metadata.gz: f0299ef3a855a65e1b2bd066dca1bc81421d6173118775a8be556f497762a7e5
4
+ data.tar.gz: 8193383951539a3db0043f10141b228ba4dd51ee9f806d2f5e1570e4c58a2306
5
5
  SHA512:
6
- metadata.gz: 6cab42dc833290ea7742def1dda6e4bb4a89ebb7f90240e053cdbcd8f8a338fbaaa98069dc48fdc6d823fb087a90c946c097bd012014e31b84629995f296fe0a
7
- data.tar.gz: 4092f19c6b544307e2a82492fd13ce2241d2e0820df2b81da53a6adbd4ec3da0aa9b6d04a56c528b822f93df36e8122985d1a5c0584773d867c3f787feb46eba
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
- resource_names: request_context.function_name
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
@@ -12,7 +12,7 @@ module Datadog
12
12
  module Lambda
13
13
  module VERSION
14
14
  MAJOR = 1
15
- MINOR = 10
15
+ MINOR = 14
16
16
  PATCH = 0
17
17
  PRE = nil
18
18
 
@@ -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.10.0
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: 2020-08-10 00:00:00.000000000 Z
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.0.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: []