Skip to content

Commit

Permalink
Release v2.2.0 (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored Nov 13, 2024
1 parent 68fcf5a commit e7ff8cb
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## [v2.2.0] (2024-11-13)

* Allow instrumenting a single httpx client by @alexmojaki in [#575](https://github.com/pydantic/logfire/pull/575)
* Log LLM tool call for streamed response by @jackmpcollins in [#545](https://github.com/pydantic/logfire/pull/545)

## [v2.1.2] (2024-11-04)

* Check `.logfire` for creds to respect `'if-token-present'` setting by @sydney-runkle in [#561](https://github.com/pydantic/logfire/pull/561)
Expand Down Expand Up @@ -406,3 +411,4 @@ First release from new repo!
[v2.1.0]: https://github.com/pydantic/logfire/compare/v2.0.0...v2.1.0
[v2.1.1]: https://github.com/pydantic/logfire/compare/v2.1.0...v2.1.1
[v2.1.2]: https://github.com/pydantic/logfire/compare/v2.1.1...v2.1.2
[v2.2.0]: https://github.com/pydantic/logfire/compare/v2.1.2...v2.2.0
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/httpx.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import httpx
from _typeshed import Incomplete
from logfire import Logfire as Logfire
from typing import TypedDict, Unpack
Expand All @@ -14,7 +15,7 @@ class HTTPXInstrumentKwargs(TypedDict, total=False):
async_response_hook: AsyncResponseHook
skip_dep_check: bool

def instrument_httpx(logfire_instance: Logfire, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
def instrument_httpx(logfire_instance: Logfire, client: httpx.Client | httpx.AsyncClient | None, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
"""Instrument the `httpx` module so that spans are automatically created for each request.
See the `Logfire.instrument_httpx` method for details.
Expand Down
5 changes: 4 additions & 1 deletion logfire-api/logfire_api/_internal/main.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import anthropic
import httpx
import openai
import opentelemetry.trace as trace_api
from . import async_ as async_
Expand Down Expand Up @@ -529,9 +530,11 @@ class Logfire:
"""
def instrument_asyncpg(self, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
"""Instrument the `asyncpg` module so that spans are automatically created for each query."""
def instrument_httpx(self, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
def instrument_httpx(self, client: httpx.Client | httpx.AsyncClient | None = None, **kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
"""Instrument the `httpx` module so that spans are automatically created for each request.
Optionally, pass an `httpx.Client` instance to instrument only that client.
Uses the
[OpenTelemetry HTTPX Instrumentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/httpx/httpx.html)
library, specifically `HTTPXClientInstrumentor().instrument()`, to which it passes `**kwargs`.
Expand Down
9 changes: 5 additions & 4 deletions logfire-api/logfire_api/_internal/metrics.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dataclasses
from _typeshed import Incomplete
from abc import ABC
from opentelemetry.context import Context
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, Instrument, Meter, MeterProvider, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, _Gauge
from opentelemetry.util.types import Attributes
from threading import Lock
Expand Down Expand Up @@ -45,17 +46,17 @@ class _ProxyAsynchronousInstrument(_ProxyInstrument[InstrumentT], ABC):
def __init__(self, instrument: InstrumentT, name: str, callbacks: Sequence[CallbackT] | None, unit: str, description: str) -> None: ...

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

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

class _ProxyObservableCounter(_ProxyAsynchronousInstrument[ObservableCounter], ObservableCounter): ...
class _ProxyObservableGauge(_ProxyAsynchronousInstrument[ObservableGauge], ObservableGauge): ...
class _ProxyObservableUpDownCounter(_ProxyAsynchronousInstrument[ObservableUpDownCounter], ObservableUpDownCounter): ...

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

class _ProxyGauge(_ProxyInstrument[Gauge], Gauge):
def set(self, amount: int | float, attributes: Attributes | None = None) -> None: ...
def set(self, amount: int | float, attributes: Attributes | None = None, context: Context | None = None) -> None: ...
2 changes: 1 addition & 1 deletion logfire-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "logfire-api"
version = "2.1.2"
version = "2.2.0"
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
authors = [
{ name = "Pydantic Team", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "logfire"
version = "2.1.2"
version = "2.2.0"
description = "The best Python observability tool!"
requires-python = ">=3.8"
authors = [
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7ff8cb

Please sign in to comment.