|
1 |
| -from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning as _DDTraceDeprecationWarning |
2 |
| -from ddtrace.vendor import debtcollector as _debtcollector |
3 |
| - |
4 |
| - |
5 |
| -# TODO: Deprecate and remove the SAMPLE_RATE_METRIC_KEY constant. |
6 |
| -# This key enables legacy trace sampling support in the Datadog agent. |
7 |
| -_SAMPLE_RATE_METRIC_KEY = SAMPLE_RATE_METRIC_KEY = "_sample_rate" |
8 |
| -_SAMPLING_PRIORITY_KEY = SAMPLING_PRIORITY_KEY = "_sampling_priority_v1" |
9 |
| -_ANALYTICS_SAMPLE_RATE_KEY = ANALYTICS_SAMPLE_RATE_KEY = "_dd1.sr.eausr" |
10 |
| -_SAMPLING_AGENT_DECISION = SAMPLING_AGENT_DECISION = "_dd.agent_psr" |
11 |
| -_SAMPLING_RULE_DECISION = SAMPLING_RULE_DECISION = "_dd.rule_psr" |
12 |
| -_SAMPLING_LIMIT_DECISION = SAMPLING_LIMIT_DECISION = "_dd.limit_psr" |
| 1 | +""" |
| 2 | +This module contains constants used across ddtrace products. |
| 3 | +
|
| 4 | +Constants that should NOT be referenced by ddtrace users are marked with a leading underscore. |
| 5 | +""" |
| 6 | +_SAMPLING_PRIORITY_KEY = "_sampling_priority_v1" |
| 7 | +_ANALYTICS_SAMPLE_RATE_KEY = "_dd1.sr.eausr" |
| 8 | +_SAMPLING_AGENT_DECISION = "_dd.agent_psr" |
| 9 | +_SAMPLING_RULE_DECISION = "_dd.rule_psr" |
| 10 | +_SAMPLING_LIMIT_DECISION = "_dd.limit_psr" |
13 | 11 | _SINGLE_SPAN_SAMPLING_MECHANISM = "_dd.span_sampling.mechanism"
|
14 | 12 | _SINGLE_SPAN_SAMPLING_RATE = "_dd.span_sampling.rule_rate"
|
15 | 13 | _SINGLE_SPAN_SAMPLING_MAX_PER_SEC = "_dd.span_sampling.max_per_second"
|
16 | 14 | _SINGLE_SPAN_SAMPLING_MAX_PER_SEC_NO_LIMIT = -1
|
17 | 15 | _APM_ENABLED_METRIC_KEY = "_dd.apm.enabled"
|
18 | 16 |
|
19 |
| -_ORIGIN_KEY = ORIGIN_KEY = "_dd.origin" |
20 |
| -_USER_ID_KEY = USER_ID_KEY = "_dd.p.usr.id" |
21 |
| -_HOSTNAME_KEY = HOSTNAME_KEY = "_dd.hostname" |
22 |
| -_RUNTIME_FAMILY = RUNTIME_FAMILY = "_dd.runtime_family" |
| 17 | +_ORIGIN_KEY = "_dd.origin" |
| 18 | +_USER_ID_KEY = "_dd.p.usr.id" |
| 19 | +_HOSTNAME_KEY = "_dd.hostname" |
| 20 | +_RUNTIME_FAMILY = "_dd.runtime_family" |
23 | 21 | ENV_KEY = "env"
|
24 | 22 | VERSION_KEY = "version"
|
25 | 23 | SERVICE_KEY = "service.name"
|
26 |
| -_BASE_SERVICE_KEY = BASE_SERVICE_KEY = "_dd.base_service" |
| 24 | +_BASE_SERVICE_KEY = "_dd.base_service" |
27 | 25 | SERVICE_VERSION_KEY = "service.version"
|
28 | 26 | SPAN_KIND = "span.kind"
|
29 |
| -_SPAN_MEASURED_KEY = SPAN_MEASURED_KEY = "_dd.measured" |
30 |
| -_KEEP_SPANS_RATE_KEY = KEEP_SPANS_RATE_KEY = "_dd.tracer_kr" |
31 |
| -_MULTIPLE_IP_HEADERS = MULTIPLE_IP_HEADERS = "_dd.multiple-ip-headers" |
| 27 | +_SPAN_MEASURED_KEY = "_dd.measured" |
| 28 | +_KEEP_SPANS_RATE_KEY = "_dd.tracer_kr" |
| 29 | +_MULTIPLE_IP_HEADERS = "_dd.multiple-ip-headers" |
32 | 30 |
|
33 | 31 | APPSEC_ENV = "DD_APPSEC_ENABLED"
|
34 |
| -_CONFIG_ENDPOINT_ENV = CONFIG_ENDPOINT_ENV = "_DD_CONFIG_ENDPOINT" |
35 |
| -_CONFIG_ENDPOINT_RETRIES_ENV = CONFIG_ENDPOINT_RETRIES_ENV = "_DD_CONFIG_ENDPOINT_RETRIES" |
36 |
| -_CONFIG_ENDPOINT_TIMEOUT_ENV = CONFIG_ENDPOINT_TIMEOUT_ENV = "_DD_CONFIG_ENDPOINT_TIMEOUT" |
| 32 | +_CONFIG_ENDPOINT_ENV = "_DD_CONFIG_ENDPOINT" |
| 33 | +_CONFIG_ENDPOINT_RETRIES_ENV = "_DD_CONFIG_ENDPOINT_RETRIES" |
| 34 | +_CONFIG_ENDPOINT_TIMEOUT_ENV = "_DD_CONFIG_ENDPOINT_TIMEOUT" |
37 | 35 | IAST_ENV = "DD_IAST_ENABLED"
|
38 | 36 |
|
39 | 37 | MANUAL_DROP_KEY = "manual.drop"
|
|
53 | 51 | AUTO_KEEP = 1
|
54 | 52 | # Use this to explicitly inform the backend that a trace should be kept and stored.
|
55 | 53 | USER_KEEP = 2
|
56 |
| - |
57 |
| - |
58 |
| -_DEPRECATED_MODULE_ATTRIBUTES = [ |
59 |
| - "ANALYTICS_SAMPLE_RATE_KEY", |
60 |
| - "SAMPLE_RATE_METRIC_KEY", |
61 |
| - "SAMPLING_PRIORITY_KEY", |
62 |
| - "SAMPLING_AGENT_DECISION", |
63 |
| - "SAMPLING_RULE_DECISION", |
64 |
| - "SAMPLING_LIMIT_DECISION", |
65 |
| - "USER_ID_KEY", |
66 |
| - "ORIGIN_KEY", |
67 |
| - "HOSTNAME_KEY", |
68 |
| - "RUNTIME_FAMILY", |
69 |
| - "BASE_SERVICE_KEY", |
70 |
| - "SPAN_MEASURED_KEY", |
71 |
| - "KEEP_SPANS_RATE_KEY", |
72 |
| - "MULTIPLE_IP_HEADERS", |
73 |
| - "CONFIG_ENDPOINT_ENV", |
74 |
| - "CONFIG_ENDPOINT_RETRIES_ENV", |
75 |
| - "CONFIG_ENDPOINT_TIMEOUT_ENV", |
76 |
| -] |
77 |
| - |
78 |
| - |
79 |
| -def __getattr__(name): |
80 |
| - if name in _DEPRECATED_MODULE_ATTRIBUTES: |
81 |
| - _debtcollector.deprecate( |
82 |
| - ("%s.%s is deprecated" % (__name__, name)), |
83 |
| - category=_DDTraceDeprecationWarning, |
84 |
| - removal_version="3.0.0", |
85 |
| - ) |
86 |
| - |
87 |
| - if name in globals(): |
88 |
| - return globals()[name] |
89 |
| - |
90 |
| - raise AttributeError("%s has no attribute %s", __name__, name) |
0 commit comments