|
| 1 | +from typing import Dict # noqa:F401 |
| 2 | +from typing import Optional # noqa:F401 |
| 3 | + |
1 | 4 | from .utils import sanitize_string # noqa: F401 |
2 | 5 |
|
3 | 6 |
|
4 | | -try: |
5 | | - from ._ddup import * # noqa: F403, F401 |
| 7 | +is_available = False |
6 | 8 |
|
7 | | - is_available = True |
8 | 9 |
|
9 | | -except Exception as e: |
10 | | - from typing import Dict # noqa:F401 |
11 | | - from typing import Optional # noqa:F401 |
| 10 | +def not_implemented(func): |
| 11 | + def wrapper(*args, **kwargs): |
| 12 | + raise NotImplementedError("{} is not implemented on this platform".format(func.__name__)) |
12 | 13 |
|
13 | | - from ddtrace.internal.logger import get_logger |
14 | 14 |
|
15 | | - LOG = get_logger(__name__) |
16 | | - LOG.debug("Failed to import _ddup: %s", e) |
| 15 | +@not_implemented |
| 16 | +def init( |
| 17 | + env, # type: Optional[str] |
| 18 | + service, # type: Optional[str] |
| 19 | + version, # type: Optional[str] |
| 20 | + tags, # type: Optional[Dict[str, str]] |
| 21 | + max_nframes, # type: Optional[int] |
| 22 | + url, # type: Optional[str] |
| 23 | +): |
| 24 | + pass |
| 25 | + |
17 | 26 |
|
18 | | - is_available = False |
| 27 | +@not_implemented |
| 28 | +def upload(): # type: () -> None |
| 29 | + pass |
19 | 30 |
|
20 | | - # Decorator for not-implemented |
21 | | - def not_implemented(func): |
22 | | - def wrapper(*args, **kwargs): |
23 | | - raise NotImplementedError("{} is not implemented on this platform".format(func.__name__)) |
24 | 31 |
|
| 32 | +class SampleHandle: |
25 | 33 | @not_implemented |
26 | | - def init( |
27 | | - env, # type: Optional[str] |
28 | | - service, # type: Optional[str] |
29 | | - version, # type: Optional[str] |
30 | | - tags, # type: Optional[Dict[str, str]] |
31 | | - max_nframes, # type: Optional[int] |
32 | | - url, # type: Optional[str] |
33 | | - ): |
| 34 | + def push_cputime(self, value, count): # type: (int, int) -> None |
34 | 35 | pass |
35 | 36 |
|
36 | 37 | @not_implemented |
37 | | - def upload(): # type: () -> None |
| 38 | + def push_walltime(self, value, count): # type: (int, int) -> None |
38 | 39 | pass |
39 | 40 |
|
40 | | - class SampleHandle: |
41 | | - @not_implemented |
42 | | - def push_cputime(self, value, count): # type: (int, int) -> None |
43 | | - pass |
| 41 | + @not_implemented |
| 42 | + def push_acquire(self, value, count): # type: (int, int) -> None |
| 43 | + pass |
44 | 44 |
|
45 | | - @not_implemented |
46 | | - def push_walltime(self, value, count): # type: (int, int) -> None |
47 | | - pass |
| 45 | + @not_implemented |
| 46 | + def push_release(self, value, count): # type: (int, int) -> None |
| 47 | + pass |
48 | 48 |
|
49 | | - @not_implemented |
50 | | - def push_acquire(self, value, count): # type: (int, int) -> None |
51 | | - pass |
| 49 | + @not_implemented |
| 50 | + def push_alloc(self, value, count): # type: (int, int) -> None |
| 51 | + pass |
52 | 52 |
|
53 | | - @not_implemented |
54 | | - def push_release(self, value, count): # type: (int, int) -> None |
55 | | - pass |
| 53 | + @not_implemented |
| 54 | + def push_heap(self, value): # type: (int) -> None |
| 55 | + pass |
56 | 56 |
|
57 | | - @not_implemented |
58 | | - def push_alloc(self, value, count): # type: (int, int) -> None |
59 | | - pass |
| 57 | + @not_implemented |
| 58 | + def push_lock_name(self, lock_name): # type: (str) -> None |
| 59 | + pass |
60 | 60 |
|
61 | | - @not_implemented |
62 | | - def push_heap(self, value): # type: (int) -> None |
63 | | - pass |
| 61 | + @not_implemented |
| 62 | + def push_frame(self, name, filename, address, line): # type: (str, str, int, int) -> None |
| 63 | + pass |
64 | 64 |
|
65 | | - @not_implemented |
66 | | - def push_lock_name(self, lock_name): # type: (str) -> None |
67 | | - pass |
| 65 | + @not_implemented |
| 66 | + def push_threadinfo(self, thread_id, thread_native_id, thread_name): # type: (int, int, Optional[str]) -> None |
| 67 | + pass |
68 | 68 |
|
69 | | - @not_implemented |
70 | | - def push_frame(self, name, filename, address, line): # type: (str, str, int, int) -> None |
71 | | - pass |
| 69 | + @not_implemented |
| 70 | + def push_taskinfo(self, task_id, task_name): # type: (int, str) -> None |
| 71 | + pass |
72 | 72 |
|
73 | | - @not_implemented |
74 | | - def push_threadinfo(self, thread_id, thread_native_id, thread_name): # type: (int, int, Optional[str]) -> None |
75 | | - pass |
| 73 | + @not_implemented |
| 74 | + def push_exceptioninfo(self, exc_type, count): # type: (type, int) -> None |
| 75 | + pass |
76 | 76 |
|
77 | | - @not_implemented |
78 | | - def push_taskinfo(self, task_id, task_name): # type: (int, str) -> None |
79 | | - pass |
| 77 | + @not_implemented |
| 78 | + def push_class_name(self, class_name): # type: (str) -> None |
| 79 | + pass |
80 | 80 |
|
81 | | - @not_implemented |
82 | | - def push_exceptioninfo(self, exc_type, count): # type: (type, int) -> None |
83 | | - pass |
| 81 | + @not_implemented |
| 82 | + def push_span(self, span, endpoint_collection_enabled): # type: (Optional[Span], bool) -> None |
| 83 | + pass |
84 | 84 |
|
85 | | - @not_implemented |
86 | | - def push_class_name(self, class_name): # type: (str) -> None |
87 | | - pass |
| 85 | + @not_implemented |
| 86 | + def flush_sample(self): # type: () -> None |
| 87 | + pass |
88 | 88 |
|
89 | | - @not_implemented |
90 | | - def push_span(self, span, endpoint_collection_enabled): # type: (Optional[Span], bool) -> None |
91 | | - pass |
92 | 89 |
|
93 | | - @not_implemented |
94 | | - def flush_sample(self): # type: () -> None |
95 | | - pass |
| 90 | +try: |
| 91 | + from ._ddup import * # noqa: F403, F401 |
| 92 | + |
| 93 | + is_available = True |
| 94 | + |
| 95 | +except Exception as e: |
| 96 | + from ddtrace.internal.logger import get_logger |
| 97 | + |
| 98 | + LOG = get_logger(__name__) |
| 99 | + LOG.debug("Failed to import _ddup: %s", e) |
0 commit comments