diff --git a/README.md b/README.md index 07800cc..0819af5 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,7 @@ You can pre-save all of your Apprise configuration and/or set of Apprise URLs an | `/notify/{KEY}` | POST | Sends notification(s) to all of the end points you've previously configured associated with a *{KEY}*.
*Payload Parameters*
📌 **body**: Your message body. This is the *only* required field.
📌 **title**: Optionally define a title to go along with the *body*.
📌 **type**: Defines the message type you want to send as. The valid options are `info`, `success`, `warning`, and `failure`. If no *type* is specified then `info` is the default value used.
📌 **tag**: Optionally notify only those tagged accordingly. Use a comma (`,`) to `OR` your tags and a space (` `) to `AND` them. More details on this can be seen documented below.
📌 **format**: Optionally identify the text format of the data you're feeding Apprise. The valid options are `text`, `markdown`, `html`. The default value if nothing is specified is `text`. | `/json/urls/{KEY}` | GET | Returns a JSON response object that contains all of the URLS and Tags associated with the key specified. | `/details` | GET | Set the `Accept` Header to `application/json` and retrieve a JSON response object that contains all of the supported Apprise URLs. See [here for more details](https://github.com/caronc/apprise/wiki/Development_Apprise_Details#apprise-details) +| `/metrics` | GET | Prometheus endpoint for _basic_ Metrics Collection & Analysis and/or Observability. As an example, the `/json/urls/{KEY}` response might return something like this: @@ -784,3 +785,6 @@ The colon `:` prefix is the switch that starts the re-mapping rule engine. You 1. `:existing_key=`: By setting no value, the existing key is simply removed from the payload entirely 1. `:expected_key=A value to give it`: You can also fix an expected apprise key to a pre-generated string value. + +## Metrics Collection & Analysis +Basic Prometheus support added through `/metrics` reference point. diff --git a/apprise_api/core/settings/__init__.py b/apprise_api/core/settings/__init__.py index d21cea3..bda827c 100644 --- a/apprise_api/core/settings/__init__.py +++ b/apprise_api/core/settings/__init__.py @@ -61,12 +61,17 @@ # Apprise API 'api', + + # Prometheus + 'django_prometheus', ] MIDDLEWARE = [ + 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'django.middleware.common.CommonMiddleware', 'core.middleware.theme.AutoThemeMiddleware', 'core.middleware.config.DetectConfigMiddleware', + 'django_prometheus.middleware.PrometheusAfterMiddleware', ] ROOT_URLCONF = 'core.urls' @@ -129,6 +134,9 @@ APPRISE_DEFAULT_CONFIG_ID = \ os.environ.get('APPRISE_DEFAULT_CONFIG_ID', 'apprise') +# Define our Prometheus Namespace +PROMETHEUS_METRIC_NAMESPACE = "apprise" + # Static files relative path (CSS, JavaScript, Images) STATIC_URL = BASE_URL + '/s/' diff --git a/apprise_api/core/urls.py b/apprise_api/core/urls.py index eb4acd6..04e87fe 100644 --- a/apprise_api/core/urls.py +++ b/apprise_api/core/urls.py @@ -29,4 +29,5 @@ urlpatterns = [ path('', include(api_urls)), + path('', include('django_prometheus.urls')), ] diff --git a/requirements.txt b/requirements.txt index 598fb37..17a71a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,3 +24,6 @@ requests paho-mqtt < 2.0.0 gntp cryptography + +# prometheus metrics +django-prometheus