feat: add webhook delivery metrics to track success, duration, and attempts with new tests.

This commit is contained in:
2026-01-02 20:40:38 +00:00
parent 261247a08d
commit ba71cd4ffc
114 changed files with 9088 additions and 4961 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
from collections.abc import Sequence
from pyannote.core import Annotation, SlidingWindowFeature
from torch import device as TorchDevice

View File

@@ -1,5 +1,4 @@
from __future__ import annotations
class FileDescriptor:
...

View File

@@ -1,6 +1,5 @@
from __future__ import annotations
class EnumTypeWrapper(type):
def Name(self, number: int) -> str: ...
def Value(self, name: str) -> int: ...

View File

@@ -4,7 +4,7 @@ import threading
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from concurrent import futures
from types import ModuleType, TracebackType
from typing import Any, Generic, NoReturn, Protocol, TypeVar, type_check_only
from typing import Generic, NoReturn, Protocol, TypeVar, type_check_only
from typing_extensions import Self, TypeAlias
from . import aio as aio
@@ -16,9 +16,9 @@ _T = TypeVar("_T")
# XXX: Early attempts to tame this used literals for all the keys (gRPC is
# a bit segfaulty and doesn't adequately validate the option keys), but that
# didn't quite work out. Maybe it's something we can come back to
_OptionKeyValue: TypeAlias = tuple[str, Any]
_OptionKeyValue: TypeAlias = tuple[str, object]
Options: TypeAlias = Sequence[_OptionKeyValue]
_Options: TypeAlias = Options
Options: TypeAlias = Options
class Compression(enum.IntEnum):
NoCompression = 0
@@ -71,9 +71,9 @@ class Future(abc.ABC, Generic[_TFutureValue]):
# Create Client:
def insecure_channel(target: str, options: _Options | None = None, compression: Compression | None = None) -> Channel: ...
def insecure_channel(target: str, options: Options | None = None, compression: Compression | None = None) -> Channel: ...
def secure_channel(
target: str, credentials: ChannelCredentials, options: _Options | None = None, compression: Compression | None = None
target: str, credentials: ChannelCredentials, options: Options | None = None, compression: Compression | None = None
) -> Channel: ...
_Interceptor: TypeAlias = (
@@ -108,7 +108,7 @@ def server(
thread_pool: futures.ThreadPoolExecutor,
handlers: list[GenericRpcHandler] | None = None,
interceptors: list[ServerInterceptor] | None = None,
options: _Options | None = None,
options: Options | None = None,
maximum_concurrent_rpcs: int | None = None,
compression: Compression | None = None,
xds: bool = False,
@@ -147,7 +147,7 @@ def xds_server_credentials(fallback_credentials: ServerCredentials) -> ServerCre
#
@type_check_only
class _Behaviour(Protocol):
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __call__(self, *args: object, **kwargs: object) -> object: ...
def unary_unary_rpc_method_handler(
behavior: _Behaviour,
@@ -170,7 +170,7 @@ def stream_stream_rpc_method_handler(
response_serializer: _Serializer[_TResponse] | None = None,
) -> RpcMethodHandler[_TRequest, _TResponse]: ...
def method_handlers_generic_handler(
service: str, method_handlers: dict[str, RpcMethodHandler[Any, Any]]
service: str, method_handlers: dict[str, RpcMethodHandler[object, object]]
) -> GenericRpcHandler: ...
# Channel Ready Future:
@@ -284,20 +284,13 @@ class Server(abc.ABC):
# Authentication & Authorization Objects:
# Credentials are opaque to user space; keep them typed without Any.
class _Credentials(Protocol):
...
class _CertificateConfiguration(Protocol):
...
# This class has no supported interface
class ChannelCredentials:
def __init__(self, credentials: _Credentials) -> None: ...
def __init__(self, credentials: object) -> None: ...
# This class has no supported interface
class CallCredentials:
def __init__(self, credentials: _Credentials) -> None: ...
def __init__(self, credentials: object) -> None: ...
class AuthMetadataContext(abc.ABC):
service_url: str
@@ -311,11 +304,11 @@ class AuthMetadataPlugin(abc.ABC):
# This class has no supported interface
class ServerCredentials:
def __init__(self, credentials: _Credentials) -> None: ...
def __init__(self, credentials: object) -> None: ...
# This class has no supported interface
class ServerCertificateConfiguration:
def __init__(self, certificate_configuration: _CertificateConfiguration) -> None: ...
def __init__(self, certificate_configuration: object) -> None: ...
# gRPC Exceptions:
@@ -498,7 +491,7 @@ class HandlerCallDetails(abc.ABC):
class GenericRpcHandler(abc.ABC):
# The return type depends on the handler call details.
@abc.abstractmethod
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[Any, Any] | None: ...
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[object, object] | None: ...
class ServiceRpcHandler(GenericRpcHandler, metaclass=abc.ABCMeta):
@abc.abstractmethod
@@ -615,4 +608,4 @@ class StreamStreamMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]):
def protos(protobuf_path: str) -> ModuleType: ...
def services(protobuf_path: str) -> ModuleType: ...
def protos_and_services(protobuf_path: str) -> tuple[ModuleType, ModuleType]: ...
def protos_and_services(protobuf_path: str) -> tuple[ModuleType, ModuleType]: ...

View File

@@ -4,7 +4,7 @@ from _typeshed import Incomplete
from collections.abc import AsyncIterable, AsyncIterator, Awaitable, Callable, Generator, Iterable, Iterator, Mapping, Sequence
from concurrent import futures
from types import TracebackType
from typing import Any, Generic, NoReturn, TypeVar, overload, type_check_only
from typing import Generic, NoReturn, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeAlias
from grpc import (
@@ -145,7 +145,7 @@ class Server(metaclass=abc.ABCMeta):
# Client-Side Context:
_DoneCallbackType: TypeAlias = Callable[[Any], None]
_DoneCallbackType: TypeAlias = Callable[[object], None]
_EOFType: TypeAlias = object
class RpcContext(metaclass=abc.ABCMeta):
@@ -268,7 +268,7 @@ class ClientCallDetails(abc.ABC):
@type_check_only
class _InterceptedCall(Generic[_TRequest, _TResponse]):
def __init__(self, interceptors_task: asyncio.Task[Any]) -> None: ...
def __init__(self, interceptors_task: asyncio.Task[object]) -> None: ...
def __del__(self) -> None: ...
def cancel(self) -> bool: ...
def cancelled(self) -> bool: ...
@@ -463,4 +463,4 @@ class Metadata(Mapping[_MetadataKey, _MetadataValue]):
def set_all(self, key: _MetadataKey, values: list[_MetadataValue]) -> None: ...
def __contains__(self, key: object) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def __add__(self, other: Any) -> Metadata: ...
def __add__(self, other: object) -> Metadata: ...