Skip to content

Commit

Permalink
tweak pyo3-tracing-subscriber features
Browse files Browse the repository at this point in the history
  • Loading branch information
BatmanAoD committed Oct 8, 2024
1 parent 2aeb5a0 commit 0dc582f
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pyo3 = { version = "0.20.0", features = ["extension-module"] }
pyo3-asyncio = { version = "0.20", features = ["tokio-runtime"] }
pyo3-log = { version = "0.8.2" }
pyo3-opentelemetry = { version = "0.3" }
pyo3-tracing-subscriber = { version = "0.1.4", default-features = true }
pyo3-tracing-subscriber = { version = "0.1.4", default-features = false, features = ["pyo3"] }

pyo3-build-config = "0.20.0"
rigetti-pyo3 = { version = "0.4.1", default-features = false, features = ["complex", "time"] }
Expand Down
1 change: 1 addition & 0 deletions crates/python/qcs_sdk/_tracing_subscriber/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ from __future__ import annotations
from types import TracebackType
from typing import TYPE_CHECKING, Optional, Type, final

from . import common as common
from . import layers as layers
from . import subscriber as subscriber

Expand Down
18 changes: 18 additions & 0 deletions crates/python/qcs_sdk/_tracing_subscriber/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# *****************************************************************************
# * AUTO-GENERATED CODE *
# * *
# * This code was generated by the `pyo3-tracing-subscriber` crate. Any *
# * modifications to this file should be made to the script or the generation *
# * process that produced this code. Specifically, see: *
# * `pyo3_tracing_subscriber::stubs::write_stub_files` *
# * *
# * Do not manually edit this file, as your changes may be overwritten the *
# * next time the code is generated. *
# *****************************************************************************

from qcs_sdk._tracing_subscriber import common


__doc__ = common.__doc__
__all__ = getattr(common, "__all__", [])

45 changes: 45 additions & 0 deletions crates/python/qcs_sdk/_tracing_subscriber/common/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# *****************************************************************************
# * AUTO-GENERATED CODE *
# * *
# * This code was generated by the `pyo3-tracing-subscriber` crate. Any *
# * modifications to this file should be made to the script or the generation *
# * process that produced this code. Specifically, see: *
# * `pyo3_tracing_subscriber::stubs::write_stub_files` *
# * *
# * Do not manually edit this file, as your changes may be overwritten the *
# * next time the code is generated. *
# *****************************************************************************

from typing import Dict, Optional, final


@final
class InstrumentationLibrary:
"""
Information about a library or crate providing instrumentation.
An instrumentation library should be named to follow any naming conventions
of the instrumented library (e.g. 'middleware' for a web framework).
See the `instrumentation libraries <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.9.0/specification/overview.md#instrumentation-libraries>`_
spec for more information.
"""

def __new__(
cls,
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
attributes: Optional[Dict[str, str]] = None,
) -> "InstrumentationLibrary":
"""
Initializes a new instance of `InstrumentationLibrary`.
:param name: The name of the instrumentation library.
:param version: The version of the instrumentation library.
:param schema_url: The `schema URL <https://opentelemetry.io/docs/specs/otel/schemas/>`_ of
the instrumentation library.
:param attributes: The attributes of the instrumentation library.
"""
...

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from __future__ import annotations
from typing import Dict, Optional, TYPE_CHECKING, final
from qcs_sdk._tracing_subscriber.common import InstrumentationLibrary

@final
class SpanLimits:
Expand Down Expand Up @@ -70,6 +71,7 @@ class Config:
timeout_millis: Optional[int] = None,
pre_shutdown_timeout_millis: Optional[int] = 2000,
filter: Optional[str] = None,
instrumentation_library: Optional[InstrumentationLibrary] = None,
) -> "Config":
"""
Initializes a new `Config`.
Expand All @@ -94,6 +96,7 @@ class Config:
If not specified, this will first check the `PYO3_TRACING_SUBSCRIBER_ENV_FILTER` environment variable
and then `RUST_LOG` environment variable. If all of these values are empty, no spans will be exported.
:param instrumentation_library: Information about the library providing the tracing instrumentation.
"""
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# *****************************************************************************

from typing import Optional, final
from qcs_sdk._tracing_subscriber.common import InstrumentationLibrary


@final
class Config:
Expand All @@ -19,7 +21,7 @@ class Config:
layer.
"""

def __new__(cls, *, file_path: Optional[str] = None, filter: Optional[str] = None) -> "Config":
def __new__(cls, *, file_path: Optional[str] = None, filter: Optional[str] = None, instrumentation_library: Optional[InstrumentationLibrary] = None) -> "Config":
"""
:param file_path: The path to the file to write to. If not specified, defaults to stdout.
:param filter: A filter string to use for this layer. This uses the same format as the
Expand All @@ -30,6 +32,7 @@ class Config:
If not specified, this will first check the `PYO3_TRACING_SUBSCRIBER_ENV_FILTER` environment variable
and then `RUST_LOG` environment variable. If all of these values are empty, no spans will be exported.
:param instrumentation_library: Information about the library providing the tracing instrumentation.
"""
...

0 comments on commit 0dc582f

Please sign in to comment.