logtail-python 0.5.1__tar.gz → 0.5.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.
- {logtail_python-0.5.1 → logtail_python-0.5.2}/PKG-INFO +2 -2
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/__init__.py +1 -1
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/flusher.py +7 -7
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail_python.egg-info/PKG-INFO +2 -2
- {logtail_python-0.5.1 → logtail_python-0.5.2}/setup.py +1 -1
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_flusher.py +37 -2
- {logtail_python-0.5.1 → logtail_python-0.5.2}/LICENSE.md +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/MANIFEST.in +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/README.md +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/compat.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/formatter.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/frame.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/handler.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/helpers.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/py.typed +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/rq.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail/uploader.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail_python.egg-info/SOURCES.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail_python.egg-info/dependency_links.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail_python.egg-info/requires.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/logtail_python.egg-info/top_level.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/requirements.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/setup.cfg +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/test-requirements.txt +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/__init__.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_formatter.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_frame.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_handler.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_helpers.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_rq.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/test_uploader.py +0 -0
- {logtail_python-0.5.1 → logtail_python-0.5.2}/tests/typecheck/public_api.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logtail-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Better Stack client library
|
|
5
5
|
Home-page: https://github.com/logtail/logtail-python
|
|
6
|
-
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.
|
|
6
|
+
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.2
|
|
7
7
|
Author: Logtail
|
|
8
8
|
Author-email: hello@logtail.com
|
|
9
9
|
License: ISC
|
|
@@ -89,13 +89,13 @@ class FlushWorker(threading.Thread):
|
|
|
89
89
|
if delay is not None:
|
|
90
90
|
time.sleep(delay)
|
|
91
91
|
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
print('Failed to send logs to Better Stack after {} retries: {}'.format(len(RETRY_SCHEDULE),
|
|
92
|
+
# The batch is dropped once the retries run out. A network error
|
|
93
|
+
# surfaces as a Fake500 that carries the `exception`; a 5xx answer
|
|
94
|
+
# from the server is a real `requests.Response` without one, so it
|
|
95
|
+
# is reported by its status code instead.
|
|
96
|
+
if _should_retry(response.status_code):
|
|
97
|
+
reason = getattr(response, 'exception', 'HTTP {}'.format(response.status_code))
|
|
98
|
+
print('Failed to send logs to Better Stack after {} retries: {}'.format(len(RETRY_SCHEDULE), reason))
|
|
99
99
|
|
|
100
100
|
self._clean = True
|
|
101
101
|
if shutdown and self.pipe.empty():
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logtail-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Better Stack client library
|
|
5
5
|
Home-page: https://github.com/logtail/logtail-python
|
|
6
|
-
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.
|
|
6
|
+
Download-URL: https://github.com/logtail/logtail-python/tarball/0.5.2
|
|
7
7
|
Author: Logtail
|
|
8
8
|
Author-email: hello@logtail.com
|
|
9
9
|
License: ISC
|
|
@@ -143,9 +143,44 @@ class TestFlushWorker(unittest.TestCase):
|
|
|
143
143
|
for log in first_frame:
|
|
144
144
|
pipe.put(log, block=False)
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
with patch('builtins.print') as mock_print:
|
|
147
|
+
fw.step() # must not raise AttributeError
|
|
147
148
|
|
|
148
149
|
self.assertTrue(fw._clean)
|
|
150
|
+
# The batch is dropped here, so say why, as the network-error path does.
|
|
151
|
+
mock_print.assert_called_once_with('Failed to send logs to Better Stack after 3 retries: HTTP 500')
|
|
152
|
+
|
|
153
|
+
@patch('logtail.flusher.time.sleep')
|
|
154
|
+
def test_step_logs_any_server_5xx_after_retries(self, _mock_sleep):
|
|
155
|
+
def uploader(frame):
|
|
156
|
+
resp = requests.models.Response()
|
|
157
|
+
resp.status_code = 503
|
|
158
|
+
return resp
|
|
159
|
+
|
|
160
|
+
pipe, _, fw = self._setup_worker(uploader)
|
|
161
|
+
pipe.put('log', block=False)
|
|
162
|
+
|
|
163
|
+
with patch('builtins.print') as mock_print:
|
|
164
|
+
fw.step()
|
|
165
|
+
|
|
166
|
+
mock_print.assert_called_once_with('Failed to send logs to Better Stack after 3 retries: HTTP 503')
|
|
167
|
+
|
|
168
|
+
@patch('logtail.flusher.time.sleep')
|
|
169
|
+
def test_step_does_not_log_when_a_retry_succeeds(self, _mock_sleep):
|
|
170
|
+
status_codes = iter([500, 503, 202])
|
|
171
|
+
|
|
172
|
+
def uploader(frame):
|
|
173
|
+
resp = requests.models.Response()
|
|
174
|
+
resp.status_code = next(status_codes)
|
|
175
|
+
return resp
|
|
176
|
+
|
|
177
|
+
pipe, _, fw = self._setup_worker(uploader)
|
|
178
|
+
pipe.put('log', block=False)
|
|
179
|
+
|
|
180
|
+
with patch('builtins.print') as mock_print:
|
|
181
|
+
fw.step()
|
|
182
|
+
|
|
183
|
+
mock_print.assert_not_called()
|
|
149
184
|
|
|
150
185
|
@patch('logtail.flusher.time.sleep')
|
|
151
186
|
def test_step_still_logs_network_error_fake500(self, _mock_sleep):
|
|
@@ -164,7 +199,7 @@ class TestFlushWorker(unittest.TestCase):
|
|
|
164
199
|
with patch('builtins.print') as mock_print:
|
|
165
200
|
fw.step()
|
|
166
201
|
|
|
167
|
-
mock_print.
|
|
202
|
+
mock_print.assert_called_once_with('Failed to send logs to Better Stack after 3 retries: network is down')
|
|
168
203
|
|
|
169
204
|
def test_shutdown_condition_empties_queue_and_shuts_down(self):
|
|
170
205
|
self.buffer_capacity = 10
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|