reqly 0.1.2__tar.gz → 0.1.4__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.
- {reqly-0.1.2 → reqly-0.1.4}/PKG-INFO +1 -1
- {reqly-0.1.2 → reqly-0.1.4}/pyproject.toml +1 -1
- {reqly-0.1.2 → reqly-0.1.4}/reqly/__init__.py +14 -2
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/capture.py +9 -1
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/config.py +9 -1
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/shipper.py +7 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly.egg-info/PKG-INFO +1 -1
- {reqly-0.1.2 → reqly-0.1.4}/README.md +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/__init__.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/buffer.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/client.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/core/sampling.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/integrations/__init__.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/integrations/fastapi.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly/integrations/flask.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly.egg-info/SOURCES.txt +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly.egg-info/dependency_links.txt +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly.egg-info/requires.txt +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/reqly.egg-info/top_level.txt +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/setup.cfg +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/tests/test_buffer.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/tests/test_capture.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/tests/test_fastapi_integration.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/tests/test_flask_integration.py +0 -0
- {reqly-0.1.2 → reqly-0.1.4}/tests/test_sampling.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "reqly"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.4"
|
|
8
8
|
description = "Auto-instrumentation SDK for FastAPI and Flask: zero-code latency, error rates, and status codes shipped to a Reqly collector."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
from importlib.metadata import PackageNotFoundError
|
|
5
|
+
from importlib.metadata import version as _pkg_version
|
|
4
6
|
|
|
5
7
|
from .core.client import ReqlyClient
|
|
6
8
|
from .core.config import Config
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
try:
|
|
11
|
+
__version__ = _pkg_version("reqly")
|
|
12
|
+
except PackageNotFoundError:
|
|
13
|
+
__version__ = "0.1.3"
|
|
14
|
+
|
|
9
15
|
__all__ = ["instrument"]
|
|
10
16
|
|
|
11
17
|
logger = logging.getLogger("reqly")
|
|
@@ -44,7 +50,7 @@ def instrument(
|
|
|
44
50
|
max_queue_size: int | None = None,
|
|
45
51
|
ignore_routes: list[str] | None = None,
|
|
46
52
|
capture_request_body: bool | None = None,
|
|
47
|
-
) -> ReqlyClient:
|
|
53
|
+
) -> ReqlyClient | None:
|
|
48
54
|
"""Instrument a FastAPI or Flask app with one line.
|
|
49
55
|
|
|
50
56
|
Config resolution order for any omitted argument: explicit kwarg >
|
|
@@ -71,6 +77,12 @@ def instrument(
|
|
|
71
77
|
)
|
|
72
78
|
client = ReqlyClient(config)
|
|
73
79
|
|
|
80
|
+
if config.capture_request_body:
|
|
81
|
+
logger.warning(
|
|
82
|
+
"reqly: capture_request_body=True is set but body capture is not yet "
|
|
83
|
+
"implemented — request bodies will not be captured"
|
|
84
|
+
)
|
|
85
|
+
|
|
74
86
|
if framework == "fastapi":
|
|
75
87
|
from .integrations.fastapi import instrument_fastapi
|
|
76
88
|
|
|
@@ -4,6 +4,14 @@ import socket
|
|
|
4
4
|
import uuid
|
|
5
5
|
from dataclasses import asdict, dataclass, field
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
|
+
from importlib.metadata import PackageNotFoundError, version as _pkg_version
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _get_sdk_version() -> str:
|
|
11
|
+
try:
|
|
12
|
+
return _pkg_version("reqly")
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
return "0.1.0"
|
|
7
15
|
|
|
8
16
|
_HOSTNAME = socket.gethostname()
|
|
9
17
|
|
|
@@ -27,7 +35,7 @@ class RequestEvent:
|
|
|
27
35
|
error: bool = False
|
|
28
36
|
error_type: str | None = None
|
|
29
37
|
host: str = _HOSTNAME
|
|
30
|
-
sdk_version: str =
|
|
38
|
+
sdk_version: str = field(default_factory=_get_sdk_version)
|
|
31
39
|
|
|
32
40
|
def to_dict(self) -> dict:
|
|
33
41
|
return asdict(self)
|
|
@@ -2,6 +2,14 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version as _pkg_version
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _get_sdk_version() -> str:
|
|
9
|
+
try:
|
|
10
|
+
return _pkg_version("reqly")
|
|
11
|
+
except PackageNotFoundError:
|
|
12
|
+
return "0.1.0"
|
|
5
13
|
|
|
6
14
|
|
|
7
15
|
def _env_float(name: str, default: float) -> float:
|
|
@@ -48,7 +56,7 @@ class Config:
|
|
|
48
56
|
max_queue_size: int = 2000
|
|
49
57
|
ignore_routes: list[str] = field(default_factory=lambda: ["/health", "/metrics"])
|
|
50
58
|
capture_request_body: bool = False
|
|
51
|
-
sdk_version: str =
|
|
59
|
+
sdk_version: str = field(default_factory=_get_sdk_version)
|
|
52
60
|
|
|
53
61
|
@classmethod
|
|
54
62
|
def resolve(
|
|
@@ -82,6 +82,13 @@ class Shipper:
|
|
|
82
82
|
attempt + 1,
|
|
83
83
|
_MAX_RETRIES,
|
|
84
84
|
)
|
|
85
|
+
except Exception as exc:
|
|
86
|
+
logger.warning(
|
|
87
|
+
"reqly: unexpected shipper error %s, attempt %d/%d",
|
|
88
|
+
exc,
|
|
89
|
+
attempt + 1,
|
|
90
|
+
_MAX_RETRIES,
|
|
91
|
+
)
|
|
85
92
|
|
|
86
93
|
if attempt < _MAX_RETRIES - 1:
|
|
87
94
|
backoff = _BACKOFF_BASE_SECONDS * (2**attempt)
|
|
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
|