timeexecution 8.4.0__tar.gz → 8.4.2__tar.gz

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 (41) hide show
  1. {timeexecution-8.4.0 → timeexecution-8.4.2}/.github/workflows/tests.yml +2 -2
  2. {timeexecution-8.4.0/timeexecution.egg-info → timeexecution-8.4.2}/PKG-INFO +15 -5
  3. {timeexecution-8.4.0 → timeexecution-8.4.2}/pyproject.toml +1 -1
  4. {timeexecution-8.4.0 → timeexecution-8.4.2}/requirements.txt +1 -1
  5. {timeexecution-8.4.0 → timeexecution-8.4.2}/setup.py +3 -3
  6. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/test_elasticsearch.py +6 -1
  7. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/test_hooks.py +1 -1
  8. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/backends/elasticsearch.py +17 -7
  9. {timeexecution-8.4.0 → timeexecution-8.4.2/timeexecution.egg-info}/PKG-INFO +15 -5
  10. {timeexecution-8.4.0 → timeexecution-8.4.2}/timeexecution.egg-info/SOURCES.txt +2 -0
  11. {timeexecution-8.4.0 → timeexecution-8.4.2}/timeexecution.egg-info/requires.txt +2 -2
  12. timeexecution-8.4.2/timeexecution.egg-info/scm_file_list.json +36 -0
  13. timeexecution-8.4.2/timeexecution.egg-info/scm_version.json +8 -0
  14. {timeexecution-8.4.0 → timeexecution-8.4.2}/tox.ini +2 -2
  15. {timeexecution-8.4.0 → timeexecution-8.4.2}/.editorconfig +0 -0
  16. {timeexecution-8.4.0 → timeexecution-8.4.2}/.gitchangelog.rc +0 -0
  17. {timeexecution-8.4.0 → timeexecution-8.4.2}/.github/workflows/lint.yml +0 -0
  18. {timeexecution-8.4.0 → timeexecution-8.4.2}/.github/workflows/publish.yml +0 -0
  19. {timeexecution-8.4.0 → timeexecution-8.4.2}/.gitignore +0 -0
  20. {timeexecution-8.4.0 → timeexecution-8.4.2}/CHANGELOG.md +0 -0
  21. {timeexecution-8.4.0 → timeexecution-8.4.2}/LICENSE +0 -0
  22. {timeexecution-8.4.0 → timeexecution-8.4.2}/MANIFEST.in +0 -0
  23. {timeexecution-8.4.0 → timeexecution-8.4.2}/Makefile +0 -0
  24. {timeexecution-8.4.0 → timeexecution-8.4.2}/README.md +0 -0
  25. {timeexecution-8.4.0 → timeexecution-8.4.2}/setup.cfg +0 -0
  26. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/__init__.py +0 -0
  27. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/conftest.py +0 -0
  28. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/dummy_process.py +0 -0
  29. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/test_base_backend.py +0 -0
  30. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/test_decorator_async.py +0 -0
  31. {timeexecution-8.4.0 → timeexecution-8.4.2}/tests/test_threaded_backend.py +0 -0
  32. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/__init__.py +0 -0
  33. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/backends/__init__.py +0 -0
  34. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/backends/base.py +0 -0
  35. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/backends/threaded.py +0 -0
  36. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/decorator.py +0 -0
  37. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/py.typed +0 -0
  38. {timeexecution-8.4.0 → timeexecution-8.4.2}/time_execution/timed.py +0 -0
  39. {timeexecution-8.4.0 → timeexecution-8.4.2}/timeexecution.egg-info/dependency_links.txt +0 -0
  40. {timeexecution-8.4.0 → timeexecution-8.4.2}/timeexecution.egg-info/not-zip-safe +0 -0
  41. {timeexecution-8.4.0 → timeexecution-8.4.2}/timeexecution.egg-info/top_level.txt +0 -0
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
17
+ python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
18
18
  steps:
19
19
  - uses: actions/checkout@v2
20
20
  - name: Set up Python ${{ matrix.python-version }}
@@ -22,7 +22,7 @@ jobs:
22
22
  with:
23
23
  python-version: ${{ matrix.python-version }}
24
24
  - name: Install Tox and other dependencies
25
- run: pip install tox tox-docker wheel twine 'setuptools; python_version >= "3.12"'
25
+ run: pip install tox tox-docker wheel twine 'setuptools; python_version >= "3.12"' 'vcs-versioning; python_version >= "3.12"'
26
26
  - name: Run tests with Tox
27
27
  # Run tox using the version of Python in `PATH`
28
28
  run: tox -e py
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: timeexecution
3
- Version: 8.4.0
3
+ Version: 8.4.2
4
4
  Summary: Python project
5
5
  Home-page: https://github.com/kpn/py-timeexecution
6
6
  Author: KPN DE Platform
@@ -12,11 +12,11 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Topic :: Internet :: WWW/HTTP
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Description-Content-Type: text/markdown
@@ -25,9 +25,19 @@ Requires-Dist: pkgsettings>=0.9.2
25
25
  Requires-Dist: fqn-decorators<3.0.0,>=1.2.5
26
26
  Requires-Dist: typing-extensions<5.0.0,>=4.5.0
27
27
  Provides-Extra: all
28
- Requires-Dist: elasticsearch<9.0.0,>=8.0.0; extra == "all"
28
+ Requires-Dist: elasticsearch<10.0.0,>=8.0.0; extra == "all"
29
29
  Provides-Extra: elasticsearch
30
- Requires-Dist: elasticsearch<9.0.0,>=8.0.0; extra == "elasticsearch"
30
+ Requires-Dist: elasticsearch<10.0.0,>=8.0.0; extra == "elasticsearch"
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: license-file
38
+ Dynamic: provides-extra
39
+ Dynamic: requires-dist
40
+ Dynamic: summary
31
41
 
32
42
  # Time Execution
33
43
 
@@ -1,6 +1,6 @@
1
1
  [tool.black]
2
2
  line-length = 120
3
- target_version = ["py38", "py39", "py310", "py311", "py312"]
3
+ target_version = ["py39", "py310", "py311", "py312", "py313"]
4
4
 
5
5
  [tool.isort]
6
6
  combine_as_imports = true
@@ -11,7 +11,7 @@ mock
11
11
  isort
12
12
  black
13
13
  flake8
14
- mypy
14
+ mypy<2.0.0
15
15
 
16
16
  # Distribution
17
17
  setuptools; python_version >= "3.12"
@@ -24,8 +24,8 @@ setup(
24
24
  "typing-extensions>=4.5.0,<5.0.0",
25
25
  ],
26
26
  extras_require={
27
- "all": ["elasticsearch>=8.0.0,<9.0.0"],
28
- "elasticsearch": ["elasticsearch>=8.0.0,<9.0.0"],
27
+ "all": ["elasticsearch>=8.0.0,<10.0.0"],
28
+ "elasticsearch": ["elasticsearch>=8.0.0,<10.0.0"],
29
29
  },
30
30
  packages=find_packages(exclude=["tests*"]),
31
31
  tests_require=["tox"],
@@ -39,11 +39,11 @@ setup(
39
39
  "License :: OSI Approved :: Apache Software License",
40
40
  "Programming Language :: Python",
41
41
  "Programming Language :: Python :: 3",
42
- "Programming Language :: Python :: 3.8",
43
42
  "Programming Language :: Python :: 3.9",
44
43
  "Programming Language :: Python :: 3.10",
45
44
  "Programming Language :: Python :: 3.11",
46
45
  "Programming Language :: Python :: 3.12",
46
+ "Programming Language :: Python :: 3.13",
47
47
  "Topic :: Internet :: WWW/HTTP",
48
48
  "Topic :: Software Development :: Libraries :: Python Modules",
49
49
  ],
@@ -129,6 +129,7 @@ class TestTimeExecution(BaseTestTimeExecutionElasticSearch):
129
129
  "writing metric %r failure %r",
130
130
  {
131
131
  "timestamp": datetime(2016, 7, 13),
132
+ "@timestamp": datetime(2016, 7, 13),
132
133
  "value": None,
133
134
  "name": "test:metric",
134
135
  },
@@ -159,7 +160,11 @@ class TestTimeExecution(BaseTestTimeExecutionElasticSearch):
159
160
  "time_execution.backends.elasticsearch.Elasticsearch.bulk",
160
161
  side_effect=transport_error,
161
162
  )
162
- metrics = [1, 2, 3]
163
+ metrics = [
164
+ {"name": "metric.name", "value": 1, "timestamp": 1},
165
+ {"name": "metric.name", "value": 2, "timestamp": 2},
166
+ {"name": "metric.name", "value": 3, "timestamp": 3},
167
+ ]
163
168
  with es_index_error_ctx:
164
169
  self.backend.bulk_write(metrics)
165
170
  mocked_logger.warning.assert_called_once_with("bulk_write metrics %r failure %r", metrics, transport_error)
@@ -269,7 +269,7 @@ class TestTimeExecution:
269
269
  assert func_args == (42,)
270
270
  assert func_kwargs == {"bar": 100500}
271
271
  assert not is_started, "the decorated function should not run just yet"
272
- (response, _exception, _metrics) = yield
272
+ response, _exception, _metrics = yield
273
273
  assert is_started
274
274
  assert response == "response"
275
275
  return {"key": "value"}
@@ -1,8 +1,8 @@
1
1
  import logging
2
- from datetime import datetime
2
+ from datetime import datetime, timezone
3
3
 
4
4
  from elasticsearch import Elasticsearch
5
- from elasticsearch.exceptions import TransportError
5
+ from elasticsearch.exceptions import BadRequestError, TransportError
6
6
 
7
7
  from time_execution.backends.base import BaseMetricsBackend
8
8
 
@@ -29,7 +29,7 @@ class ElasticsearchBackend(BaseMetricsBackend):
29
29
  self.client = Elasticsearch(hosts=hosts, *args, **kwargs)
30
30
 
31
31
  def get_index(self):
32
- return self.index_pattern.format(index=self.index, date=datetime.now())
32
+ return self.index_pattern.format(index=self.index, date=datetime.now(timezone.utc).replace(tzinfo=None))
33
33
 
34
34
  def write(self, name, **data):
35
35
  """
@@ -41,20 +41,24 @@ class ElasticsearchBackend(BaseMetricsBackend):
41
41
  """
42
42
 
43
43
  data["name"] = name
44
+ now = datetime.now(timezone.utc).replace(tzinfo=None)
44
45
  if not ("timestamp" in data):
45
- data["timestamp"] = datetime.utcnow()
46
+ data["timestamp"] = now
47
+ if not ("@timestamp" in data):
48
+ data["@timestamp"] = now
46
49
 
47
50
  try:
48
51
  index_params = {
49
52
  "index": self.get_index(),
50
53
  "id": None,
51
54
  "body": data,
55
+ "op_type": "create",
52
56
  }
53
57
  if self.pipeline:
54
58
  index_params["pipeline"] = self.pipeline
55
59
 
56
60
  self.client.index(**index_params)
57
- except TransportError as exc:
61
+ except (BadRequestError, TransportError) as exc:
58
62
  logger.warning("writing metric %r failure %r", data, exc)
59
63
 
60
64
  def bulk_write(self, metrics):
@@ -66,8 +70,14 @@ class ElasticsearchBackend(BaseMetricsBackend):
66
70
  """
67
71
  actions = []
68
72
  index = self.get_index()
73
+ now = datetime.now(timezone.utc).replace(tzinfo=None)
69
74
  for metric in metrics:
70
- actions.append({"index": {"_index": index}})
75
+ if not ("timestamp" in metric):
76
+ metric["timestamp"] = now
77
+ if not ("@timestamp" in metric):
78
+ metric["@timestamp"] = now
79
+
80
+ actions.append({"create": {"_index": index}})
71
81
  actions.append(metric)
72
82
 
73
83
  bulk_params = {"operations": actions}
@@ -76,5 +86,5 @@ class ElasticsearchBackend(BaseMetricsBackend):
76
86
 
77
87
  try:
78
88
  self.client.bulk(**bulk_params)
79
- except TransportError as exc:
89
+ except (BadRequestError, TransportError) as exc:
80
90
  logger.warning("bulk_write metrics %r failure %r", metrics, exc)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: timeexecution
3
- Version: 8.4.0
3
+ Version: 8.4.2
4
4
  Summary: Python project
5
5
  Home-page: https://github.com/kpn/py-timeexecution
6
6
  Author: KPN DE Platform
@@ -12,11 +12,11 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
15
  Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Topic :: Internet :: WWW/HTTP
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Description-Content-Type: text/markdown
@@ -25,9 +25,19 @@ Requires-Dist: pkgsettings>=0.9.2
25
25
  Requires-Dist: fqn-decorators<3.0.0,>=1.2.5
26
26
  Requires-Dist: typing-extensions<5.0.0,>=4.5.0
27
27
  Provides-Extra: all
28
- Requires-Dist: elasticsearch<9.0.0,>=8.0.0; extra == "all"
28
+ Requires-Dist: elasticsearch<10.0.0,>=8.0.0; extra == "all"
29
29
  Provides-Extra: elasticsearch
30
- Requires-Dist: elasticsearch<9.0.0,>=8.0.0; extra == "elasticsearch"
30
+ Requires-Dist: elasticsearch<10.0.0,>=8.0.0; extra == "elasticsearch"
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: license-file
38
+ Dynamic: provides-extra
39
+ Dynamic: requires-dist
40
+ Dynamic: summary
31
41
 
32
42
  # Time Execution
33
43
 
@@ -35,4 +35,6 @@ timeexecution.egg-info/SOURCES.txt
35
35
  timeexecution.egg-info/dependency_links.txt
36
36
  timeexecution.egg-info/not-zip-safe
37
37
  timeexecution.egg-info/requires.txt
38
+ timeexecution.egg-info/scm_file_list.json
39
+ timeexecution.egg-info/scm_version.json
38
40
  timeexecution.egg-info/top_level.txt
@@ -3,7 +3,7 @@ fqn-decorators<3.0.0,>=1.2.5
3
3
  typing-extensions<5.0.0,>=4.5.0
4
4
 
5
5
  [all]
6
- elasticsearch<9.0.0,>=8.0.0
6
+ elasticsearch<10.0.0,>=8.0.0
7
7
 
8
8
  [elasticsearch]
9
- elasticsearch<9.0.0,>=8.0.0
9
+ elasticsearch<10.0.0,>=8.0.0
@@ -0,0 +1,36 @@
1
+ {
2
+ "files": [
3
+ ".editorconfig",
4
+ ".gitchangelog.rc",
5
+ ".github/workflows/lint.yml",
6
+ ".github/workflows/publish.yml",
7
+ ".github/workflows/tests.yml",
8
+ ".gitignore",
9
+ "CHANGELOG.md",
10
+ "LICENSE",
11
+ "MANIFEST.in",
12
+ "Makefile",
13
+ "README.md",
14
+ "pyproject.toml",
15
+ "requirements.txt",
16
+ "setup.cfg",
17
+ "setup.py",
18
+ "tests/__init__.py",
19
+ "tests/conftest.py",
20
+ "tests/dummy_process.py",
21
+ "tests/test_base_backend.py",
22
+ "tests/test_decorator_async.py",
23
+ "tests/test_elasticsearch.py",
24
+ "tests/test_hooks.py",
25
+ "tests/test_threaded_backend.py",
26
+ "time_execution/__init__.py",
27
+ "time_execution/backends/__init__.py",
28
+ "time_execution/backends/base.py",
29
+ "time_execution/backends/elasticsearch.py",
30
+ "time_execution/backends/threaded.py",
31
+ "time_execution/decorator.py",
32
+ "time_execution/py.typed",
33
+ "time_execution/timed.py",
34
+ "tox.ini"
35
+ ]
36
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "8.4.2",
3
+ "distance": 0,
4
+ "node": "gcb99c0d72742a413cd6f13f7d3974e9698154fbe",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-09-18"
8
+ }
@@ -2,7 +2,7 @@
2
2
  addopts = --tb=short
3
3
 
4
4
  [tox]
5
- envlist = py38,py39,py310,py311,py312
5
+ envlist = py39,py310,py311,py312,py313
6
6
  skipsdist = true
7
7
 
8
8
  [testenv]
@@ -18,7 +18,7 @@ docker =
18
18
  elasticsearch
19
19
 
20
20
  [docker:elasticsearch]
21
- image = elasticsearch:8.3.3
21
+ image = elasticsearch:9.1.0
22
22
  environment=
23
23
  discovery.type=single-node
24
24
  xpack.security.http.ssl.enabled=false
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes