Skip to content

Commit e7ff8cb

Browse files
authored
Release v2.2.0 (#589)
1 parent 68fcf5a commit e7ff8cb

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## [v2.2.0] (2024-11-13)
4+
5+
* Allow instrumenting a single httpx client by @alexmojaki in [#575](https://github.com/pydantic/logfire/pull/575)
6+
* Log LLM tool call for streamed response by @jackmpcollins in [#545](https://github.com/pydantic/logfire/pull/545)
7+
38
## [v2.1.2] (2024-11-04)
49

510
* Check `.logfire` for creds to respect `'if-token-present'` setting by @sydney-runkle in [#561](https://github.com/pydantic/logfire/pull/561)
@@ -406,3 +411,4 @@ First release from new repo!
406411
[v2.1.0]: https://github.com/pydantic/logfire/compare/v2.0.0...v2.1.0
407412
[v2.1.1]: https://github.com/pydantic/logfire/compare/v2.1.0...v2.1.1
408413
[v2.1.2]: https://github.com/pydantic/logfire/compare/v2.1.1...v2.1.2
414+
[v2.2.0]: https://github.com/pydantic/logfire/compare/v2.1.2...v2.2.0

logfire-api/logfire_api/_internal/integrations/httpx.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import httpx
12
from _typeshed import Incomplete
23
from logfire import Logfire as Logfire
34
from typing import TypedDict, Unpack
@@ -14,7 +15,7 @@ class HTTPXInstrumentKwargs(TypedDict, total=False):
1415
async_response_hook: AsyncResponseHook
1516
skip_dep_check: bool
1617

17-
def instrument_httpx(logfire_instance: Logfire, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
18+
def instrument_httpx(logfire_instance: Logfire, client: httpx.Client | httpx.AsyncClient | None, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
1819
"""Instrument the `httpx` module so that spans are automatically created for each request.
1920
2021
See the `Logfire.instrument_httpx` method for details.

logfire-api/logfire_api/_internal/main.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import anthropic
2+
import httpx
23
import openai
34
import opentelemetry.trace as trace_api
45
from . import async_ as async_
@@ -529,9 +530,11 @@ class Logfire:
529530
"""
530531
def instrument_asyncpg(self, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
531532
"""Instrument the `asyncpg` module so that spans are automatically created for each query."""
532-
def instrument_httpx(self, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
533+
def instrument_httpx(self, client: httpx.Client | httpx.AsyncClient | None = None, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
533534
"""Instrument the `httpx` module so that spans are automatically created for each request.
534535
536+
Optionally, pass an `httpx.Client` instance to instrument only that client.
537+
535538
Uses the
536539
[OpenTelemetry HTTPX Instrumentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/httpx/httpx.html)
537540
library, specifically `HTTPXClientInstrumentor().instrument()`, to which it passes `**kwargs`.

logfire-api/logfire_api/_internal/metrics.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import dataclasses
22
from _typeshed import Incomplete
33
from abc import ABC
4+
from opentelemetry.context import Context
45
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, Instrument, Meter, MeterProvider, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, _Gauge
56
from opentelemetry.util.types import Attributes
67
from threading import Lock
@@ -45,17 +46,17 @@ class _ProxyAsynchronousInstrument(_ProxyInstrument[InstrumentT], ABC):
4546
def __init__(self, instrument: InstrumentT, name: str, callbacks: Sequence[CallbackT] | None, unit: str, description: str) -> None: ...
4647

4748
class _ProxyCounter(_ProxyInstrument[Counter], Counter):
48-
def add(self, amount: int | float, attributes: Attributes | None = None) -> None: ...
49+
def add(self, amount: int | float, attributes: Attributes | None = None, context: Context | None = None) -> None: ...
4950

5051
class _ProxyHistogram(_ProxyInstrument[Histogram], Histogram):
51-
def record(self, amount: int | float, attributes: Attributes | None = None) -> None: ...
52+
def record(self, amount: int | float, attributes: Attributes | None = None, context: Context | None = None) -> None: ...
5253

5354
class _ProxyObservableCounter(_ProxyAsynchronousInstrument[ObservableCounter], ObservableCounter): ...
5455
class _ProxyObservableGauge(_ProxyAsynchronousInstrument[ObservableGauge], ObservableGauge): ...
5556
class _ProxyObservableUpDownCounter(_ProxyAsynchronousInstrument[ObservableUpDownCounter], ObservableUpDownCounter): ...
5657

5758
class _ProxyUpDownCounter(_ProxyInstrument[UpDownCounter], UpDownCounter):
58-
def add(self, amount: int | float, attributes: Attributes | None = None) -> None: ...
59+
def add(self, amount: int | float, attributes: Attributes | None = None, context: Context | None = None) -> None: ...
5960

6061
class _ProxyGauge(_ProxyInstrument[Gauge], Gauge):
61-
def set(self, amount: int | float, attributes: Attributes | None = None) -> None: ...
62+
def set(self, amount: int | float, attributes: Attributes | None = None, context: Context | None = None) -> None: ...

logfire-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "logfire-api"
7-
version = "2.1.2"
7+
version = "2.2.0"
88
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
99
authors = [
1010
{ name = "Pydantic Team", email = "[email protected]" },

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "logfire"
7-
version = "2.1.2"
7+
version = "2.2.0"
88
description = "The best Python observability tool!"
99
requires-python = ">=3.8"
1010
authors = [

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)