logbrew-fastapi 0.1.6__tar.gz → 0.1.8__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 (19) hide show
  1. {logbrew_fastapi-0.1.6/src/logbrew_fastapi.egg-info → logbrew_fastapi-0.1.8}/PKG-INFO +32 -3
  2. logbrew_fastapi-0.1.6/PKG-INFO → logbrew_fastapi-0.1.8/README.md +26 -22
  3. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/pyproject.toml +7 -3
  4. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/__init__.py +2 -2
  5. logbrew_fastapi-0.1.6/README.md → logbrew_fastapi-0.1.8/src/logbrew_fastapi.egg-info/PKG-INFO +51 -0
  6. logbrew_fastapi-0.1.8/src/logbrew_fastapi.egg-info/requires.txt +5 -0
  7. logbrew_fastapi-0.1.6/src/logbrew_fastapi.egg-info/requires.txt +0 -2
  8. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/setup.cfg +0 -0
  9. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/__init__.py +0 -0
  10. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/__main__.py +0 -0
  11. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/dependency_spans.py +0 -0
  12. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/outbound_http.py +0 -0
  13. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/readme_example.py +0 -0
  14. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/examples/real_user_smoke.py +0 -0
  15. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi/py.typed +0 -0
  16. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi.egg-info/SOURCES.txt +0 -0
  17. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi.egg-info/dependency_links.txt +0 -0
  18. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/src/logbrew_fastapi.egg-info/top_level.txt +0 -0
  19. {logbrew_fastapi-0.1.6 → logbrew_fastapi-0.1.8}/tests/test_fastapi_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: logbrew-fastapi
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: FastAPI integration for capturing LogBrew request spans and exceptions.
5
5
  Author: LogBrew
6
6
  License-Expression: MIT
@@ -11,14 +11,17 @@ Classifier: Framework :: FastAPI
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
14
15
  Classifier: Programming Language :: Python :: 3.11
15
16
  Classifier: Programming Language :: Python :: 3.12
16
17
  Classifier: Programming Language :: Python :: 3.13
17
18
  Classifier: Typing :: Typed
18
- Requires-Python: >=3.11
19
+ Requires-Python: >=3.10
19
20
  Description-Content-Type: text/markdown
20
21
  Requires-Dist: fastapi>=0.111.1
21
- Requires-Dist: logbrew-sdk<0.2.0,>=0.1.5
22
+ Requires-Dist: logbrew-sdk<0.2.0,>=0.1.7
23
+ Provides-Extra: celery
24
+ Requires-Dist: logbrew-sdk[celery]<0.2.0,>=0.1.7; extra == "celery"
22
25
 
23
26
  # logbrew-fastapi
24
27
 
@@ -34,6 +37,8 @@ FastAPI integration for capturing LogBrew request spans and exceptions with the
34
37
  python3 -m pip install logbrew-fastapi
35
38
  ```
36
39
 
40
+ `logbrew-fastapi` requires Python 3.10 or newer.
41
+
37
42
  The package is typed, ships `py.typed`, and installs the compatible core `logbrew-sdk`. It supports FastAPI 0.111.1 and later. It does not install or replace application-owned HTTP clients such as `httpx` or `httpx2`. Keep the real project key in application configuration rather than source control.
38
43
 
39
44
  ## Production setup
@@ -183,6 +188,30 @@ def checkout(order_id: str) -> dict[str, object]:
183
188
 
184
189
  Run `python -m logbrew_fastapi.examples dependency-spans` to see a local request span parenting SQLite, cache, and queue child spans from an installed package. LogBrew does not patch database drivers, cache clients, queue frameworks, or broker metadata globally, and the helpers avoid SQL values, cache keys/values, queue bodies, headers, baggage, and tracestate.
185
190
 
191
+ ## Celery background jobs
192
+
193
+ Install the optional Celery path when a FastAPI service publishes or processes Celery jobs:
194
+
195
+ ```bash
196
+ python3 -m pip install "logbrew-fastapi[celery]"
197
+ ```
198
+
199
+ The base FastAPI install stays Celery-free. The extra installs the compatible core Celery integration, which you attach only to the Celery app your service owns:
200
+
201
+ ```python
202
+ from celery import Celery
203
+ from logbrew_sdk import instrument_celery_app_with_logbrew_spans
204
+
205
+ celery_app = Celery("checkout")
206
+ celery_telemetry = instrument_celery_app_with_logbrew_spans(
207
+ celery_app,
208
+ client=client,
209
+ metadata={"service": "checkout-worker"},
210
+ )
211
+ ```
212
+
213
+ Producer and worker spans share W3C trace context. An unexpected final task failure emits one trace-correlated issue with task name and exception type only; retries and exception types declared through `task.throws` stay span-only. Task IDs, arguments, results, headers, exception messages, and stack traces are excluded. Uninstall direct instrumentation after tasks drain and before shutting down its client. Separate prefork workers need child-owned clients; follow the [core Celery lifecycle and encrypted persistence setup](https://github.com/LogBrewCo/sdk/tree/main/python/logbrew_py#automatic-celery-spans) instead of sharing the FastAPI process client across forks.
214
+
186
215
  Request duration metrics are opt-in. Set `capture_request_metrics=True` to emit an explicit `http.server.duration` histogram for completed requests:
187
216
 
188
217
  ```python
@@ -1,25 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: logbrew-fastapi
3
- Version: 0.1.6
4
- Summary: FastAPI integration for capturing LogBrew request spans and exceptions.
5
- Author: LogBrew
6
- License-Expression: MIT
7
- Project-URL: Repository, https://github.com/LogBrewCo/sdk
8
- Keywords: logbrew,observability,fastapi,asgi,logs
9
- Classifier: Development Status :: 3 - Alpha
10
- Classifier: Framework :: FastAPI
11
- Classifier: Intended Audience :: Developers
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Typing :: Typed
18
- Requires-Python: >=3.11
19
- Description-Content-Type: text/markdown
20
- Requires-Dist: fastapi>=0.111.1
21
- Requires-Dist: logbrew-sdk<0.2.0,>=0.1.5
22
-
23
1
  # logbrew-fastapi
24
2
 
25
3
  <p align="center">
@@ -34,6 +12,8 @@ FastAPI integration for capturing LogBrew request spans and exceptions with the
34
12
  python3 -m pip install logbrew-fastapi
35
13
  ```
36
14
 
15
+ `logbrew-fastapi` requires Python 3.10 or newer.
16
+
37
17
  The package is typed, ships `py.typed`, and installs the compatible core `logbrew-sdk`. It supports FastAPI 0.111.1 and later. It does not install or replace application-owned HTTP clients such as `httpx` or `httpx2`. Keep the real project key in application configuration rather than source control.
38
18
 
39
19
  ## Production setup
@@ -183,6 +163,30 @@ def checkout(order_id: str) -> dict[str, object]:
183
163
 
184
164
  Run `python -m logbrew_fastapi.examples dependency-spans` to see a local request span parenting SQLite, cache, and queue child spans from an installed package. LogBrew does not patch database drivers, cache clients, queue frameworks, or broker metadata globally, and the helpers avoid SQL values, cache keys/values, queue bodies, headers, baggage, and tracestate.
185
165
 
166
+ ## Celery background jobs
167
+
168
+ Install the optional Celery path when a FastAPI service publishes or processes Celery jobs:
169
+
170
+ ```bash
171
+ python3 -m pip install "logbrew-fastapi[celery]"
172
+ ```
173
+
174
+ The base FastAPI install stays Celery-free. The extra installs the compatible core Celery integration, which you attach only to the Celery app your service owns:
175
+
176
+ ```python
177
+ from celery import Celery
178
+ from logbrew_sdk import instrument_celery_app_with_logbrew_spans
179
+
180
+ celery_app = Celery("checkout")
181
+ celery_telemetry = instrument_celery_app_with_logbrew_spans(
182
+ celery_app,
183
+ client=client,
184
+ metadata={"service": "checkout-worker"},
185
+ )
186
+ ```
187
+
188
+ Producer and worker spans share W3C trace context. An unexpected final task failure emits one trace-correlated issue with task name and exception type only; retries and exception types declared through `task.throws` stay span-only. Task IDs, arguments, results, headers, exception messages, and stack traces are excluded. Uninstall direct instrumentation after tasks drain and before shutting down its client. Separate prefork workers need child-owned clients; follow the [core Celery lifecycle and encrypted persistence setup](https://github.com/LogBrewCo/sdk/tree/main/python/logbrew_py#automatic-celery-spans) instead of sharing the FastAPI process client across forks.
189
+
186
190
  Request duration metrics are opt-in. Set `capture_request_metrics=True` to emit an explicit `http.server.duration` histogram for completed requests:
187
191
 
188
192
  ```python
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "logbrew-fastapi"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "FastAPI integration for capturing LogBrew request spans and exceptions."
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
- requires-python = ">=3.11"
11
+ requires-python = ">=3.10"
12
12
  authors = [
13
13
  { name = "LogBrew" }
14
14
  ]
@@ -19,6 +19,7 @@ classifiers = [
19
19
  "Intended Audience :: Developers",
20
20
  "Programming Language :: Python :: 3",
21
21
  "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.10",
22
23
  "Programming Language :: Python :: 3.11",
23
24
  "Programming Language :: Python :: 3.12",
24
25
  "Programming Language :: Python :: 3.13",
@@ -26,9 +27,12 @@ classifiers = [
26
27
  ]
27
28
  dependencies = [
28
29
  "fastapi>=0.111.1",
29
- "logbrew-sdk>=0.1.5,<0.2.0"
30
+ "logbrew-sdk>=0.1.7,<0.2.0"
30
31
  ]
31
32
 
33
+ [project.optional-dependencies]
34
+ celery = ["logbrew-sdk[celery]>=0.1.7,<0.2.0"]
35
+
32
36
  [project.urls]
33
37
  Repository = "https://github.com/LogBrewCo/sdk"
34
38
 
@@ -6,7 +6,7 @@ import time
6
6
  import uuid
7
7
  from collections.abc import Callable
8
8
  from dataclasses import dataclass
9
- from datetime import UTC, datetime
9
+ from datetime import datetime, timezone
10
10
  from importlib.metadata import PackageNotFoundError
11
11
  from importlib.metadata import version as distribution_version
12
12
  from typing import Any
@@ -244,7 +244,7 @@ def _delivery_error_code(error: Exception) -> str:
244
244
  def utc_timestamp() -> str:
245
245
  """Return a LogBrew-compatible UTC timestamp."""
246
246
 
247
- return datetime.now(UTC).isoformat(timespec="milliseconds").replace("+00:00", "Z")
247
+ return datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
248
248
 
249
249
 
250
250
  def request_name(request: Request) -> str:
@@ -1,3 +1,28 @@
1
+ Metadata-Version: 2.4
2
+ Name: logbrew-fastapi
3
+ Version: 0.1.8
4
+ Summary: FastAPI integration for capturing LogBrew request spans and exceptions.
5
+ Author: LogBrew
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/LogBrewCo/sdk
8
+ Keywords: logbrew,observability,fastapi,asgi,logs
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Framework :: FastAPI
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: fastapi>=0.111.1
22
+ Requires-Dist: logbrew-sdk<0.2.0,>=0.1.7
23
+ Provides-Extra: celery
24
+ Requires-Dist: logbrew-sdk[celery]<0.2.0,>=0.1.7; extra == "celery"
25
+
1
26
  # logbrew-fastapi
2
27
 
3
28
  <p align="center">
@@ -12,6 +37,8 @@ FastAPI integration for capturing LogBrew request spans and exceptions with the
12
37
  python3 -m pip install logbrew-fastapi
13
38
  ```
14
39
 
40
+ `logbrew-fastapi` requires Python 3.10 or newer.
41
+
15
42
  The package is typed, ships `py.typed`, and installs the compatible core `logbrew-sdk`. It supports FastAPI 0.111.1 and later. It does not install or replace application-owned HTTP clients such as `httpx` or `httpx2`. Keep the real project key in application configuration rather than source control.
16
43
 
17
44
  ## Production setup
@@ -161,6 +188,30 @@ def checkout(order_id: str) -> dict[str, object]:
161
188
 
162
189
  Run `python -m logbrew_fastapi.examples dependency-spans` to see a local request span parenting SQLite, cache, and queue child spans from an installed package. LogBrew does not patch database drivers, cache clients, queue frameworks, or broker metadata globally, and the helpers avoid SQL values, cache keys/values, queue bodies, headers, baggage, and tracestate.
163
190
 
191
+ ## Celery background jobs
192
+
193
+ Install the optional Celery path when a FastAPI service publishes or processes Celery jobs:
194
+
195
+ ```bash
196
+ python3 -m pip install "logbrew-fastapi[celery]"
197
+ ```
198
+
199
+ The base FastAPI install stays Celery-free. The extra installs the compatible core Celery integration, which you attach only to the Celery app your service owns:
200
+
201
+ ```python
202
+ from celery import Celery
203
+ from logbrew_sdk import instrument_celery_app_with_logbrew_spans
204
+
205
+ celery_app = Celery("checkout")
206
+ celery_telemetry = instrument_celery_app_with_logbrew_spans(
207
+ celery_app,
208
+ client=client,
209
+ metadata={"service": "checkout-worker"},
210
+ )
211
+ ```
212
+
213
+ Producer and worker spans share W3C trace context. An unexpected final task failure emits one trace-correlated issue with task name and exception type only; retries and exception types declared through `task.throws` stay span-only. Task IDs, arguments, results, headers, exception messages, and stack traces are excluded. Uninstall direct instrumentation after tasks drain and before shutting down its client. Separate prefork workers need child-owned clients; follow the [core Celery lifecycle and encrypted persistence setup](https://github.com/LogBrewCo/sdk/tree/main/python/logbrew_py#automatic-celery-spans) instead of sharing the FastAPI process client across forks.
214
+
164
215
  Request duration metrics are opt-in. Set `capture_request_metrics=True` to emit an explicit `http.server.duration` histogram for completed requests:
165
216
 
166
217
  ```python
@@ -0,0 +1,5 @@
1
+ fastapi>=0.111.1
2
+ logbrew-sdk<0.2.0,>=0.1.7
3
+
4
+ [celery]
5
+ logbrew-sdk[celery]<0.2.0,>=0.1.7
@@ -1,2 +0,0 @@
1
- fastapi>=0.111.1
2
- logbrew-sdk<0.2.0,>=0.1.5