|
2 | 2 | # under the Apache License Version 2.0. |
3 | 3 | # This product includes software developed at Datadog (https://www.datadoghq.com/). |
4 | 4 | # Copyright 2019 Datadog, Inc. |
5 | | -import logging |
6 | 5 | import os |
| 6 | +import logging |
7 | 7 | import traceback |
| 8 | +import ujson as json |
8 | 9 | from importlib import import_module |
9 | 10 | from time import time_ns |
10 | 11 |
|
11 | | -import ujson as json |
12 | | - |
| 12 | +from datadog_lambda.extension import should_use_extension, flush_extension |
13 | 13 | from datadog_lambda.cold_start import ( |
14 | | - ColdStartTracer, |
| 14 | + set_cold_start, |
15 | 15 | is_cold_start, |
16 | | - is_managed_instances_mode, |
17 | | - is_new_sandbox, |
18 | 16 | is_proactive_init, |
19 | | - set_cold_start, |
| 17 | + is_new_sandbox, |
| 18 | + is_managed_instances_mode, |
| 19 | + ColdStartTracer, |
20 | 20 | ) |
21 | 21 | from datadog_lambda.config import config |
22 | 22 | from datadog_lambda.constants import ( |
23 | | - Headers, |
24 | 23 | TraceContextSource, |
25 | 24 | XraySubsegment, |
| 25 | + Headers, |
26 | 26 | ) |
27 | | -from datadog_lambda.durable import ( |
28 | | - extract_durable_execution_status, |
29 | | - extract_durable_function_tags, |
30 | | -) |
31 | | -from datadog_lambda.extension import flush_extension, should_use_extension |
32 | 27 | from datadog_lambda.module_name import modify_module_name |
33 | 28 | from datadog_lambda.span_pointers import calculate_span_pointers |
34 | 29 | from datadog_lambda.tag_object import tag_object |
35 | 30 | from datadog_lambda.tracing import ( |
36 | | - InferredSpanInfo, |
37 | | - create_dd_dummy_metadata_subsegment, |
38 | | - create_function_execution_span, |
39 | | - create_inferred_span, |
40 | 31 | extract_dd_trace_context, |
| 32 | + create_dd_dummy_metadata_subsegment, |
41 | 33 | inject_correlation_ids, |
42 | | - is_authorizer_response, |
43 | 34 | mark_trace_as_error_for_5xx_responses, |
44 | | - propagator, |
45 | 35 | set_correlation_ids, |
46 | 36 | set_dd_trace_py_root, |
| 37 | + create_function_execution_span, |
| 38 | + create_inferred_span, |
| 39 | + InferredSpanInfo, |
| 40 | + is_authorizer_response, |
47 | 41 | tracer, |
| 42 | + propagator, |
| 43 | +) |
| 44 | +from datadog_lambda.durable import ( |
| 45 | + extract_durable_function_tags, |
| 46 | + extract_durable_execution_status, |
48 | 47 | ) |
49 | 48 | from datadog_lambda.trigger import ( |
50 | | - extract_http_status_code_tag, |
51 | 49 | extract_trigger_tags, |
| 50 | + extract_http_status_code_tag, |
52 | 51 | ) |
53 | 52 |
|
54 | 53 | logger = logging.getLogger(__name__) |
|
58 | 57 | # making changes to any ddtrace import. |
59 | 58 |
|
60 | 59 | if config.appsec_enabled: |
61 | | - from ddtrace.internal.appsec.product import start |
62 | | - |
63 | 60 | from datadog_lambda.asm import ( |
64 | 61 | asm_set_context, |
65 | | - asm_start_request, |
66 | 62 | asm_start_response, |
| 63 | + asm_start_request, |
67 | 64 | get_asm_blocked_response, |
68 | 65 | ) |
| 66 | + from ddtrace.internal.appsec.product import start |
69 | 67 |
|
70 | 68 | start() |
71 | 69 |
|
|
0 commit comments