Skip to content

Commit

Permalink
Version bump, changelog, doc restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKs committed Nov 12, 2020
2 parents acdbb83 + 15ffee6 commit 475e311
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -40,7 +40,7 @@ jobs:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9" ]
django-version: [ "3.1.1", "3.1.2" ]
django-version: [ "3.1.1", "3.1.2", "3.1.3" ]
steps:
- name: Check out repository
uses: actions/checkout@v2
Expand Down
40 changes: 24 additions & 16 deletions CHANGELOG.rst
@@ -1,8 +1,15 @@
Changelog
=========

`3.0.1`_ - 12.11.2020
---------------------

**Bugfix**

* Importing an integration before a `SECRET_KEY` was set would cause a circular import.


`3.0.0`_ - 2020-11-04 - Full Django3.1+(ASGI/async) support!
`3.0.0`_ - 28.10.2020 - Full Django3.1+(ASGI/async) support!
------------------------------------------------------------
Brings full async/ASGI (as well as the old WSGI) support to Django GUID using ContextVars instead of thread locals.

Expand All @@ -15,7 +22,7 @@ If you've already implemented ``django-guid`` in your project and are currently
see the `upgrading docs`_.


`2.2.0`_ - 2020-11-04
`2.2.0`_ - 04.11.2020
---------------------
**Features**

Expand All @@ -26,7 +33,7 @@ see the `upgrading docs`_.
* Added docs for the new setting


`2.1.0`_ - 2020-11-03
`2.1.0`_ - 03.11.2020
---------------------
**Features**

Expand All @@ -38,7 +45,7 @@ see the `upgrading docs`_.
* Added docs for integrations


`2.0.0`_ - 2020-03-02
`2.0.0`_ - 02.03.2020
---------------------
**This version contains backwards incompatible changes. Read the entire changelog before upgrading**

Expand All @@ -58,15 +65,15 @@ see the `upgrading docs`_.
* Restructured README and docs.


`1.1.1`_ - 2020-02-12
`1.1.1`_ - 12.02.2020
---------------------

**Improvements**

* Fixed ``EXPOSE_HEADER`` documentation issue. New release has to be pushed to fix PyPi docs.


`1.1.0`_ - 2020-02-10
`1.1.0`_ - 10.02.2020
---------------------

**Features**
Expand All @@ -75,7 +82,7 @@ see the `upgrading docs`_.



`1.0.1`_ - 2020-02-08
`1.0.1`_ - 08.02.2020
---------------------

**Bugfix**
Expand All @@ -96,7 +103,7 @@ see the `upgrading docs`_.



`1.0.0`_ - 2020-01-14
`1.0.0`_ - 14.01.2020
---------------------

**Features**
Expand All @@ -120,7 +127,7 @@ see the `upgrading docs`_.



`0.3.1`_ - 2020-01-13
`0.3.1`_ - 13.01.2020
---------------------

**Improvements**
Expand All @@ -135,7 +142,7 @@ see the `upgrading docs`_.



`0.3.0`_ - 2020-01-10
`0.3.0`_ - 10.01.2020
---------------------

**Features**
Expand All @@ -149,7 +156,7 @@ see the `upgrading docs`_.
* Improved the README with more information and a list of all the available settings


`0.2.3`_ - 2020-01-09
`0.2.3`_ - 09.01.2020
---------------------

**Improvements**
Expand All @@ -161,31 +168,31 @@ see the `upgrading docs`_.
* Improved logging


`0.2.2`_ - 2019-12-21
`0.2.2`_ - 21.12.2019
---------------------

**Improvements**

* Removed the mandatory DJANGO_GUID settings in settings.py. Added an example project to demonstrate how to set the project up


`0.2.1`_ - 2019-12-21
`0.2.1`_ - 21.12.2019
---------------------

**Improvements**

* Workflow added, better docstrings, easier to read flow


`0.2.0`_ - 2019-12-21
`0.2.0`_ - 21.12.2019
---------------------

**Features**

* Header name and header GUID validation can be specified through Django settings

2019-12-20
------------------
20.10.2019
----------

* Initial release

Expand All @@ -205,3 +212,4 @@ see the `upgrading docs`_.
.. _2.2.0: https://github.com/snok/django-guid/compare/2.1.0...2.2.0
.. _3.0.0: https://github.com/snok/django-guid/compare/2.2.0...3.0.0
.. _upgrading docs: https://django-guid.readthedocs.io/en/latest/upgrading.html
.. _3.0.1: https://github.com/snok/django-guid/compare/3.0.0...3.0.1
6 changes: 2 additions & 4 deletions demoproj/views/async_views.py
Expand Up @@ -16,10 +16,8 @@ async def index_view(request: HttpRequest) -> JsonResponse:
:return: JsonResponse
"""
logger.info('This log message should have a GUID')
loop = asyncio.get_event_loop()

task_one = loop.create_task(useless_function())
task_two = loop.create_task(useless_function())
task_one = asyncio.create_task(useless_function())
task_two = asyncio.create_task(useless_function())
results = await asyncio.gather(task_one, task_two)
return JsonResponse({'detail': f'It worked! Useless function response is {results}'})

Expand Down
2 changes: 1 addition & 1 deletion django_guid/__init__.py
@@ -1,4 +1,4 @@
from django_guid.api import clear_guid, get_guid, set_guid # noqa F401

__version__ = '3.0.0'
__version__ = '3.0.1'
default_app_config = 'django_guid.apps.DjangoGuidConfig'
104 changes: 104 additions & 0 deletions docs/configuration.rst
@@ -0,0 +1,104 @@
*************
Configuration
*************

Once django guid has been installed, add the following to your projects' ``settings.py``:


1. Installed Apps
-----------------

Add :code:`django_guid` to your :code:`INSTALLED_APPS`:

.. code-block:: python
INSTALLED_APPS = [
...
'django_guid',
]
2. Middleware
-------------

Add the :code:`django_guid.middleware.guid_middleware` to your ``MIDDLEWARE``:

.. code-block:: python
MIDDLEWARE = [
'django_guid.middleware.guid_middleware',
...
]
It is recommended that you add the middleware at the top, so that the remaining middleware loggers include the requests GUID.

3. Logging Configuration
------------------------

Add :code:`django_guid.log_filters.CorrelationId` as a filter in your ``LOGGING`` configuration:

.. code-block:: python
LOGGING = {
...
'filters': {
'correlation_id': {
'()': 'django_guid.log_filters.CorrelationId'
}
}
}
Put that filter in your handler:

.. code-block:: python
LOGGING = {
...
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'medium',
'filters': ['correlation_id'],
}
}
}
And make sure to add the new ``correlation_id`` filter to one or all of your formatters:

.. code-block:: python
LOGGING = {
...
'formatters': {
'medium': {
'format': '%(levelname)s %(asctime)s [%(correlation_id)s] %(name)s %(message)s'
}
}
}
If these settings were confusing, please have a look in the demo projects'
`settings.py <https://github.com/JonasKs/django-guid/blob/master/demoproj/settings.py>`_ file for a complete example.

4. Django GUID Logger (Optional)
--------------------------------

If you wish to see the Django GUID middleware outputs, you may configure a logger for the module.
Simply add django_guid to your loggers in the project, like in the example below:

.. code-block:: python
LOGGING = {
...
'loggers': {
'django_guid': {
'handlers': ['console', 'logstash'],
'level': 'WARNING',
'propagate': False,
}
}
}
This is especially useful when implementing the package, if you plan to pass existing GUIDs to the middleware, as misconfigured GUIDs will not raise exceptions, but will generate warning logs.
3 changes: 2 additions & 1 deletion docs/index.rst
Expand Up @@ -114,12 +114,13 @@ Contents
:maxdepth: 3

install
upgrading
configuration
settings
api
integrations
extended_example
troubleshooting
contributing
upgrading
publish
changelog

0 comments on commit 475e311

Please sign in to comment.