dt-extensions-sdk 1.1.2__py3-none-any.whl → 1.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dt-extensions-sdk
3
- Version: 1.1.2
3
+ Version: 1.1.4
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
@@ -1,5 +1,4 @@
1
- docs/conf.py,sha256=YNcAnuTe9rU_2ktEHdDLBgr013WMGuDR7kzcxEuVJNY,3582
2
- dynatrace_extension/__about__.py,sha256=LTCxqZ5CmQv5TiXC5xc9ShtE_k0ckZl9evCDDbolXwU,112
1
+ dynatrace_extension/__about__.py,sha256=IeTrkOKcHA89-4qtnstnfbaafbAfO2ayptWZbiaasIg,112
3
2
  dynatrace_extension/__init__.py,sha256=XYHyWducrLWengm6jcCZMYAHzaQwQfoJKzKT4QvhTxE,779
4
3
  dynatrace_extension/cli/__init__.py,sha256=eg2YQkeboIfJ_hcUGp1WFEvT-moa2qGGN-L9RjTbxCM,128
5
4
  dynatrace_extension/cli/main.py,sha256=MbTCwhI3i7l1IcPHMgpbA4DqOZ5kVCtIkouoz5eWYOE,16254
@@ -17,17 +16,18 @@ dynatrace_extension/cli/create/extension_template/extension_name/__main__.py.tem
17
16
  dynatrace_extension/sdk/__init__.py,sha256=sh7MNjmyR0vt-ugkqEHXVqwTNLExfexS0CTK-QnULcw,89
18
17
  dynatrace_extension/sdk/activation.py,sha256=s1ZToshWNptfmgu5NsZCI_WMsNM3-O8CSzzoauo62Uk,1523
19
18
  dynatrace_extension/sdk/callback.py,sha256=ozMUWjWHRMX9baU2HGhaCEw6ZVjN_z6kRM9OaX85Hvw,6306
20
- dynatrace_extension/sdk/communication.py,sha256=xzXXW--0dgvYxmECvZEQ6xI4H1iLCmqbh5p22NSdR40,16486
19
+ dynatrace_extension/sdk/communication.py,sha256=CI6jTFVFhq0Z-cZxHj3oO7wtxAT2ZGEyJZ5DDptO__s,16697
21
20
  dynatrace_extension/sdk/event.py,sha256=oyvcm8uTle-A1jKgXIsFwAvl-Ta2RKbFHVZv3sxTPmo,407
22
- dynatrace_extension/sdk/extension.py,sha256=jCG3V6xh2hu1zcQKHYw87ogpeDAuLcvFSpiBDcDg1LQ,40759
21
+ dynatrace_extension/sdk/extension.py,sha256=LtlKtqOzNwfOyVCwj3d2vO3EH3YNjBwj-TO0LiWgODM,41064
23
22
  dynatrace_extension/sdk/helper.py,sha256=TyL6aSIN6lhoH2yHZw8NbhtixdvlyV5q6fDh5NPODdc,6753
24
23
  dynatrace_extension/sdk/metric.py,sha256=QwrfrmFdj-IddZxAZlZrch62TWKDtzrDU88FwBIv30E,3808
25
24
  dynatrace_extension/sdk/runtime.py,sha256=JgP_qVomatVw85ZuAjbR0S-rzrK5U9JwSZXwfQDKNA4,2869
26
25
  dynatrace_extension/sdk/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ dynatrace_extension/sdk/vendor/mureq/LICENSE,sha256=_rKBhB1pJYXjxjBCdOSIkv_slxWbhEXVBXXZs1MdpQQ,684
27
27
  dynatrace_extension/sdk/vendor/mureq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  dynatrace_extension/sdk/vendor/mureq/mureq.py,sha256=gKzGiPmZ2g74Nb8K_6bu0f2coWZHZiZ2aXGzG2Pimlg,15102
29
- dt_extensions_sdk-1.1.2.dist-info/METADATA,sha256=fkqFYJRwVbSiNUo-IZGo-nE6ww29H6oXJ7gjuIRjj7o,2742
30
- dt_extensions_sdk-1.1.2.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
31
- dt_extensions_sdk-1.1.2.dist-info/entry_points.txt,sha256=pweyOCgENGHjOlT6_kXYaBPOrE3p18K0UettqnNlnoE,55
32
- dt_extensions_sdk-1.1.2.dist-info/licenses/LICENSE.txt,sha256=k7kok_OTpJ5sfb5ANni8wu-Q1lXw8OQjNZXdrTGhFKc,1087
33
- dt_extensions_sdk-1.1.2.dist-info/RECORD,,
29
+ dt_extensions_sdk-1.1.4.dist-info/METADATA,sha256=QYlRMKR1qw9SeazU6f--zcpA3JtXuhlz-eQGBRy8O4o,2742
30
+ dt_extensions_sdk-1.1.4.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
31
+ dt_extensions_sdk-1.1.4.dist-info/entry_points.txt,sha256=pweyOCgENGHjOlT6_kXYaBPOrE3p18K0UettqnNlnoE,55
32
+ dt_extensions_sdk-1.1.4.dist-info/licenses/LICENSE.txt,sha256=k7kok_OTpJ5sfb5ANni8wu-Q1lXw8OQjNZXdrTGhFKc,1087
33
+ dt_extensions_sdk-1.1.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2023-present Dynatrace LLC
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "1.1.2"
4
+ __version__ = "1.1.4"
@@ -92,7 +92,7 @@ class CommunicationClient(ABC):
92
92
  pass
93
93
 
94
94
  @abstractmethod
95
- def send_events(self, event: dict | list[dict]) -> dict | None:
95
+ def send_events(self, event: dict | list[dict], eec_enrichment: bool) -> dict | None:
96
96
  pass
97
97
 
98
98
  @abstractmethod
@@ -275,13 +275,16 @@ class HttpClient(CommunicationClient):
275
275
  responses.append(mint_response)
276
276
  return responses
277
277
 
278
- def send_events(self, events: dict | list[dict]) -> dict | None:
278
+ def send_events(self, events: dict | list[dict], eec_enrichment: bool = True) -> dict | None:
279
279
  self.logger.debug(f"Sending log events: {events}")
280
280
  event_data = json.dumps(events).encode("utf-8")
281
281
  try:
282
282
  # EEC returns empty body on success
283
283
  return self._make_request(
284
- self._events_url, "POST", event_data, extra_headers={"Content-Type": CONTENT_TYPE_JSON}
284
+ self._events_url,
285
+ "POST",
286
+ event_data,
287
+ extra_headers={"Content-Type": CONTENT_TYPE_JSON, "eec-enrichment": str(eec_enrichment).lower()},
285
288
  ).json()
286
289
  except json.JSONDecodeError:
287
290
  return None
@@ -394,8 +397,8 @@ class DebugClient(CommunicationClient):
394
397
  responses = [MintResponse(lines_invalid=0, lines_ok=len(mint_lines), error=None, warnings=None)]
395
398
  return responses
396
399
 
397
- def send_events(self, events: dict | list[dict]) -> dict | None:
398
- self.logger.info(f"send_events: {events}")
400
+ def send_events(self, events: dict | list[dict], eec_enrichment: bool = True) -> dict | None:
401
+ self.logger.info(f"send_events (enrichment = {eec_enrichment}): {events}")
399
402
  return None
400
403
 
401
404
  def send_sfm_metrics(self, mint_lines: list[str]) -> MintResponse:
@@ -173,6 +173,9 @@ class Extension:
173
173
  self._task_id = "development_task_id"
174
174
  self._monitoring_config_id = "development_config_id"
175
175
 
176
+ # The user can override default EEC enrichment for logs
177
+ self.log_event_enrichment = True
178
+
176
179
  # The Communication client
177
180
  self._client: CommunicationClient = None # type: ignore
178
181
 
@@ -456,6 +459,10 @@ class Extension:
456
459
  if "dt.techrule.id" not in dimensions:
457
460
  dimensions["dt.techrule.id"] = techrule
458
461
 
462
+ if metric_type == MetricType.COUNT and timestamp is None:
463
+ # We must report a timestamp for count metrics
464
+ timestamp = datetime.now()
465
+
459
466
  metric = Metric(key=key, value=value, dimensions=dimensions, metric_type=metric_type, timestamp=timestamp)
460
467
  self._add_metric(metric)
461
468
 
@@ -984,7 +991,7 @@ class Extension:
984
991
  self._metrics.extend(lines)
985
992
 
986
993
  def _send_events_internal(self, events: Union[dict, List[dict]]):
987
- response = self._client.send_events(events)
994
+ response = self._client.send_events(events, self.log_event_enrichment)
988
995
  with self._internal_callbacks_results_lock:
989
996
  self._internal_callbacks_results[self._send_events.__name__] = Status(StatusValue.OK)
990
997
  if not response or "error" not in response or "message" not in response["error"]:
@@ -0,0 +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
14
+ PERFORMANCE OF THIS SOFTWARE.
docs/conf.py DELETED
@@ -1,98 +0,0 @@
1
- # Configuration file for the Sphinx documentation builder.
2
- #
3
- # This file only contains a selection of the most common options. For a full
4
- # list see the documentation:
5
- # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
-
7
- # -- Path setup --------------------------------------------------------------
8
-
9
- # If extensions (or modules to document with autodoc) are in another directory,
10
- # add these directories to sys.path here. If the directory is relative to the
11
- # documentation root, use os.path.abspath to make it absolute, like shown here.
12
- #
13
- import os
14
- import sys
15
- from datetime import datetime
16
-
17
- sys.path.insert(0, os.path.abspath("."))
18
-
19
-
20
- # -- Project information -----------------------------------------------------
21
- project = "dt-sdk"
22
- copyright = f"2023–{datetime.now().year}, Dynatrace LLC"
23
- author = "Dynatrace"
24
-
25
- # Short version
26
- version = "1.0.0"
27
- # The full version, including alpha/beta/rc tags
28
- release = version
29
-
30
- # The language for content autogenerated by Sphinx. Refer to documentation
31
- # for a list of supported languages.
32
- #
33
- # This is also used if you do content translation via gettext catalogs.
34
- # Usually you set "language" from the command line for these cases.
35
- language = "en"
36
-
37
-
38
- # -- General configuration ---------------------------------------------------
39
-
40
- # Add any Sphinx extension module names here, as strings. They can be
41
- # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42
- # ones.
43
- extensions = [
44
- "sphinx.ext.autodoc",
45
- "sphinx.ext.napoleon",
46
- "sphinx.ext.viewcode",
47
- "sphinx.ext.autosectionlabel",
48
- "sphinx_wagtail_theme",
49
- "sphinxcontrib.programoutput",
50
- ]
51
-
52
- # Add any paths that contain templates here, relative to this directory.
53
- templates_path = ["_templates"]
54
-
55
- # List of patterns, relative to source directory, that match files and
56
- # directories to ignore when looking for source files.
57
- # This pattern also affects html_static_path and html_extra_path.
58
- exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
59
-
60
- # True to prefix each section label with the name of the document it is in,
61
- # followed by a colon. For example, index:Introduction for a section called
62
- # Introduction that appears in document index.rst. Useful for avoiding
63
- # ambiguity when the same section heading appears in different documents.
64
- autosectionlabel_prefix_document = True
65
-
66
- # -- Autodoc -----------------------------------------------------------------
67
-
68
- autodoc_default_options = {"member-order": "bysource", "undoc-members": True}
69
-
70
- # -- Options for HTML output -------------------------------------------------
71
-
72
- # The theme to use for HTML and HTML Help pages. See the documentation for
73
- # a list of builtin themes.
74
- #
75
- html_theme = "sphinx_wagtail_theme"
76
- html_favicon = "_static/favicon.ico"
77
- html_show_copyright = True
78
-
79
- # Add any paths that contain custom static files (such as style sheets) here,
80
- # relative to this directory. They are copied after the builtin static files,
81
- # so a file named "default.css" will overwrite the builtin "default.css".
82
- html_static_path = ["_static"]
83
-
84
- # html_sidebars = {"**": ["search-field.html", "sidebar-nav-bs.html"]}
85
-
86
- html_theme_options = {
87
- "project_name": "dt-sdk",
88
- "logo": "dt-sdk-logo.png",
89
- "logo_alt": "dt-sdk",
90
- "logo_url": "/",
91
- "github_url": "https://github.com/dynatrace-extensions/dt-extensions-python-sdk",
92
- "footer_links": ",".join(
93
- [
94
- "Dynatrace|https://dynatrace.com/",
95
- "Extensions Team|mailto:extenions@dynatrace.com",
96
- ]
97
- ),
98
- }