Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.2.0 #512

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## [v1.2.0] (2024-10-17)

* Add `local` parameter to `logfire.configure()` by @alexmojaki in [#508](https://github.com/pydantic/logfire/pull/508)

## [v1.1.0] (2024-10-14)

* Fix error in checking for generators in auto-tracing by @alexmojaki in https://github.com/pydantic/logfire/pull/498
Expand Down Expand Up @@ -353,3 +357,4 @@ First release from new repo!
[v1.0.0]: https://github.com/pydantic/logfire/compare/v0.55.0...v1.0.0
[v1.0.1]: https://github.com/pydantic/logfire/compare/v1.0.0...v1.0.1
[v1.1.0]: https://github.com/pydantic/logfire/compare/v1.0.1...v1.1.0
[v1.2.0]: https://github.com/pydantic/logfire/compare/v1.1.0...v1.2.0
8 changes: 5 additions & 3 deletions logfire-api/logfire_api/_internal/config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from .exporters.quiet_metrics import QuietMetricExporter as QuietMetricExporter
from .exporters.remove_pending import RemovePendingSpansExporter as RemovePendingSpansExporter
from .exporters.test import TestExporter as TestExporter
from .integrations.executors import instrument_executors as instrument_executors
from .main import FastLogfireSpan as FastLogfireSpan, LogfireSpan as LogfireSpan
from .main import FastLogfireSpan as FastLogfireSpan, Logfire as Logfire, LogfireSpan as LogfireSpan
from .metrics import ProxyMeterProvider as ProxyMeterProvider
from .scrubbing import BaseScrubber as BaseScrubber, NOOP_SCRUBBER as NOOP_SCRUBBER, Scrubber as Scrubber, ScrubbingOptions as ScrubbingOptions
from .stack_info import warn_at_user_stacklevel as warn_at_user_stacklevel
Expand Down Expand Up @@ -88,10 +88,12 @@ class CodeSource:

class DeprecatedKwargs(TypedDict): ...

def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = None, token: str | None = None, service_name: str | None = None, service_version: str | None = None, console: ConsoleOptions | Literal[False] | None = None, config_dir: Path | str | None = None, data_dir: Path | str | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, metrics: MetricsOptions | Literal[False] | None = None, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None, code_source: CodeSource | None = None, advanced: AdvancedOptions | None = None, **deprecated_kwargs: Unpack[DeprecatedKwargs]) -> None:
def configure(*, local: bool = False, send_to_logfire: bool | Literal['if-token-present'] | None = None, token: str | None = None, service_name: str | None = None, service_version: str | None = None, console: ConsoleOptions | Literal[False] | None = None, config_dir: Path | str | None = None, data_dir: Path | str | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, metrics: MetricsOptions | Literal[False] | None = None, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, sampling: SamplingOptions | None = None, code_source: CodeSource | None = None, advanced: AdvancedOptions | None = None, **deprecated_kwargs: Unpack[DeprecatedKwargs]) -> Logfire:
"""Configure the logfire SDK.

Args:
local: If `True`, configures and returns a `Logfire` instance that is not the default global instance.
Use this to create multiple separate configurations, e.g. to send to different projects.
send_to_logfire: Whether to send logs to logfire.dev. Defaults to the `LOGFIRE_SEND_TO_LOGFIRE` environment
variable if set, otherwise defaults to `True`. If `if-token-present` is provided, logs will only be sent if
a token is present.
Expand Down Expand Up @@ -153,7 +155,7 @@ class LogfireConfig(_LogfireConfigData):
See `_LogfireConfigData` for parameter documentation.
"""
def configure(self, send_to_logfire: bool | Literal['if-token-present'] | None, token: str | None, service_name: str | None, service_version: str | None, console: ConsoleOptions | Literal[False] | None, config_dir: Path | None, data_dir: Path | None, additional_span_processors: Sequence[SpanProcessor] | None, metrics: MetricsOptions | Literal[False] | None, scrubbing: ScrubbingOptions | Literal[False] | None, inspect_arguments: bool | None, sampling: SamplingOptions | None, code_source: CodeSource | None, advanced: AdvancedOptions | None) -> None: ...
def initialize(self) -> ProxyTracerProvider:
def initialize(self) -> None:
"""Configure internals to start exporting traces and metrics."""
def force_flush(self, timeout_millis: int = 30000) -> bool:
"""Force flush all spans and metrics.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from logfire import Logfire as Logfire
from typing import Any

def instrument_aiohttp_client(**kwargs: Any):
def instrument_aiohttp_client(logfire_instance: Logfire, **kwargs: Any):
"""Instrument the `aiohttp` module so that spans are automatically created for each client request.

See the `Logfire.instrument_aiohttp_client` method for details.
Expand Down
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/asyncpg.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from logfire import Logfire as Logfire
from typing_extensions import TypedDict, Unpack

class AsyncPGInstrumentKwargs(TypedDict, total=False):
skip_dep_check: bool

def instrument_asyncpg(**kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
def instrument_asyncpg(logfire_instance: Logfire, **kwargs: Unpack[AsyncPGInstrumentKwargs]) -> None:
"""Instrument the `asyncpg` module so that spans are automatically created for each query.

See the `Logfire.instrument_asyncpg` method for details.
Expand Down
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/celery.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from logfire import Logfire as Logfire
from typing_extensions import TypedDict, Unpack

class CeleryInstrumentKwargs(TypedDict, total=False):
skip_dep_check: bool

def instrument_celery(**kwargs: Unpack[CeleryInstrumentKwargs]) -> None:
def instrument_celery(logfire_instance: Logfire, **kwargs: Unpack[CeleryInstrumentKwargs]) -> None:
"""Instrument the `celery` module so that spans are automatically created for each task.

See the `Logfire.instrument_celery` method for details.
Expand Down
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/django.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from logfire import Logfire as Logfire
from logfire._internal.utils import maybe_capture_server_headers as maybe_capture_server_headers
from typing import Any

def instrument_django(*, capture_headers: bool = False, **kwargs: Any):
def instrument_django(logfire_instance: Logfire, *, capture_headers: bool = False, **kwargs: Any):
"""Instrument the `django` module so that spans are automatically created for each web request.

See the `Logfire.instrument_django` method for details.
Expand Down
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/flask.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask.app import Flask
from logfire import Logfire as Logfire
from logfire._internal.utils import maybe_capture_server_headers as maybe_capture_server_headers
from opentelemetry.trace import Span
from typing_extensions import Protocol, TypedDict, Unpack
Expand All @@ -17,7 +18,7 @@ class FlaskInstrumentKwargs(TypedDict, total=False):
enable_commenter: bool | None
commenter_options: dict[str, str] | None

def instrument_flask(app: Flask, capture_headers: bool = False, **kwargs: Unpack[FlaskInstrumentKwargs]):
def instrument_flask(logfire_instance: Logfire, app: Flask, capture_headers: bool = False, **kwargs: Unpack[FlaskInstrumentKwargs]):
"""Instrument `app` so that spans are automatically created for each request.

See the `Logfire.instrument_flask` method for details.
Expand Down
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,4 +1,5 @@
from _typeshed import Incomplete
from logfire import Logfire as Logfire
from typing import TypedDict, Unpack

RequestHook: Incomplete
Expand All @@ -13,7 +14,7 @@ class HTTPXInstrumentKwargs(TypedDict, total=False):
async_response_hook: AsyncResponseHook
skip_dep_check: bool

def instrument_httpx(**kwargs: Unpack[HTTPXInstrumentKwargs]) -> None:
def instrument_httpx(logfire_instance: Logfire, **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
12 changes: 2 additions & 10 deletions logfire-api/logfire_api/_internal/integrations/mysql.pyi
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
from mysql.connector.abstracts import MySQLConnectionAbstract
from mysql.connector.pooling import PooledMySQLConnection
from opentelemetry.trace import TracerProvider
from typing_extensions import TypeVar, TypedDict, Unpack

MySQLConnection = TypeVar('MySQLConnection', bound=PooledMySQLConnection | MySQLConnectionAbstract | None)

class MySQLInstrumentKwargs(TypedDict, total=False):
skip_dep_check: bool

def instrument_mysql(conn: MySQLConnection = None, **kwargs: Unpack[MySQLInstrumentKwargs]) -> MySQLConnection:
def instrument_mysql(*, conn: MySQLConnection = None, tracer_provider: TracerProvider, **kwargs: Unpack[MySQLInstrumentKwargs]) -> MySQLConnection:
"""Instrument the `mysql` module or a specific MySQL connection so that spans are automatically created for each operation.

This function uses the OpenTelemetry MySQL Instrumentation library to instrument either the entire `mysql` module or a specific MySQL connection.

Args:
conn: The MySQL connection to instrument. If None, the entire `mysql` module is instrumented.
**kwargs: Additional keyword arguments to pass to the OpenTelemetry `instrument` methods.

Returns:
If a connection is provided, returns the instrumented connection. If no connection is provided, returns None.

See the `Logfire.instrument_mysql` method for details.
"""
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/psycopg.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from logfire import Logfire as Logfire
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
from typing import Any
Expand All @@ -17,7 +18,7 @@ class PsycopgInstrumentKwargs(TypedDict, total=False):

PACKAGE_NAMES: Incomplete

def instrument_psycopg(conn_or_module: Any = None, **kwargs: Unpack[PsycopgInstrumentKwargs]) -> None:
def instrument_psycopg(logfire_instance: Logfire, conn_or_module: Any = None, **kwargs: Unpack[PsycopgInstrumentKwargs]) -> None:
"""Instrument a `psycopg` connection or module so that spans are automatically created for each query.

See the `Logfire.instrument_psycopg` method for details.
Expand Down
3 changes: 2 additions & 1 deletion logfire-api/logfire_api/_internal/integrations/requests.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from logfire import Logfire as Logfire
from typing import Any

def instrument_requests(excluded_urls: str | None = None, **kwargs: Any):
def instrument_requests(logfire_instance: Logfire, excluded_urls: str | None = None, **kwargs: Any):
"""Instrument the `requests` module so that spans are automatically created for each request.

See the `Logfire.instrument_requests` method for details.
Expand Down
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 = "1.1.0"
version = "1.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 = "1.1.0"
version = "1.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.