1
1
# frozen_string_literal: true
2
2
3
- require 'aws_lambda_ric/lambda_handler'
4
-
5
3
module Datadog
6
4
# Lambda module streamlines instrumenting AWS Lambda functions with Datadog.
7
5
module Lambda
8
- def self . handler ( event :, context :)
9
- begin
10
- env_handler = ENV [ 'DD_LAMBDA_HANDLER' ]
11
- raise 'DD_LAMBDA_HANDLER is not set, Datadog will not work as expected' if env_handler . nil?
12
-
13
- @lambda_handler = LambdaHandler . new ( env_handler : env_handler )
14
- require @lambda_handler . handler_file_name
6
+ def self . configure_apm
7
+ # Load tracing
8
+ require_relative 'tracing'
9
+ require_relative 'tracing/contrib'
15
10
16
- configure_apm do |c |
17
- c . tracing . instrument :aws
18
- end
11
+ # Load other products (must follow tracing)
12
+ require_relative 'profiling'
13
+ require_relative 'appsec'
14
+ require_relative 'di'
15
+ require_relative 'error_tracking'
16
+ require_relative 'kit'
19
17
20
- @lambda_handler . call_handler ( request : event , context : context )
21
- rescue Exception => e # rubocop:disable Lint/RescueException
22
- raise e
23
- end
24
- end
25
-
26
- def self . configure_apm
27
- require_relative 'datadog/tracing'
28
- require_relative 'datadog/tracing/transport/io'
18
+ require_relative 'tracing/transport/io'
29
19
30
20
# Needed to keep trace flushes on a single line
31
21
$stdout. sync = true
@@ -38,7 +28,7 @@ def self.configure_apm
38
28
# end
39
29
c . tags = { "_dd.origin" : 'lambda' }
40
30
# Enable AWS SDK instrumentation
41
- c . tracing . instrument :aws if trace_managed_services?
31
+ # c.tracing.instrument :aws if trace_managed_services?
42
32
43
33
yield ( c ) if block_given?
44
34
end
0 commit comments