openmeter 1.0.0b112__py3-none-any.whl → 1.0.0b113__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of openmeter might be problematic. Click here for more details.

@@ -777,6 +777,20 @@ def build_reset_entitlement_usage_request(subject_id_or_key: str, entitlement_id
777
777
  return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
778
778
 
779
779
 
780
+ def build_get_debug_metrics_request(**kwargs: Any) -> HttpRequest:
781
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
782
+
783
+ accept = _headers.pop("Accept", "text/plain, application/problem+json")
784
+
785
+ # Construct URL
786
+ _url = "/api/v1/debug/metrics"
787
+
788
+ # Construct headers
789
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
790
+
791
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
792
+
793
+
780
794
  class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-methods
781
795
  @distributed_trace
782
796
  def list_events(
@@ -4648,3 +4662,56 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
4648
4662
 
4649
4663
  if cls:
4650
4664
  return cls(pipeline_response, None, {}) # type: ignore
4665
+
4666
+ @distributed_trace
4667
+ def get_debug_metrics(self, **kwargs: Any) -> str:
4668
+ """Get event metrics.
4669
+
4670
+ Returns debug metrics like the number of ingested events since mindnight UTC.
4671
+ The OpenMetrics Counter(s) reset every day at midnight UTC.
4672
+
4673
+ :return: str
4674
+ :rtype: str
4675
+ :raises ~azure.core.exceptions.HttpResponseError:
4676
+ """
4677
+ error_map = {
4678
+ 404: ResourceNotFoundError,
4679
+ 409: ResourceExistsError,
4680
+ 304: ResourceNotModifiedError,
4681
+ 401: lambda response: ClientAuthenticationError(response=response),
4682
+ }
4683
+ error_map.update(kwargs.pop("error_map", {}) or {})
4684
+
4685
+ _headers = kwargs.pop("headers", {}) or {}
4686
+ _params = kwargs.pop("params", {}) or {}
4687
+
4688
+ cls: ClsType[str] = kwargs.pop("cls", None)
4689
+
4690
+ _request = build_get_debug_metrics_request(
4691
+ headers=_headers,
4692
+ params=_params,
4693
+ )
4694
+ _request.url = self._client.format_url(_request.url)
4695
+
4696
+ _stream = False
4697
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
4698
+ _request, stream=_stream, **kwargs
4699
+ )
4700
+
4701
+ response = pipeline_response.http_response
4702
+
4703
+ if response.status_code not in [200]:
4704
+ if _stream:
4705
+ response.read() # Load the body in memory and close the socket
4706
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
4707
+ raise HttpResponseError(response=response)
4708
+
4709
+ if response.content:
4710
+ deserialized = response.json()
4711
+ else:
4712
+ deserialized = None
4713
+
4714
+ if cls:
4715
+ return cls(pipeline_response, cast(str, deserialized), {}) # type: ignore
4716
+
4717
+ return cast(str, deserialized) # type: ignore
@@ -32,6 +32,7 @@ from ..._operations._operations import (
32
32
  build_delete_feature_request,
33
33
  build_delete_meter_request,
34
34
  build_delete_subject_request,
35
+ build_get_debug_metrics_request,
35
36
  build_get_entitlement_history_request,
36
37
  build_get_entitlement_request,
37
38
  build_get_entitlement_value_request,
@@ -3946,3 +3947,56 @@ class ClientOperationsMixin(ClientMixinABC): # pylint: disable=too-many-public-
3946
3947
 
3947
3948
  if cls:
3948
3949
  return cls(pipeline_response, None, {}) # type: ignore
3950
+
3951
+ @distributed_trace_async
3952
+ async def get_debug_metrics(self, **kwargs: Any) -> str:
3953
+ """Get event metrics.
3954
+
3955
+ Returns debug metrics like the number of ingested events since mindnight UTC.
3956
+ The OpenMetrics Counter(s) reset every day at midnight UTC.
3957
+
3958
+ :return: str
3959
+ :rtype: str
3960
+ :raises ~azure.core.exceptions.HttpResponseError:
3961
+ """
3962
+ error_map = {
3963
+ 404: ResourceNotFoundError,
3964
+ 409: ResourceExistsError,
3965
+ 304: ResourceNotModifiedError,
3966
+ 401: lambda response: ClientAuthenticationError(response=response),
3967
+ }
3968
+ error_map.update(kwargs.pop("error_map", {}) or {})
3969
+
3970
+ _headers = kwargs.pop("headers", {}) or {}
3971
+ _params = kwargs.pop("params", {}) or {}
3972
+
3973
+ cls: ClsType[str] = kwargs.pop("cls", None)
3974
+
3975
+ _request = build_get_debug_metrics_request(
3976
+ headers=_headers,
3977
+ params=_params,
3978
+ )
3979
+ _request.url = self._client.format_url(_request.url)
3980
+
3981
+ _stream = False
3982
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
3983
+ _request, stream=_stream, **kwargs
3984
+ )
3985
+
3986
+ response = pipeline_response.http_response
3987
+
3988
+ if response.status_code not in [200]:
3989
+ if _stream:
3990
+ await response.read() # Load the body in memory and close the socket
3991
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
3992
+ raise HttpResponseError(response=response)
3993
+
3994
+ if response.content:
3995
+ deserialized = response.json()
3996
+ else:
3997
+ deserialized = None
3998
+
3999
+ if cls:
4000
+ return cls(pipeline_response, cast(str, deserialized), {}) # type: ignore
4001
+
4002
+ return cast(str, deserialized) # type: ignore
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openmeter
3
- Version: 1.0.0b112
3
+ Version: 1.0.0b113
4
4
  Summary: Client for OpenMeter: Real-Time and Scalable Usage Metering
5
5
  Home-page: https://openmeter.io
6
6
  License: Apache-2.0
@@ -2,7 +2,7 @@ openmeter/__init__.py,sha256=7klRT7LAGDqBcZsl7LGZrgrABVwyncgVUlidfaPiJm4,702
2
2
  openmeter/_client.py,sha256=TIXIPi_UVO-d5BHra7_xIiKmLfZBrmc4L_Xq2gxi4lM,3982
3
3
  openmeter/_configuration.py,sha256=CIdMxPaIXwDLaCsnvmdmHTfplV_cRp24101RJCEWtes,1807
4
4
  openmeter/_operations/__init__.py,sha256=GVYObnS1nT-wbN8ONRxlAiH6NBeAXlOBi7olGJE9niA,682
5
- openmeter/_operations/_operations.py,sha256=p8xH18hn-8Rtn9tihNKsUMlksXYq8cpJbgai23Dh8JA,201422
5
+ openmeter/_operations/_operations.py,sha256=lQKbTP9AzJ7D7WxLcifklxVZQJbuipNngyMZpmtNLRo,203710
6
6
  openmeter/_operations/_patch.py,sha256=ptSL-JhY1fbGT9Cw2cUkPF1TPz5qVgXwTMMT5h41XUc,4874
7
7
  openmeter/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
8
8
  openmeter/_serialization.py,sha256=vQIv-wuCQabtiIq2DXOr7-InGADqxlXTGNEKv9OlDPs,78873
@@ -11,11 +11,11 @@ openmeter/aio/__init__.py,sha256=7klRT7LAGDqBcZsl7LGZrgrABVwyncgVUlidfaPiJm4,702
11
11
  openmeter/aio/_client.py,sha256=O0VpMfw42UuTN_ZTIL3dw944PviLIrBBCSp7UaexyKQ,4100
12
12
  openmeter/aio/_configuration.py,sha256=NtT-cxQWkt8q_FvMfwqqil18Tt9zJmWGVju4U9s7OsE,1817
13
13
  openmeter/aio/_operations/__init__.py,sha256=GVYObnS1nT-wbN8ONRxlAiH6NBeAXlOBi7olGJE9niA,682
14
- openmeter/aio/_operations/_operations.py,sha256=Kq4xKSYitLlSStExwjehpB414cyS-NQ5o6BkLa9-WEo,175654
14
+ openmeter/aio/_operations/_operations.py,sha256=n_mBR5IyOPGMa5dkdHzAPqKZJqTe_cdh7C32Zr1U5Po,177576
15
15
  openmeter/aio/_operations/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
16
16
  openmeter/aio/_patch.py,sha256=P7PMm3Gbjlk56lI6B_Ra43hSW5qGMEmN3cNYGH5uZ3s,674
17
17
  openmeter/aio/_vendor.py,sha256=CFsSbXOBydpg_f_uciu6Pe6cvF__6ofZ6KFEhkaMMEU,862
18
18
  openmeter/py.typed,sha256=dcrsqJrcYfTX-ckLFJMTaj6mD8aDe2u0tkQG-ZYxnEg,26
19
- openmeter-1.0.0b112.dist-info/METADATA,sha256=i6MlrDxgY9IgaMBrqwL4B3f46ImTbE4DsBaUInIij_s,2258
20
- openmeter-1.0.0b112.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
21
- openmeter-1.0.0b112.dist-info/RECORD,,
19
+ openmeter-1.0.0b113.dist-info/METADATA,sha256=KnBsOcts-7CaX-8rFeI8etS1BoQErOrmOsOU7-eJSWU,2258
20
+ openmeter-1.0.0b113.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
21
+ openmeter-1.0.0b113.dist-info/RECORD,,