From aa806e814dc194cff81cc08e7c29a7d7e2e0c4db Mon Sep 17 00:00:00 2001 From: Alberto Donato Date: Mon, 9 Dec 2024 17:14:05 +0100 Subject: [PATCH] Version 3.0 --- CHANGES.rst | 21 +++++++++++++++++++++ README.rst | 8 ++++---- prometheus_aioexporter/__init__.py | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2440814..3a7966c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,24 @@ +3.0.0 - 2024-12-13 +================== + +- Rework ``PrometheusExporterScript`` class, using ``click`` for command line + parsing. +- Rework logging based on ``structlog``, support structured logging output as + JSON. +- Support reading configuration options from environment variables. +- Support reading configuration from `.env` file. + +**Note**: this version contains incompatible changes with the ``2.x`` series: +- Command-line parsing is now provided by the ``click`` library. To provide + additional command-line options, the ``command_line_parameters()`` method + should be implemented, returning a list of ``click.Parameter`` subclasses + (e.g. ``click.Option`` or ``click.Argument``) +- The ``structlog`` library is used for logging, providing support for + structured logging. The logger API is essentially backwards compatible with + the builtin ``logging`` module, with the added ability of passing keyword + arguments for structured logging. + + 2.1.0 - 2024-11-20 ================== diff --git a/README.rst b/README.rst index e203df3..072e739 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ Asyncio library for creating Prometheus exporters |Latest Version| |Build Status| ``prometheus-aioexporter`` is an aysncio-based library to simplify writing -Prometheus_ exporters. +Prometheus_ exporters in Python. Exporters are usually implemented as small daemons that expose metrics in text format through a web endpoint (usually ``/metrics``). @@ -51,14 +51,14 @@ An example usage is the following: self, application: aiohttp.web.Application ) -> None: # Start other asyncio tasks at application startup - use(self.data) + do_something_with(self.data) # ... async def on_application_shutdown( self, application: aiohttp.web.Application ) -> None: # Stop other asyncio tasks at application shutdown - use(self.data) + do_more_with(self.data) # ... @@ -177,7 +177,7 @@ implementing the ``on_application_startup`` and ``on_application_shutdown`` coroutine methods, which are called with the application as parameter. The ``PrometheusExporter`` instance is accessible via -``application['exporter']``), and provides a ``set_metric_update_handler`` +``application["exporter"]``), and provides a ``set_metric_update_handler`` method to register a hook to update metrics on each request, before the response is returned to the client. The registered function must return a coroutine and is called with a dict mapping metric names to metric objects: diff --git a/prometheus_aioexporter/__init__.py b/prometheus_aioexporter/__init__.py index 6ac6ce0..3e76416 100644 --- a/prometheus_aioexporter/__init__.py +++ b/prometheus_aioexporter/__init__.py @@ -16,4 +16,4 @@ "__version__", ] -__version__ = "2.1.0" +__version__ = "3.0.0"