python-openobserve 0.4.2__tar.gz → 0.5.0__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.
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/PKG-INFO +6 -4
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/pyproject.toml +7 -6
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/python_openobserve/openobserve.py +26 -12
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/LICENSES/CC-BY-4.0.txt +0 -0
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/LICENSES/CC-BY-SA-4.0.txt +0 -0
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/LICENSES/GPL-3.0-or-later.txt +0 -0
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/README.md +0 -0
- {python_openobserve-0.4.2 → python_openobserve-0.5.0}/python_openobserve/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-openobserve
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: OpenObserve client for Python
|
|
5
5
|
License-File: LICENSES/CC-BY-4.0.txt
|
|
6
6
|
License-File: LICENSES/CC-BY-SA-4.0.txt
|
|
@@ -16,8 +16,10 @@ Provides-Extra: fireducks
|
|
|
16
16
|
Provides-Extra: pandas
|
|
17
17
|
Provides-Extra: polars
|
|
18
18
|
Provides-Extra: tests
|
|
19
|
+
Requires-Dist: cryptography (>=46.0.5)
|
|
19
20
|
Requires-Dist: fireducks (==1.4.4) ; extra == "fireducks"
|
|
20
|
-
Requires-Dist: guarddog (==2.
|
|
21
|
+
Requires-Dist: guarddog (==2.7.1) ; extra == "ci"
|
|
22
|
+
Requires-Dist: httpx (>=0.28,<1.0)
|
|
21
23
|
Requires-Dist: jmespath (==1.0.1) ; extra == "ci"
|
|
22
24
|
Requires-Dist: jmespath (==1.0.1) ; extra == "tests"
|
|
23
25
|
Requires-Dist: memray (==1.17.2) ; extra == "ci"
|
|
@@ -30,6 +32,7 @@ Requires-Dist: pandas (==2.2.3) ; extra == "ci"
|
|
|
30
32
|
Requires-Dist: pandas (>=2.2) ; extra == "pandas"
|
|
31
33
|
Requires-Dist: pandas-stubs (==2.2.2.240807) ; extra == "ci"
|
|
32
34
|
Requires-Dist: polars (==1.30.0) ; extra == "polars"
|
|
35
|
+
Requires-Dist: protobuf (>=6.33.5)
|
|
33
36
|
Requires-Dist: pydantic (>=2.10,<3.0)
|
|
34
37
|
Requires-Dist: pytest (==8.3.5) ; extra == "ci"
|
|
35
38
|
Requires-Dist: pytest (==8.3.5) ; extra == "tests"
|
|
@@ -37,10 +40,9 @@ Requires-Dist: pytest-cov (==6.0.0) ; extra == "ci"
|
|
|
37
40
|
Requires-Dist: pytest-memray (==1.7.0) ; extra == "ci"
|
|
38
41
|
Requires-Dist: python-dotenv (==1.0.1) ; extra == "ci"
|
|
39
42
|
Requires-Dist: python-dotenv (==1.0.1) ; extra == "tests"
|
|
40
|
-
Requires-Dist:
|
|
43
|
+
Requires-Dist: python-multipart (>=0.0.22)
|
|
41
44
|
Requires-Dist: sqlglot (>=26.4.0,<26.5.0)
|
|
42
45
|
Requires-Dist: types-jmespath (==1.0.2.20240106) ; extra == "ci"
|
|
43
|
-
Requires-Dist: types-requests (==2.32.0.20241016) ; extra == "ci"
|
|
44
46
|
Project-URL: Homepage, https://github.com/JustinGuese/python-openobserve
|
|
45
47
|
Project-URL: Repository, https://github.com/JustinGuese/python-openobserve
|
|
46
48
|
Description-Content-Type: text/markdown
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "python-openobserve"
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.5.0"
|
|
7
7
|
description = "OpenObserve client for Python"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.10,<3.14"
|
|
@@ -19,8 +19,11 @@ classifiers = [
|
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
dependencies = [
|
|
22
|
-
"
|
|
22
|
+
"cryptography>=46.0.5",
|
|
23
|
+
"httpx~=0.28",
|
|
24
|
+
"protobuf>=6.33.5",
|
|
23
25
|
"pydantic~=2.10",
|
|
26
|
+
"python-multipart>=0.0.22",
|
|
24
27
|
"sqlglot~=26.4.0",
|
|
25
28
|
]
|
|
26
29
|
|
|
@@ -44,8 +47,7 @@ ci = [
|
|
|
44
47
|
"pytest-cov==6.0.0",
|
|
45
48
|
"python-dotenv==1.0.1",
|
|
46
49
|
"types-jmespath==1.0.2.20240106",
|
|
47
|
-
"
|
|
48
|
-
"guarddog==2.6.0",
|
|
50
|
+
"guarddog==2.7.1",
|
|
49
51
|
]
|
|
50
52
|
docs = [
|
|
51
53
|
"mkdocs==1.6.1",
|
|
@@ -80,8 +82,7 @@ pytest = "8.3.5"
|
|
|
80
82
|
pytest-cov = "6.0.0"
|
|
81
83
|
python-dotenv = "1.0.1"
|
|
82
84
|
types-jmespath = "1.0.2.20240106"
|
|
83
|
-
|
|
84
|
-
guarddog = "2.6.0"
|
|
85
|
+
guarddog = "2.7.1"
|
|
85
86
|
|
|
86
87
|
[tool.poetry.group.pandas.dependencies]
|
|
87
88
|
pandas = ">2.2"
|
|
@@ -19,7 +19,7 @@ from datetime import datetime
|
|
|
19
19
|
from typing import List, Dict, Union, Optional, Any, cast
|
|
20
20
|
from pathlib import Path
|
|
21
21
|
|
|
22
|
-
import
|
|
22
|
+
import httpx
|
|
23
23
|
import sqlglot # type: ignore
|
|
24
24
|
|
|
25
25
|
try:
|
|
@@ -159,10 +159,10 @@ class OpenObserve:
|
|
|
159
159
|
pprint(msg)
|
|
160
160
|
|
|
161
161
|
def _handle_response(
|
|
162
|
-
self, res:
|
|
162
|
+
self, res: httpx.Response, action: str = "request"
|
|
163
163
|
) -> List[Dict]:
|
|
164
164
|
"""Handle API response and return JSON if successful"""
|
|
165
|
-
if res.status_code !=
|
|
165
|
+
if res.status_code != httpx.codes.OK:
|
|
166
166
|
raise Exception(
|
|
167
167
|
f"Openobserve {action} returned {res.status_code}. Text: {res.text}"
|
|
168
168
|
)
|
|
@@ -214,7 +214,7 @@ class OpenObserve:
|
|
|
214
214
|
assert isinstance(document, dict), "document must be a dict"
|
|
215
215
|
document = self.__datetime2Str(flatten(document))
|
|
216
216
|
|
|
217
|
-
res =
|
|
217
|
+
res = httpx.post(
|
|
218
218
|
f"{self.openobserve_url.replace('[STREAM]', index)}/_json",
|
|
219
219
|
headers=self.headers,
|
|
220
220
|
json=[document],
|
|
@@ -237,6 +237,7 @@ class OpenObserve:
|
|
|
237
237
|
*,
|
|
238
238
|
start_time: Union[datetime, int] = 0,
|
|
239
239
|
end_time: Union[datetime, int] = 0,
|
|
240
|
+
query_size: int = 1000,
|
|
240
241
|
verbosity: int = 0,
|
|
241
242
|
timeout: int = 300,
|
|
242
243
|
timestamp_conversion_auto: bool = False,
|
|
@@ -245,11 +246,14 @@ class OpenObserve:
|
|
|
245
246
|
"""
|
|
246
247
|
OpenObserve search function
|
|
247
248
|
https://openobserve.ai/docs/api/search/search/
|
|
249
|
+
https://github.com/openobserve/openobserve/commit/3ccf0be93391885136377b41a4cc2a36d80f904a
|
|
248
250
|
|
|
249
251
|
Args:
|
|
250
252
|
sql: input sql query
|
|
251
253
|
start_time: start of search interval, either datetime, either int/epoch
|
|
252
254
|
end_time: end of search interval, either datetime, either int/epoch
|
|
255
|
+
query_size: maximum number of results returned (default: 1000)
|
|
256
|
+
See also ZO_QUERY_DEFAULT_LIMIT
|
|
253
257
|
verbosity: how verbose to run from 0/less to 5/more
|
|
254
258
|
timeout: http timeout
|
|
255
259
|
timestamp_conversion_auto: try to convert automatically column containing time as name
|
|
@@ -274,10 +278,17 @@ class OpenObserve:
|
|
|
274
278
|
except sqlglot.errors.ParseError as e:
|
|
275
279
|
raise e
|
|
276
280
|
|
|
277
|
-
query = {
|
|
281
|
+
query = {
|
|
282
|
+
"query": {
|
|
283
|
+
"sql": sql,
|
|
284
|
+
"start_time": start_time,
|
|
285
|
+
"end_time": end_time,
|
|
286
|
+
"size": query_size,
|
|
287
|
+
}
|
|
288
|
+
}
|
|
278
289
|
self._debug(query, verbosity)
|
|
279
290
|
|
|
280
|
-
res =
|
|
291
|
+
res = httpx.post(
|
|
281
292
|
f"{self.openobserve_url.replace('/[STREAM]', '')}/_search",
|
|
282
293
|
json=query,
|
|
283
294
|
headers=self.headers,
|
|
@@ -310,7 +321,7 @@ class OpenObserve:
|
|
|
310
321
|
self._debug(url, verbosity)
|
|
311
322
|
|
|
312
323
|
if method == "GET":
|
|
313
|
-
res =
|
|
324
|
+
res = httpx.get(
|
|
314
325
|
url,
|
|
315
326
|
headers=self.headers,
|
|
316
327
|
params=params,
|
|
@@ -318,7 +329,7 @@ class OpenObserve:
|
|
|
318
329
|
timeout=self.timeout,
|
|
319
330
|
)
|
|
320
331
|
elif method == "POST":
|
|
321
|
-
res =
|
|
332
|
+
res = httpx.post(
|
|
322
333
|
url,
|
|
323
334
|
headers=self.headers,
|
|
324
335
|
json=json_data,
|
|
@@ -326,7 +337,7 @@ class OpenObserve:
|
|
|
326
337
|
timeout=self.timeout,
|
|
327
338
|
)
|
|
328
339
|
elif method == "PUT":
|
|
329
|
-
res =
|
|
340
|
+
res = httpx.put(
|
|
330
341
|
url,
|
|
331
342
|
headers=self.headers,
|
|
332
343
|
json=json_data,
|
|
@@ -344,6 +355,7 @@ class OpenObserve:
|
|
|
344
355
|
*,
|
|
345
356
|
start_time: Union[datetime, int] = 0,
|
|
346
357
|
end_time: Union[datetime, int] = 0,
|
|
358
|
+
query_size: int = 1000,
|
|
347
359
|
verbosity: int = 0,
|
|
348
360
|
timeout: int = 300,
|
|
349
361
|
timestamp_conversion_auto: bool = False,
|
|
@@ -356,6 +368,7 @@ class OpenObserve:
|
|
|
356
368
|
sql: input sql query
|
|
357
369
|
start_time: start of search interval, either datetime, either int/epoch
|
|
358
370
|
end_time: end of search interval, either datetime, either int/epoch
|
|
371
|
+
query_size: maximum number of results returned (default: 1000)
|
|
359
372
|
verbosity: how verbose to run from 0/less to 5/more
|
|
360
373
|
timeout: http timeout
|
|
361
374
|
timestamp_conversion_auto: try to convert automatically column containing time as name
|
|
@@ -365,6 +378,7 @@ class OpenObserve:
|
|
|
365
378
|
sql,
|
|
366
379
|
start_time=start_time,
|
|
367
380
|
end_time=end_time,
|
|
381
|
+
query_size=query_size,
|
|
368
382
|
verbosity=verbosity,
|
|
369
383
|
timeout=timeout,
|
|
370
384
|
timestamp_conversion_auto=timestamp_conversion_auto,
|
|
@@ -698,7 +712,7 @@ class OpenObserve:
|
|
|
698
712
|
self._debug(f"Create object {object_type} url: {url}", verbosity, level=1)
|
|
699
713
|
self._debug(f"Create object json input: {object_json}", verbosity, level=2)
|
|
700
714
|
|
|
701
|
-
res =
|
|
715
|
+
res = httpx.post(
|
|
702
716
|
url,
|
|
703
717
|
json=object_json,
|
|
704
718
|
headers=self.headers,
|
|
@@ -730,7 +744,7 @@ class OpenObserve:
|
|
|
730
744
|
self._debug(f"Update object {object_type} url: {url}", verbosity, level=1)
|
|
731
745
|
self._debug(f"Update object json input: {object_json}", verbosity, level=2)
|
|
732
746
|
|
|
733
|
-
res =
|
|
747
|
+
res = httpx.put(
|
|
734
748
|
url,
|
|
735
749
|
json=object_json,
|
|
736
750
|
headers=self.headers,
|
|
@@ -800,7 +814,7 @@ class OpenObserve:
|
|
|
800
814
|
url = url.replace("/api", "/api/v2")
|
|
801
815
|
self._debug(f"Delete object {object_type} url: {url}", verbosity, level=1)
|
|
802
816
|
|
|
803
|
-
res =
|
|
817
|
+
res = httpx.delete(
|
|
804
818
|
url,
|
|
805
819
|
headers=self.headers,
|
|
806
820
|
verify=self.verify,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|