From 1c43c02d2e90b392980371bd4382a609fbdd7f06 Mon Sep 17 00:00:00 2001 From: Dylan Frankcom Date: Sun, 25 Aug 2024 14:36:33 -0400 Subject: [PATCH] #188067891: Update README, bump versions (#31) Update readme for EVENT_BATCH_TIMEOUT changes in moesifapi-python. Bump moesifasgi version. Bump moesifapi-python version requirement. --- README.md | 17 ++++++++++------- moesifasgi/middleware.py | 2 +- requirements.txt | 2 +- setup.py | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b1bd215..1ea8a25 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,9 @@ app.add_middleware(MoesifMiddleware, settings=moesif_settings) ``` Your Moesif Application Id can be found in the [_Moesif Portal_](https://www.moesif.com/). -After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps. +After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps. -You can always find your Moesif Application Id at any time by logging +You can always find your Moesif Application Id at any time by logging into the [_Moesif Portal_](https://www.moesif.com/), click on the top right menu, and then clicking _API Keys_. @@ -96,8 +96,11 @@ to associate this event with custom metadata. For example, you may want to save #### __`BATCH_SIZE`__ (optional) __int__, default 25, Maximum batch size when sending events to Moesif. +#### __`EVENT_BATCH_TIMEOUT`__ +(optional) __int__, default 1, Maximum time in seconds to wait before sending a batch of events to Moesif when reading from the queue + #### __`EVENT_QUEUE_SIZE`__ -(optional) __int__, default 1000000, the maximum number of event objects queued in memory pending upload to Moesif. If the queue is full additional calls to `MoesifMiddleware` will return immediately without logging the event, so this number should be set based on the expected event size and memory capacity +(optional) __int__, default 1000000, the maximum number of event objects queued in memory pending upload to Moesif. If the queue is full additional calls to `MoesifMiddleware` will return immediately without logging the event, so this number should be set based on the expected event size and memory capacity. #### __`AUTHORIZATION_HEADER_NAME`__ (optional) _string_, A request header field name used to identify the User in Moesif. Default value is `authorization`. Also, supports a comma separated string. We will check headers in order like `"X-Api-Key,Authorization"`. @@ -108,7 +111,7 @@ to associate this event with custom metadata. For example, you may want to save #### __`BASE_URI`__ (optional) _string_, A local proxy hostname when sending traffic via secure proxy. Please set this field when using secure proxy. For more details, refer [secure proxy documentation.](https://www.moesif.com/docs/platform/secure-proxy/#2-configure-moesif-sdk) -### Options specific to outgoing API calls +### Options specific to outgoing API calls The options below are applicable to outgoing API calls (calls you initiate using the Python [Requests](http://docs.python-requests.org/en/master/) lib to third parties like Stripe or to your own services). @@ -117,11 +120,11 @@ For options that use the request and response as input arguments, these use the If you are not using ASGI, you can import the [moesifpythonrequest](https://github.com/Moesif/moesifpythonrequest) directly. #### __`CAPTURE_OUTGOING_REQUESTS`__ -_boolean_, Default False. Set to True to capture all outgoing API calls. False will disable this functionality. +_boolean_, Default False. Set to True to capture all outgoing API calls. False will disable this functionality. ##### __`GET_METADATA_OUTGOING`__ -(optional) _(req, res) => dictionary_, a function that enables you to return custom metadata associated with the logged API calls. -Takes in the [Requests](http://docs.python-requests.org/en/master/api/) request and response object as arguments. You should implement a function that +(optional) _(req, res) => dictionary_, a function that enables you to return custom metadata associated with the logged API calls. +Takes in the [Requests](http://docs.python-requests.org/en/master/api/) request and response object as arguments. You should implement a function that returns a dictionary containing your custom metadata. (must be able to be encoded into JSON). For example, you may want to save a VM instance_id, a trace_id, or a resource_id with the request. ##### __`SKIP_OUTGOING`__ diff --git a/moesifasgi/middleware.py b/moesifasgi/middleware.py index 0fdf9dc..038355e 100644 --- a/moesifasgi/middleware.py +++ b/moesifasgi/middleware.py @@ -88,7 +88,7 @@ def schedule_config_job(self): def initialize_config(self): Configuration.BASE_URI = self.settings.get("BASE_URI", "https://api.moesif.net") - Configuration.version = 'moesifasgi-python/1.0.6' + Configuration.version = 'moesifasgi-python/1.0.7' self.LOG_BODY = self.settings.get("LOG_BODY", True) self.app_config = AppConfig() diff --git a/requirements.txt b/requirements.txt index 4354173..712643b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ nose>=1.3.7 -moesifapi>=1.4.9 +moesifapi>=1.5.0 moesifpythonrequest>=0.3.3 starlette>=0.16.0 diff --git a/setup.py b/setup.py index 0031d52..be42c92 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='1.0.6', + version='1.0.7', description='Moesif Middleware for Python ASGI based platforms (FastAPI & Others)', long_description=long_description, @@ -81,7 +81,7 @@ # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html - install_requires=['starlette>=0.16.0', 'moesifapi>=1.4.9', 'moesifpythonrequest>=0.3.3'], + install_requires=['starlette>=0.16.0', 'moesifapi>=1.5.0', 'moesifpythonrequest>=0.3.3'], # List additional groups of dependencies here (e.g. development # dependencies). You can install these using the following syntax,