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

feat!: upgrade to http=1 #502

Merged
merged 8 commits into from
Oct 9, 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
1,113 changes: 594 additions & 519 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ members = ["crates/*"]
resolver = "2"

[workspace.dependencies]
qcs-api = "0.2.1"
qcs-api-client-common = "0.10.1"
qcs-api-client-grpc = "0.10.1"
qcs-api-client-openapi = "0.11.1"
qcs-api-client-common = "0.11.2"
qcs-api-client-grpc = "0.11.2"
qcs-api-client-openapi = "0.12.2"
serde_json = "1.0.86"
thiserror = "1.0.57"
tokio = "1.36.0"
Expand All @@ -25,11 +24,11 @@ quil-rs = { version = "0.28.1", git = "https://github.com/rigetti/quil-rs", tag
# and need to be updated together.
ndarray = { version = "0.15.6", features = ["serde"] }
numpy = "0.20.0"
pyo3 = { version = "0.20.0", features = ["extension-module"] }
pyo3 = { version = "0.20.0", default-features = false}
pyo3-asyncio = { version = "0.20", features = ["tokio-runtime"] }
pyo3-log = { version = "0.8.2" }
pyo3-opentelemetry = { version = "=0.3.2-dev.1" }
pyo3-tracing-subscriber = { version = "=0.1.2-dev.1", default-features = true }
pyo3-opentelemetry = { version = "0.3" }
pyo3-tracing-subscriber = { version = "0.1.4", default-features = false }

pyo3-build-config = "0.20.0"
rigetti-pyo3 = { version = "0.4.1", default-features = false, features = ["complex", "time"] }
Expand Down
8 changes: 2 additions & 6 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ ndarray.workspace = true
num = { version = "0.4.0", features = ["serde"] }
opentelemetry = { version = "0.23.0" }
opentelemetry_sdk = { version = "0.23.0" }
qcs-api.workspace = true
qcs-api-client-common.workspace = true
qcs-api-client-openapi.workspace = true
qcs-api-client-grpc.workspace = true
quil-rs.workspace = true
reqwest = { version = "0.11.20", default-features = false, features = [
"rustls-tls",
"json",
] }
reqwest = { version = "0.12.8", default-features = false, features = ["rustls-tls", "json"] }
rmp-serde = "1.1.1"
serde = { version = "1.0.145", features = ["derive"] }
serde_json.workspace = true
Expand All @@ -45,7 +41,7 @@ tokio = { workspace = true, features = ["fs", "rt-multi-thread"] }
toml = "0.7.3"
tracing = { version = "0.1", optional = true, features = ["log"] }
uuid = { version = "1.2.1", features = ["v4"] }
tonic = { version = "0.11.0", features = ["tls", "tls-roots"] }
tonic = { version = "0.12.3", features = ["tls", "tls-roots"] }
zmq = { version = "0.10.0" }
itertools = "0.11.0"
derive_builder = "0.12.0"
Expand Down
10 changes: 5 additions & 5 deletions crates/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
async-trait = "0.1.73"
qcs = { path = "../lib", features = ["tracing-opentelemetry"] }
qcs-api.workspace = true
qcs-api-client-common = { workspace = true, features = ["python"] }
qcs-api-client-grpc.workspace = true
qcs-api-client-openapi.workspace = true
pyo3.workspace = true
pyo3 = { workspace = true, features = ["extension-module", "multiple-pymethods"] }
pyo3-asyncio.workspace = true
pyo3-opentelemetry.workspace = true
pyo3-tracing-subscriber = { workspace = true, features = ["layer-otel-otlp-file", "layer-otel-otlp"] }
pyo3-tracing-subscriber = { workspace = true, features = ["pyo3", "layer-otel-otlp-file", "layer-otel-otlp"] }
quil-rs.workspace = true
serde_json.workspace = true
tokio.workspace = true
Expand All @@ -40,11 +39,12 @@ once_cell = "1.18.0"
opentelemetry = { version = "0.23.0" }
opentelemetry_sdk = { version = "0.23.0" }
tracing = { version = "0.1.37" }
prost = "0.12.6"
prost = "0.13.3"

[build-dependencies]
pyo3 = { workspace = true, features = ["multiple-pymethods"] }
pyo3-build-config.workspace = true
pyo3-tracing-subscriber = { version = "=0.1.2-dev.1", features = ["layer-otel-otlp-file", "layer-otel-otlp", "stubs"], default-features = false }
pyo3-tracing-subscriber = { workspace = true, features = ["layer-otel-otlp-file", "layer-otel-otlp", "stubs"] }

[lints.clippy]
too_many_arguments = "allow"
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 @@ -15,3 +15,4 @@

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

16 changes: 8 additions & 8 deletions crates/python/qcs_sdk/_tracing_subscriber/layers/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
from __future__ import annotations
from typing import TYPE_CHECKING

from . import file as file
from . import file as file
from . import otel_otlp_file as otel_otlp_file
from . import otel_otlp as otel_otlp

if TYPE_CHECKING:
from typing import Union
from typing import Union

Config = Union[
file.Config,
otel_otlp_file.Config,
otel_otlp.Config,
]
"""
Config = Union[
file.Config,
otel_otlp_file.Config,
otel_otlp.Config,
]
"""
One of the supported layer configurations that may be set on the subscriber configuration.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

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


Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ class Config:
:param json: Whether or not to format the output as JSON. Defaults to `True`.
"""
...

Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

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

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 @@ -47,6 +48,8 @@ class Resource:
schema_url: Optional[str] = None,
) -> "Resource": ...



@final
class Config:
"""
Expand All @@ -68,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 @@ -92,18 +96,19 @@ 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.
"""
...

if TYPE_CHECKING:
from typing import List, Union
from typing import List, Union

ResourceValueArray = Union[List[bool], List[int], List[float], List[str]]
"""
An array of `ResourceValue`s. This array is homogenous, so all values must be of the same type.
"""

ResourceValue = Union[bool, int, float, str, ResourceValueArray]
ResourceValue= Union[bool, int, float, str, ResourceValueArray]
"""
A value that can be added to a `Resource`.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

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

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,5 +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.
"""
...

Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

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

Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ class Config:
"""

def __new__(cls, *, layer: layers.Config) -> "Config": ...

30 changes: 2 additions & 28 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ feature-depth = 1
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
[advisories]
ignore = [
{ id = "RUSTSEC-2023-0052", reason = "Introduced by transitive dependency `webpki`. `hyper-proxy`, then `qcs-api-client-rust` need to update in order to remove" },
# { id = "RUSTSEC-2024-0320", reason = "yaml-rust is an unmaintained crate introduced by dev-dependency insta" },
{ id = "RUSTSEC-2024-0336", reason = "introduced by hyper, a transitive dependency of qcs-api-client-grpc" },
{ id = "RUSTSEC-2023-0055", reason = "introduced by lexical, a transitive dependency of quil-rs" },
{ id = "RUSTSEC-2021-0145", reason = "introduced by atty, a transitive dependency of multiple dependencies, with no upgrade path" },
{ id = "RUSTSEC-2024-0375", reason = "introduced by atty, a transitive dependency of multiple dependencies, with no upgrade path" },
{ id = "RUSTSEC-2024-0006", reason = "introduced by shlex, a transitive dependency of bindgen with no upgrade path" },
{ id = "RUSTSEC-2021-0139", reason = "ansi_term is unmaintained, but used by clap" },
]
yanked = "deny"
# If this is true, then cargo deny will use the git executable to fetch advisory database.
# If this is false, then it uses a built-in git library.
# Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support.
Expand Down Expand Up @@ -174,29 +172,6 @@ deny = [
#{ crate = "ansi_term@0.11.0", wrappers = ["this-crate-directly-depends-on-ansi_term"] },
]

# List of features to allow/deny
# Each entry the name of a crate and a version range. If version is
# not specified, all versions will be matched.
#[[bans.features]]
#crate = "reqwest"
# Features to not allow
#deny = ["json"]
# Features to allow
#allow = [
# "rustls",
# "__rustls",
# "__tls",
# "hyper-rustls",
# "rustls",
# "rustls-pemfile",
# "rustls-tls-webpki-roots",
# "tokio-rustls",
# "webpki-roots",
#]
# If true, the allowed features must exactly match the enabled feature set. If
# this is set there is no point setting `deny`
#exact = true

# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
#"ansi_term@0.11.0",
Expand All @@ -212,7 +187,6 @@ skip-tree = [
{ crate = "toml", depth = 20 },
{ crate = "warp", depth = 20 }, # Only used for development
{ crate = "hermit-abi", depth = 20 }, # Only used for development
{ crate = "hyper-rustls", depth = 20 }, # `hyper-proxy` relies on an older version than `reqwest`
{ crate = "itertools", depth = 20 }, # `quil-rs` and various transitive dependencies depend on different versions
{ crate = "hashbrown", depth = 20 }, # `indexmap` and `cached` depend on different versions
]
Expand Down
Loading