dt-extensions-sdk 1.2.5__py3-none-any.whl → 1.2.7__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.
Files changed (32) hide show
  1. {dt_extensions_sdk-1.2.5.dist-info → dt_extensions_sdk-1.2.7.dist-info}/METADATA +3 -5
  2. dt_extensions_sdk-1.2.7.dist-info/RECORD +34 -0
  3. {dt_extensions_sdk-1.2.5.dist-info → dt_extensions_sdk-1.2.7.dist-info}/licenses/LICENSE.txt +9 -9
  4. dynatrace_extension/__about__.py +5 -5
  5. dynatrace_extension/__init__.py +27 -27
  6. dynatrace_extension/cli/__init__.py +5 -5
  7. dynatrace_extension/cli/create/__init__.py +1 -1
  8. dynatrace_extension/cli/create/create.py +76 -76
  9. dynatrace_extension/cli/create/extension_template/.gitignore.template +160 -160
  10. dynatrace_extension/cli/create/extension_template/README.md.template +33 -33
  11. dynatrace_extension/cli/create/extension_template/activation.json.template +15 -15
  12. dynatrace_extension/cli/create/extension_template/extension/activationSchema.json.template +118 -118
  13. dynatrace_extension/cli/create/extension_template/extension/extension.yaml.template +17 -17
  14. dynatrace_extension/cli/create/extension_template/extension_name/__main__.py.template +40 -43
  15. dynatrace_extension/cli/create/extension_template/setup.py.template +28 -28
  16. dynatrace_extension/cli/main.py +437 -437
  17. dynatrace_extension/cli/schema.py +129 -129
  18. dynatrace_extension/sdk/__init__.py +3 -3
  19. dynatrace_extension/sdk/activation.py +43 -43
  20. dynatrace_extension/sdk/callback.py +145 -145
  21. dynatrace_extension/sdk/communication.py +483 -483
  22. dynatrace_extension/sdk/event.py +19 -19
  23. dynatrace_extension/sdk/extension.py +1076 -1070
  24. dynatrace_extension/sdk/helper.py +191 -191
  25. dynatrace_extension/sdk/metric.py +118 -118
  26. dynatrace_extension/sdk/runtime.py +67 -67
  27. dynatrace_extension/sdk/snapshot.py +198 -198
  28. dynatrace_extension/sdk/vendor/mureq/LICENSE +13 -13
  29. dynatrace_extension/sdk/vendor/mureq/mureq.py +448 -448
  30. dt_extensions_sdk-1.2.5.dist-info/RECORD +0 -34
  31. {dt_extensions_sdk-1.2.5.dist-info → dt_extensions_sdk-1.2.7.dist-info}/WHEEL +0 -0
  32. {dt_extensions_sdk-1.2.5.dist-info → dt_extensions_sdk-1.2.7.dist-info}/entry_points.txt +0 -0
@@ -1,34 +1,34 @@
1
- # %extension_name% extension
2
-
3
- ## Building and signing
4
-
5
- * `dt-sdk build .`
6
-
7
- ## Running
8
-
9
- * `dt-sdk run`
10
-
11
- ## Developing
12
-
13
- 1. Clone this repository
14
- 2. Install dependencies with `pip install .`
15
- 3. Increase the version under `extension/extension.yaml` after modifications
16
- 4. Run `dt-sdk build`
17
-
18
- ## Structure
19
-
20
- ### %extension_name% folder
21
-
22
- Contains the python code for the extension
23
-
24
- ### extension folder
25
-
26
- Contains the yaml and activation definitions for the framework v2 extension
27
-
28
- ### setup.py
29
-
30
- Contains dependency and other python metadata
31
-
32
- ### activation.json
33
-
1
+ # %extension_name% extension
2
+
3
+ ## Building and signing
4
+
5
+ * `dt-sdk build .`
6
+
7
+ ## Running
8
+
9
+ * `dt-sdk run`
10
+
11
+ ## Developing
12
+
13
+ 1. Clone this repository
14
+ 2. Install dependencies with `pip install .`
15
+ 3. Increase the version under `extension/extension.yaml` after modifications
16
+ 4. Run `dt-sdk build`
17
+
18
+ ## Structure
19
+
20
+ ### %extension_name% folder
21
+
22
+ Contains the python code for the extension
23
+
24
+ ### extension folder
25
+
26
+ Contains the yaml and activation definitions for the framework v2 extension
27
+
28
+ ### setup.py
29
+
30
+ Contains dependency and other python metadata
31
+
32
+ ### activation.json
33
+
34
34
  Used during simulation only, contains the activation definition for the extension
@@ -1,15 +1,15 @@
1
- {
2
- "enabled": true,
3
- "description": "%extension_name% activation",
4
- "version": "0.0.1",
5
- "activationContext": "REMOTE",
6
- "pythonRemote": {
7
- "endpoints": [
8
- {
9
- "url": "http://127.0.0.1:15672",
10
- "user": "guest",
11
- "password": "guest"
12
- }
13
- ]
14
- }
15
- }
1
+ {
2
+ "enabled": true,
3
+ "description": "%extension_name% activation",
4
+ "version": "0.0.1",
5
+ "activationContext": "REMOTE",
6
+ "pythonRemote": {
7
+ "endpoints": [
8
+ {
9
+ "url": "http://127.0.0.1:15672",
10
+ "user": "guest",
11
+ "password": "guest"
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -1,118 +1,118 @@
1
- {
2
- "types": {
3
- "dynatrace.datasource.python:%extension_name%-endpoint": {
4
- "type": "object",
5
- "displayName": "%Extension_Name% Endpoint",
6
- "summaryPattern": "%Extension_Name% {url}",
7
- "properties": {
8
- "url": {
9
- "displayName": "URL",
10
- "type": "text",
11
- "nullable": false,
12
- "default": "",
13
- "constraints": [
14
- {
15
- "type": "LENGTH",
16
- "minLength": 1,
17
- "maxLength": 500
18
- }
19
- ],
20
- "maxItems": 1
21
- },
22
- "user": {
23
- "displayName": "User name",
24
- "type": "text",
25
- "nullable": false,
26
- "default": "",
27
- "constraints": [
28
- {
29
- "type": "LENGTH",
30
- "minLength": 1,
31
- "maxLength": 500
32
- }
33
- ],
34
- "maxItems": 1
35
- },
36
- "password": {
37
- "displayName": "Password",
38
- "type": "secret",
39
- "nullable": false,
40
- "default": "",
41
- "constraints": [
42
- {
43
- "type": "LENGTH",
44
- "minLength": 1,
45
- "maxLength": 500
46
- }
47
- ],
48
- "maxItems": 1
49
- }
50
- }
51
- },
52
- "pythonRemote": {
53
- "type": "object",
54
- "properties": {
55
- "endpoints": {
56
- "displayName": "%Extension_Name% endpoint",
57
- "type": "list",
58
- "items": {
59
- "type": {
60
- "$ref": "#/types/dynatrace.datasource.python:%extension_name%-endpoint"
61
- }
62
- },
63
- "nullable": false,
64
- "minItems": 1,
65
- "maxItems": 100,
66
- "metaData": {
67
- "addItemButton": "Add endpoint"
68
- }
69
- }
70
- }
71
- },
72
- "pythonLocal": {
73
- "type": "object",
74
- "properties": {
75
- "endpoints": {
76
- "displayName": "%Extension_Name% endpoint",
77
- "type": "list",
78
- "items": {
79
- "type": {
80
- "$ref": "#/types/dynatrace.datasource.python:%extension_name%-endpoint"
81
- }
82
- },
83
- "nullable": false,
84
- "minItems": 1,
85
- "maxItems": 100,
86
- "metaData": {
87
- "addItemButton": "Add endpoint"
88
- }
89
- }
90
- }
91
- }
92
- },
93
- "dynatrace": "1",
94
- "description": "%extension_name% configuration",
95
- "schemaId": "python-extension.activation",
96
- "displayName": "%extension_name% configuration",
97
- "ownerProductManagement": "dynatrace",
98
- "ownerDevelopment": "dynatrace",
99
- "maturity": "GENERAL_AVAILABILITY",
100
- "allowedScopes": [
101
- "tenant"
102
- ],
103
- "multiObject": false,
104
- "properties": {
105
- "pythonLocal": {
106
- "displayName": "Python Local Extension",
107
- "type": {
108
- "$ref": "#/types/pythonLocal"
109
- }
110
- },
111
- "pythonRemote": {
112
- "displayName": "Python Remote Extension",
113
- "type": {
114
- "$ref": "#/types/pythonRemote"
115
- }
116
- }
117
- }
118
- }
1
+ {
2
+ "types": {
3
+ "dynatrace.datasource.python:%extension_name%-endpoint": {
4
+ "type": "object",
5
+ "displayName": "%Extension_Name% Endpoint",
6
+ "summaryPattern": "%Extension_Name% {url}",
7
+ "properties": {
8
+ "url": {
9
+ "displayName": "URL",
10
+ "type": "text",
11
+ "nullable": false,
12
+ "default": "",
13
+ "constraints": [
14
+ {
15
+ "type": "LENGTH",
16
+ "minLength": 1,
17
+ "maxLength": 500
18
+ }
19
+ ],
20
+ "maxItems": 1
21
+ },
22
+ "user": {
23
+ "displayName": "User name",
24
+ "type": "text",
25
+ "nullable": false,
26
+ "default": "",
27
+ "constraints": [
28
+ {
29
+ "type": "LENGTH",
30
+ "minLength": 1,
31
+ "maxLength": 500
32
+ }
33
+ ],
34
+ "maxItems": 1
35
+ },
36
+ "password": {
37
+ "displayName": "Password",
38
+ "type": "secret",
39
+ "nullable": false,
40
+ "default": "",
41
+ "constraints": [
42
+ {
43
+ "type": "LENGTH",
44
+ "minLength": 1,
45
+ "maxLength": 500
46
+ }
47
+ ],
48
+ "maxItems": 1
49
+ }
50
+ }
51
+ },
52
+ "pythonRemote": {
53
+ "type": "object",
54
+ "properties": {
55
+ "endpoints": {
56
+ "displayName": "%Extension_Name% endpoint",
57
+ "type": "list",
58
+ "items": {
59
+ "type": {
60
+ "$ref": "#/types/dynatrace.datasource.python:%extension_name%-endpoint"
61
+ }
62
+ },
63
+ "nullable": false,
64
+ "minItems": 1,
65
+ "maxItems": 100,
66
+ "metaData": {
67
+ "addItemButton": "Add endpoint"
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "pythonLocal": {
73
+ "type": "object",
74
+ "properties": {
75
+ "endpoints": {
76
+ "displayName": "%Extension_Name% endpoint",
77
+ "type": "list",
78
+ "items": {
79
+ "type": {
80
+ "$ref": "#/types/dynatrace.datasource.python:%extension_name%-endpoint"
81
+ }
82
+ },
83
+ "nullable": false,
84
+ "minItems": 1,
85
+ "maxItems": 100,
86
+ "metaData": {
87
+ "addItemButton": "Add endpoint"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "dynatrace": "1",
94
+ "description": "%extension_name% configuration",
95
+ "schemaId": "python-extension.activation",
96
+ "displayName": "%extension_name% configuration",
97
+ "ownerProductManagement": "dynatrace",
98
+ "ownerDevelopment": "dynatrace",
99
+ "maturity": "GENERAL_AVAILABILITY",
100
+ "allowedScopes": [
101
+ "tenant"
102
+ ],
103
+ "multiObject": false,
104
+ "properties": {
105
+ "pythonLocal": {
106
+ "displayName": "Python Local Extension",
107
+ "type": {
108
+ "$ref": "#/types/pythonLocal"
109
+ }
110
+ },
111
+ "pythonRemote": {
112
+ "displayName": "Python Remote Extension",
113
+ "type": {
114
+ "$ref": "#/types/pythonRemote"
115
+ }
116
+ }
117
+ }
118
+ }
@@ -1,17 +1,17 @@
1
- name: %extension-prefix%%extension-name%
2
- version: 0.0.1
3
- minDynatraceVersion: "1.285"
4
- author:
5
- name: "Dynatrace"
6
-
7
- python:
8
- runtime:
9
- module: %extension_name%
10
- version:
11
- min: "3.10"
12
-
13
- activation:
14
- remote:
15
- path: activationSchema.json
16
- local:
17
- path: activationSchema.json
1
+ name: %extension-prefix%%extension-name%
2
+ version: 0.0.1
3
+ minDynatraceVersion: "1.285"
4
+ author:
5
+ name: "Dynatrace"
6
+
7
+ python:
8
+ runtime:
9
+ module: %extension_name%
10
+ version:
11
+ min: "3.10"
12
+
13
+ activation:
14
+ remote:
15
+ path: activationSchema.json
16
+ local:
17
+ path: activationSchema.json
@@ -1,43 +1,40 @@
1
- from dynatrace_extension import Extension, Status, StatusValue
2
-
3
-
4
- class ExtensionImpl(Extension):
5
-
6
- def initialize(self):
7
- self.extension_name = "%extension_name%"
8
-
9
- def query(self):
10
- """
11
- The query method is automatically scheduled to run every minute
12
- """
13
- self.logger.info("query method started for %extension_name%.")
14
-
15
- for endpoint in self.activation_config["endpoints"]:
16
- url = endpoint["url"]
17
- user = endpoint["user"]
18
- password = endpoint["password"]
19
- self.logger.debug(f"Running endpoint with url '{url}'")
20
-
21
- # Your extension code goes here, e.g.
22
- # response = requests.get(url, auth=(user, password))
23
-
24
- # Report metrics with
25
- self.report_metric("my_metric", 1, dimensions={"my_dimension": "dimension1"})
26
-
27
- self.logger.info("query method ended for %extension_name%.")
28
-
29
- def fastcheck(self) -> Status:
30
- """
31
- This is called when the extension runs for the first time.
32
- If this AG cannot run this extension, raise an Exception or return StatusValue.ERROR!
33
- """
34
- return Status(StatusValue.OK)
35
-
36
-
37
- def main():
38
- ExtensionImpl().run()
39
-
40
-
41
-
42
- if __name__ == '__main__':
43
- main()
1
+ from dynatrace_extension import Extension, Status, StatusValue
2
+
3
+
4
+ class ExtensionImpl(Extension):
5
+
6
+ def query(self):
7
+ """
8
+ The query method is automatically scheduled to run every minute
9
+ """
10
+ self.logger.info("query method started for %extension_name%.")
11
+
12
+ for endpoint in self.activation_config["endpoints"]:
13
+ url = endpoint["url"]
14
+ user = endpoint["user"]
15
+ password = endpoint["password"]
16
+ self.logger.debug(f"Running endpoint with url '{url}'")
17
+
18
+ # Your extension code goes here, e.g.
19
+ # response = requests.get(url, auth=(user, password))
20
+
21
+ # Report metrics with
22
+ self.report_metric("my_metric", 1, dimensions={"my_dimension": "dimension1"})
23
+
24
+ self.logger.info("query method ended for %extension_name%.")
25
+
26
+ def fastcheck(self) -> Status:
27
+ """
28
+ This is called when the extension runs for the first time.
29
+ If this AG cannot run this extension, raise an Exception or return StatusValue.ERROR!
30
+ """
31
+ return Status(StatusValue.OK)
32
+
33
+
34
+ def main():
35
+ ExtensionImpl(name="%extension_name%").run()
36
+
37
+
38
+
39
+ if __name__ == '__main__':
40
+ main()
@@ -1,28 +1,28 @@
1
- from pathlib import Path
2
- from setuptools import setup, find_packages
3
-
4
-
5
- def find_version() -> str:
6
- version = "0.0.1"
7
- extension_yaml_path = Path(__file__).parent / "extension" / "extension.yaml"
8
- try:
9
- with open(extension_yaml_path, encoding="utf-8") as f:
10
- for line in f:
11
- if line.startswith("version"):
12
- version = line.split(" ")[-1].strip("\"")
13
- break
14
- except Exception:
15
- pass
16
- return version
17
-
18
-
19
- setup(name="%extension_name%",
20
- version=find_version(),
21
- description="%Extension_Name% python EF2 extension",
22
- author="Dynatrace",
23
- packages=find_packages(),
24
- python_requires=">=3.10",
25
- include_package_data=True,
26
- install_requires=["dt-extensions-sdk"],
27
- extras_require={"dev": ["dt-extensions-sdk[cli]"]},
28
- )
1
+ from pathlib import Path
2
+ from setuptools import setup, find_packages
3
+
4
+
5
+ def find_version() -> str:
6
+ version = "0.0.1"
7
+ extension_yaml_path = Path(__file__).parent / "extension" / "extension.yaml"
8
+ try:
9
+ with open(extension_yaml_path, encoding="utf-8") as f:
10
+ for line in f:
11
+ if line.startswith("version"):
12
+ version = line.split(" ")[-1].strip("\"")
13
+ break
14
+ except Exception:
15
+ pass
16
+ return version
17
+
18
+
19
+ setup(name="%extension_name%",
20
+ version=find_version(),
21
+ description="%Extension_Name% python EF2 extension",
22
+ author="Dynatrace",
23
+ packages=find_packages(),
24
+ python_requires=">=3.10",
25
+ include_package_data=True,
26
+ install_requires=["dt-extensions-sdk"],
27
+ extras_require={"dev": ["dt-extensions-sdk[cli]"]},
28
+ )