dt-extensions-sdk 1.2.13__py3-none-any.whl → 1.3.0__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.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/METADATA +2 -3
- {dt_extensions_sdk-1.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/RECORD +12 -11
- {dt_extensions_sdk-1.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/WHEEL +1 -1
- dynatrace_extension/__about__.py +1 -1
- dynatrace_extension/cli/create/extension_template/.gitignore.template +3 -0
- dynatrace_extension/cli/create/extension_template/activation.json.template +1 -1
- dynatrace_extension/cli/create/extension_template/secrets.json.template +3 -0
- dynatrace_extension/cli/main.py +11 -1
- dynatrace_extension/sdk/communication.py +17 -1
- dynatrace_extension/sdk/extension.py +3 -1
- {dt_extensions_sdk-1.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/entry_points.txt +0 -0
- {dt_extensions_sdk-1.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,12 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: dt-extensions-sdk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.0
|
4
4
|
Project-URL: Documentation, https://github.com/dynatrace-extensions/dt-extensions-python-sdk#readme
|
5
5
|
Project-URL: Issues, https://github.com/dynatrace-extensions/dt-extensions-python-sdk/issues
|
6
6
|
Project-URL: Source, https://github.com/dynatrace-extensions/dt-extensions-python-sdk
|
7
7
|
Author-email: dlopes7 <davidribeirolopes@gmail.com>
|
8
|
-
License
|
9
|
-
License-File: LICENSE.txt
|
8
|
+
License: MIT
|
10
9
|
Classifier: Development Status :: 4 - Beta
|
11
10
|
Classifier: Programming Language :: Python
|
12
11
|
Classifier: Programming Language :: Python :: 3.10
|
@@ -1,13 +1,14 @@
|
|
1
|
-
dynatrace_extension/__about__.py,sha256=
|
1
|
+
dynatrace_extension/__about__.py,sha256=UOSMeuvYrIEfkKMe5OPGxqTQkGJsMCvBMaw2t3yMuJ4,110
|
2
2
|
dynatrace_extension/__init__.py,sha256=BvQuknmA7ti3WJi3zEXZfY7aAxJrie37VNitWICsUvI,752
|
3
3
|
dynatrace_extension/cli/__init__.py,sha256=HCboY_eJPoqjFmoPDsBL8Jk6aNvank8K7JpkVrgwzUM,123
|
4
|
-
dynatrace_extension/cli/main.py,sha256=
|
4
|
+
dynatrace_extension/cli/main.py,sha256=Z8gFcp0vIMBkzV6jUd5mwvP1U0JcLqAHoMLJw_6puz4,18260
|
5
5
|
dynatrace_extension/cli/schema.py,sha256=d8wKUodRiaU3hfSZDWVNpD15lBfhmif2oQ-k07IxcaA,3230
|
6
6
|
dynatrace_extension/cli/create/__init__.py,sha256=NfyOJCVlxs8dYtfDAMHS1Q5SJTuZcFzOg5rtaI-ZPRE,72
|
7
7
|
dynatrace_extension/cli/create/create.py,sha256=apXden2M93MDDDm7aa-Os-AEtUtyKbk_PsS56j32NK4,2708
|
8
|
-
dynatrace_extension/cli/create/extension_template/.gitignore.template,sha256=
|
8
|
+
dynatrace_extension/cli/create/extension_template/.gitignore.template,sha256=FPye23W8dqmked4HQBCDCAKFf1UbBGkwhKjQpgmXhdg,3101
|
9
9
|
dynatrace_extension/cli/create/extension_template/README.md.template,sha256=QcV0fYqJ1PHaouKdGQgzveJY5zAFBSICp7xSfgnoQj0,637
|
10
|
-
dynatrace_extension/cli/create/extension_template/activation.json.template,sha256=
|
10
|
+
dynatrace_extension/cli/create/extension_template/activation.json.template,sha256=qX-Fgq_JhUWNYMe1-RMcjwQPzF4scJYGfGlBr043UiY,266
|
11
|
+
dynatrace_extension/cli/create/extension_template/secrets.json.template,sha256=fr-ya8lR0TiUmr6lf-PFko6RZw6sr54FxtMbqIWBVkA,36
|
11
12
|
dynatrace_extension/cli/create/extension_template/setup.py.template,sha256=M4HPg3UFkvmWFHAz6vHbDG5Ocb-ZiR0TQuLt9eedW1M,846
|
12
13
|
dynatrace_extension/cli/create/extension_template/extension/activationSchema.json.template,sha256=me3DL_Q449q4VaOStTqaBL-gUkKnlafC8L2093O0LOY,2905
|
13
14
|
dynatrace_extension/cli/create/extension_template/extension/extension.yaml.template,sha256=qDyAURGXKsZBIPjW2s1BPhD-xOC8_FoBgA33HbsOkAU,299
|
@@ -16,9 +17,9 @@ dynatrace_extension/cli/create/extension_template/extension_name/__main__.py.tem
|
|
16
17
|
dynatrace_extension/sdk/__init__.py,sha256=RsqQ1heGyCmSK3fhuEKAcxQIRCg4gEK0-eSkIehL5Nc,86
|
17
18
|
dynatrace_extension/sdk/activation.py,sha256=goTbT1tD2kn8xfyXFdTy_cTZNcFPJpgbvQM8HOzKECA,1480
|
18
19
|
dynatrace_extension/sdk/callback.py,sha256=PNRvOVzNpKvpsa0wCf7HRDkfo3wMsF2otVWI9a1AAkU,6307
|
19
|
-
dynatrace_extension/sdk/communication.py,sha256=
|
20
|
+
dynatrace_extension/sdk/communication.py,sha256=GVxIdLvhJW7mr1HHoS3qILGx7MNZm1ujocBrNYbfnUc,18494
|
20
21
|
dynatrace_extension/sdk/event.py,sha256=J261imbFKpxfuAQ6Nfu3RRcsIQKKivy6fme1nww2g-8,388
|
21
|
-
dynatrace_extension/sdk/extension.py,sha256=
|
22
|
+
dynatrace_extension/sdk/extension.py,sha256=gwESrAhlTtlJO-VfRFtfevmzDbd81Dj9r00u-kqs0iQ,42940
|
22
23
|
dynatrace_extension/sdk/helper.py,sha256=ZNrO9ao2hE3KQ934vAYD74k0fCr6QTG-_bAvbk9-hi8,6562
|
23
24
|
dynatrace_extension/sdk/metric.py,sha256=7VClzJCFJNDCxA-d69uTu1pdPtDZBTwq7fbafs_L6nQ,3690
|
24
25
|
dynatrace_extension/sdk/runtime.py,sha256=jyYsM1x-gMnW68eWq8IoZZZBarHgIcr_nVeGDDgpRDk,2802
|
@@ -27,8 +28,8 @@ dynatrace_extension/sdk/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
27
28
|
dynatrace_extension/sdk/vendor/mureq/LICENSE,sha256=8AVcgZgiT_mvK1fOofXtRRr2f1dRXS_K21NuxQgP4VM,671
|
28
29
|
dynatrace_extension/sdk/vendor/mureq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
30
|
dynatrace_extension/sdk/vendor/mureq/mureq.py,sha256=znF4mvzk5L03CLNozRz8UpK-fMijmSkObDFwlbhwLUg,14656
|
30
|
-
dt_extensions_sdk-1.
|
31
|
-
dt_extensions_sdk-1.
|
32
|
-
dt_extensions_sdk-1.
|
33
|
-
dt_extensions_sdk-1.
|
34
|
-
dt_extensions_sdk-1.
|
31
|
+
dt_extensions_sdk-1.3.0.dist-info/METADATA,sha256=qyJXkr0QueRXicxxBHw_wO4X9gNQsHGZf0DelNJUabM,2648
|
32
|
+
dt_extensions_sdk-1.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
33
|
+
dt_extensions_sdk-1.3.0.dist-info/entry_points.txt,sha256=pweyOCgENGHjOlT6_kXYaBPOrE3p18K0UettqnNlnoE,55
|
34
|
+
dt_extensions_sdk-1.3.0.dist-info/licenses/LICENSE.txt,sha256=3Zihv0lOVYHNfDkJC-tUAU6euP9r2NexsDW4w-zqgVk,1078
|
35
|
+
dt_extensions_sdk-1.3.0.dist-info/RECORD,,
|
dynatrace_extension/__about__.py
CHANGED
dynatrace_extension/cli/main.py
CHANGED
@@ -40,6 +40,7 @@ def version():
|
|
40
40
|
def run(
|
41
41
|
extension_dir: Path = typer.Argument("."),
|
42
42
|
activation_config: str = "activation.json",
|
43
|
+
secrets: str = "secrets.json",
|
43
44
|
fast_check: bool = typer.Option(False, "--fastcheck"),
|
44
45
|
local_ingest: bool = typer.Option(False, "--local-ingest"),
|
45
46
|
local_ingest_port: int = typer.Option(14499, "--local-ingest-port"),
|
@@ -50,6 +51,7 @@ def run(
|
|
50
51
|
|
51
52
|
:param extension_dir: The directory of the extension, by default this is the current directory
|
52
53
|
:param activation_config: The activation config file, by default this is activation.json
|
54
|
+
:param secrets: The secrets file to be used to enrich the activation config, by default this is secrets.json
|
53
55
|
:param fast_check: If true, run a fastcheck and exits
|
54
56
|
:param local_ingest: If true, send metrics to localhost:14499 on top of printing them
|
55
57
|
:param local_ingest_port: The port to send metrics to, by default this is 14499
|
@@ -59,7 +61,15 @@ def run(
|
|
59
61
|
# This parses the yaml, which validates it before running
|
60
62
|
extension_yaml = ExtensionYaml(extension_dir / "extension/extension.yaml")
|
61
63
|
try:
|
62
|
-
command = [
|
64
|
+
command = [
|
65
|
+
sys.executable,
|
66
|
+
"-m",
|
67
|
+
extension_yaml.python.runtime.module,
|
68
|
+
"--activationconfig",
|
69
|
+
activation_config,
|
70
|
+
"--secrets",
|
71
|
+
secrets,
|
72
|
+
]
|
63
73
|
if fast_check:
|
64
74
|
command.append("--fastcheck")
|
65
75
|
if local_ingest:
|
@@ -324,14 +324,24 @@ class DebugClient(CommunicationClient):
|
|
324
324
|
activation_config_path: str,
|
325
325
|
extension_config_path: str,
|
326
326
|
logger: logging.Logger,
|
327
|
+
secrets_path: str = "secrets.json",
|
327
328
|
local_ingest: bool = False,
|
328
329
|
local_ingest_port: int = 14499,
|
329
330
|
print_metrics: bool = True,
|
330
331
|
):
|
332
|
+
|
333
|
+
self.secrets = {}
|
334
|
+
if secrets_path and Path(secrets_path).exists():
|
335
|
+
with open(secrets_path) as f:
|
336
|
+
self.secrets = json.load(f)
|
337
|
+
|
331
338
|
self.activation_config = {}
|
332
339
|
if activation_config_path and Path(activation_config_path).exists():
|
333
340
|
with open(activation_config_path) as f:
|
334
|
-
|
341
|
+
raw_activation_config = f.read()
|
342
|
+
self.activation_config = json.loads(
|
343
|
+
self.replace_secrets_in_activation_config(self.secrets, raw_activation_config)
|
344
|
+
)
|
335
345
|
|
336
346
|
self.extension_config = ""
|
337
347
|
if not extension_config_path:
|
@@ -430,6 +440,12 @@ class DebugClient(CommunicationClient):
|
|
430
440
|
def get_cluster_time_diff(self) -> int:
|
431
441
|
return 0
|
432
442
|
|
443
|
+
def replace_secrets_in_activation_config(self, secrets: dict, activation_config_string: str) -> str:
|
444
|
+
for secret_name, secret_value in secrets.items():
|
445
|
+
activation_config_string = activation_config_string.replace(f"{{{{{secret_name}}}}}", str(secret_value))
|
446
|
+
|
447
|
+
return activation_config_string
|
448
|
+
|
433
449
|
|
434
450
|
def divide_into_batches(
|
435
451
|
items: Sequence[dict | str], max_size_bytes: int, join_with: str | None = None
|
@@ -715,6 +715,7 @@ class Extension:
|
|
715
715
|
# Debug parameters, these are used when running the extension locally
|
716
716
|
parser.add_argument("--extensionconfig", required=False, default=None)
|
717
717
|
parser.add_argument("--activationconfig", required=False, default="activation.json")
|
718
|
+
parser.add_argument("--secrets", required=False, default="secrets.json")
|
718
719
|
parser.add_argument("--no-print-metrics", required=False, action="store_true")
|
719
720
|
|
720
721
|
args, unknown = parser.parse_known_args()
|
@@ -727,6 +728,7 @@ class Extension:
|
|
727
728
|
activation_config_path=args.activationconfig,
|
728
729
|
extension_config_path=args.extensionconfig,
|
729
730
|
logger=api_logger,
|
731
|
+
secrets_path=args.secrets,
|
730
732
|
local_ingest=args.local_ingest,
|
731
733
|
local_ingest_port=args.local_ingest_port,
|
732
734
|
print_metrics=print_metrics,
|
@@ -748,6 +750,7 @@ class Extension:
|
|
748
750
|
|
749
751
|
if not self._is_fastcheck:
|
750
752
|
try:
|
753
|
+
self._heartbeat_iteration()
|
751
754
|
self.initialize()
|
752
755
|
if not self.is_helper:
|
753
756
|
self.schedule(self.query, timedelta(minutes=1))
|
@@ -813,7 +816,6 @@ class Extension:
|
|
813
816
|
# These were scheduled before the extension started, schedule them now
|
814
817
|
for callback in self._scheduled_callbacks_before_run:
|
815
818
|
self._schedule_callback(callback)
|
816
|
-
self._heartbeat_iteration()
|
817
819
|
self._metrics_iteration()
|
818
820
|
self._sfm_metrics_iteration()
|
819
821
|
self._timediff_iteration()
|
File without changes
|
{dt_extensions_sdk-1.2.13.dist-info → dt_extensions_sdk-1.3.0.dist-info}/licenses/LICENSE.txt
RENAMED
File without changes
|