dt-extensions-sdk 1.1.13__py3-none-any.whl → 1.1.15__py3-none-any.whl
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.
- {dt_extensions_sdk-1.1.13.dist-info → dt_extensions_sdk-1.1.15.dist-info}/METADATA +1 -1
- dt_extensions_sdk-1.1.15.dist-info/RECORD +33 -0
- {dt_extensions_sdk-1.1.13.dist-info → dt_extensions_sdk-1.1.15.dist-info}/licenses/LICENSE.txt +9 -9
- dynatrace_extension/__about__.py +5 -5
- dynatrace_extension/__init__.py +27 -27
- dynatrace_extension/cli/__init__.py +5 -5
- dynatrace_extension/cli/create/__init__.py +1 -1
- dynatrace_extension/cli/create/create.py +76 -76
- dynatrace_extension/cli/create/extension_template/.gitignore.template +160 -160
- dynatrace_extension/cli/create/extension_template/README.md.template +33 -33
- dynatrace_extension/cli/create/extension_template/activation.json.template +15 -15
- dynatrace_extension/cli/create/extension_template/extension/activationSchema.json.template +118 -118
- dynatrace_extension/cli/create/extension_template/extension/extension.yaml.template +17 -17
- dynatrace_extension/cli/create/extension_template/extension_name/__main__.py.template +43 -43
- dynatrace_extension/cli/create/extension_template/setup.py.template +28 -12
- dynatrace_extension/cli/main.py +428 -428
- dynatrace_extension/cli/schema.py +129 -129
- dynatrace_extension/sdk/__init__.py +3 -3
- dynatrace_extension/sdk/activation.py +43 -43
- dynatrace_extension/sdk/callback.py +134 -141
- dynatrace_extension/sdk/communication.py +518 -469
- dynatrace_extension/sdk/event.py +19 -19
- dynatrace_extension/sdk/extension.py +1040 -1037
- dynatrace_extension/sdk/helper.py +191 -191
- dynatrace_extension/sdk/metric.py +118 -118
- dynatrace_extension/sdk/runtime.py +67 -67
- dynatrace_extension/sdk/vendor/mureq/LICENSE +13 -13
- dynatrace_extension/sdk/vendor/mureq/mureq.py +447 -447
- dt_extensions_sdk-1.1.13.dist-info/RECORD +0 -33
- {dt_extensions_sdk-1.1.13.dist-info → dt_extensions_sdk-1.1.15.dist-info}/WHEEL +0 -0
- {dt_extensions_sdk-1.1.13.dist-info → dt_extensions_sdk-1.1.15.dist-info}/entry_points.txt +0 -0
@@ -1,67 +1,67 @@
|
|
1
|
-
# SPDX-FileCopyrightText: 2023-present Dynatrace LLC
|
2
|
-
#
|
3
|
-
# SPDX-License-Identifier: MIT
|
4
|
-
|
5
|
-
import logging
|
6
|
-
from typing import ClassVar, List, NamedTuple
|
7
|
-
|
8
|
-
|
9
|
-
class DefaultLogLevel(NamedTuple):
|
10
|
-
string_value: str
|
11
|
-
int_value: int
|
12
|
-
|
13
|
-
|
14
|
-
class RuntimeProperties:
|
15
|
-
_default_log_level = DefaultLogLevel("info", logging.INFO)
|
16
|
-
_log_level_converter: ClassVar = {"debug": logging.DEBUG, "info": logging.INFO}
|
17
|
-
|
18
|
-
def __init__(self, json_response: dict):
|
19
|
-
"""
|
20
|
-
This is the response from EEC when a status (heartbeat) is sent
|
21
|
-
Example:
|
22
|
-
{'extconfig': 'b2520a74-88e8-3e03-bc01-e1116fec4a98', 'userconfig': '1645918226657', 'debugmode': '0', 'runtime': {}, 'tasks': []}
|
23
|
-
"""
|
24
|
-
self.extconfig: str = json_response.get("extconfig", "")
|
25
|
-
self.userconfig: str = json_response.get("userconfig", "")
|
26
|
-
self.debugmode: bool = json_response.get("debugmode", "0") == "1"
|
27
|
-
self.runtime: dict = json_response.get("runtime", {})
|
28
|
-
self.tasks: List[str] = json_response.get("tasks", [])
|
29
|
-
|
30
|
-
@classmethod
|
31
|
-
def set_default_log_level(cls, value: str):
|
32
|
-
RuntimeProperties._default_log_level = DefaultLogLevel(value, RuntimeProperties._to_log_level(value))
|
33
|
-
|
34
|
-
@classmethod
|
35
|
-
def _to_log_level(cls, value: str) -> int:
|
36
|
-
"""
|
37
|
-
The method convert LogLevel string value into Python log level (loggin package).
|
38
|
-
loggin.INFO is a default.
|
39
|
-
:param value: string log lever
|
40
|
-
:return: Python log level
|
41
|
-
"""
|
42
|
-
return RuntimeProperties._log_level_converter.get(value, RuntimeProperties._default_log_level.int_value)
|
43
|
-
|
44
|
-
def log_level(self, extension_name: str) -> int:
|
45
|
-
"""
|
46
|
-
The method check python.debuglevel (lower priority)
|
47
|
-
and python.debuglevel.extension_name (higher priority) string debug flags.
|
48
|
-
loggin.INFO is a default.
|
49
|
-
:param extension_name: extension name
|
50
|
-
:return: log level for Python log system (loggin)
|
51
|
-
"""
|
52
|
-
value = self.runtime.get("debuglevel", RuntimeProperties._default_log_level.string_value)
|
53
|
-
value = self.runtime.get(f"debuglevel.{extension_name}", value)
|
54
|
-
return RuntimeProperties._to_log_level(value)
|
55
|
-
|
56
|
-
def get_api_log_level(self, extension_name: str) -> int:
|
57
|
-
"""
|
58
|
-
The method check python.debuglevel.api (lower priority)
|
59
|
-
python.debuglevel.extension_name.api (higher priority) string debug flags.
|
60
|
-
loggin.INFO is a default.
|
61
|
-
:param extension_name: extension name
|
62
|
-
:return: log level for Python log system (loggin)
|
63
|
-
"""
|
64
|
-
value = self.runtime.get("debuglevel.api", RuntimeProperties._default_log_level.string_value)
|
65
|
-
value = self.runtime.get(f"debuglevel.{extension_name}.api", value)
|
66
|
-
return RuntimeProperties._to_log_level(value)
|
67
|
-
pass
|
1
|
+
# SPDX-FileCopyrightText: 2023-present Dynatrace LLC
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: MIT
|
4
|
+
|
5
|
+
import logging
|
6
|
+
from typing import ClassVar, List, NamedTuple
|
7
|
+
|
8
|
+
|
9
|
+
class DefaultLogLevel(NamedTuple):
|
10
|
+
string_value: str
|
11
|
+
int_value: int
|
12
|
+
|
13
|
+
|
14
|
+
class RuntimeProperties:
|
15
|
+
_default_log_level = DefaultLogLevel("info", logging.INFO)
|
16
|
+
_log_level_converter: ClassVar = {"debug": logging.DEBUG, "info": logging.INFO}
|
17
|
+
|
18
|
+
def __init__(self, json_response: dict):
|
19
|
+
"""
|
20
|
+
This is the response from EEC when a status (heartbeat) is sent
|
21
|
+
Example:
|
22
|
+
{'extconfig': 'b2520a74-88e8-3e03-bc01-e1116fec4a98', 'userconfig': '1645918226657', 'debugmode': '0', 'runtime': {}, 'tasks': []}
|
23
|
+
"""
|
24
|
+
self.extconfig: str = json_response.get("extconfig", "")
|
25
|
+
self.userconfig: str = json_response.get("userconfig", "")
|
26
|
+
self.debugmode: bool = json_response.get("debugmode", "0") == "1"
|
27
|
+
self.runtime: dict = json_response.get("runtime", {})
|
28
|
+
self.tasks: List[str] = json_response.get("tasks", [])
|
29
|
+
|
30
|
+
@classmethod
|
31
|
+
def set_default_log_level(cls, value: str):
|
32
|
+
RuntimeProperties._default_log_level = DefaultLogLevel(value, RuntimeProperties._to_log_level(value))
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def _to_log_level(cls, value: str) -> int:
|
36
|
+
"""
|
37
|
+
The method convert LogLevel string value into Python log level (loggin package).
|
38
|
+
loggin.INFO is a default.
|
39
|
+
:param value: string log lever
|
40
|
+
:return: Python log level
|
41
|
+
"""
|
42
|
+
return RuntimeProperties._log_level_converter.get(value, RuntimeProperties._default_log_level.int_value)
|
43
|
+
|
44
|
+
def log_level(self, extension_name: str) -> int:
|
45
|
+
"""
|
46
|
+
The method check python.debuglevel (lower priority)
|
47
|
+
and python.debuglevel.extension_name (higher priority) string debug flags.
|
48
|
+
loggin.INFO is a default.
|
49
|
+
:param extension_name: extension name
|
50
|
+
:return: log level for Python log system (loggin)
|
51
|
+
"""
|
52
|
+
value = self.runtime.get("debuglevel", RuntimeProperties._default_log_level.string_value)
|
53
|
+
value = self.runtime.get(f"debuglevel.{extension_name}", value)
|
54
|
+
return RuntimeProperties._to_log_level(value)
|
55
|
+
|
56
|
+
def get_api_log_level(self, extension_name: str) -> int:
|
57
|
+
"""
|
58
|
+
The method check python.debuglevel.api (lower priority)
|
59
|
+
python.debuglevel.extension_name.api (higher priority) string debug flags.
|
60
|
+
loggin.INFO is a default.
|
61
|
+
:param extension_name: extension name
|
62
|
+
:return: log level for Python log system (loggin)
|
63
|
+
"""
|
64
|
+
value = self.runtime.get("debuglevel.api", RuntimeProperties._default_log_level.string_value)
|
65
|
+
value = self.runtime.get(f"debuglevel.{extension_name}.api", value)
|
66
|
+
return RuntimeProperties._to_log_level(value)
|
67
|
+
pass
|
@@ -1,14 +1,14 @@
|
|
1
|
-
BSD Zero Clause License
|
2
|
-
|
3
|
-
Copyright (c) 2021 Shivaram Lingamneni
|
4
|
-
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
-
purpose with or without fee is hereby granted.
|
7
|
-
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
1
|
+
BSD Zero Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Shivaram Lingamneni
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|