Merge pull request #14 from dave-shawley/quiet-now

Remove debug logging of "processing metric"
This commit is contained in:
Gavin M. Roy 2023-07-28 11:17:27 -04:00 committed by GitHub
commit c39b1ff6c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 31 deletions

View file

@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository == 'sprockets/sprockets-statsd' if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository == 'sprockets/sprockets-statsd'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install python - name: Install python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.7 # use 3.7 for wheel compatibility python-version: 3.7 # use 3.7 for wheel compatibility
- name: Install builder - name: Install builder
@ -22,7 +22,7 @@ jobs:
run: | run: |
python -m build --sdist --wheel --outdir dist/ . python -m build --sdist --wheel --outdir dist/ .
- name: Upload packages - name: Upload packages
uses: pypa/gh-action-pypi-publish@v1.4.2 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__
password: ${{ secrets.PYPI_PASSWORD }} password: ${{ secrets.PYPI_PASSWORD }}

View file

@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: [3.7, 3.8, 3.9] python-version: [3.8, 3.9, 3.11]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install python ${{ matrix.python-version }} - name: Install python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
@ -42,7 +42,7 @@ jobs:
coverage report coverage report
coverage xml -o ./coverage.xml coverage xml -o ./coverage.xml
- name: Send coverage to codecov.io - name: Send coverage to codecov.io
uses: codecov/codecov-action@v1.3.2 uses: codecov/codecov-action@v3.1.4
with: with:
token: ${{secrets.CODECOV_TOKEN}} token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.xml file: ./coverage.xml
@ -50,7 +50,7 @@ jobs:
fail_ci_if_error: true fail_ci_if_error: true
- name: Save coverage report - name: Save coverage report
if: ${{ matrix.python-version == '3.9' }} if: ${{ matrix.python-version == '3.9' }}
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: coverage.xml name: coverage.xml
path: ./coverage.xml path: ./coverage.xml

2
.gitignore vendored
View file

@ -4,3 +4,5 @@ env/
*.egg-info *.egg-info
*.pyc *.pyc
.* .*
!/.gitignore
!/.github

View file

@ -1,15 +1,18 @@
version: 2 version: 2
build:
os: "ubuntu-22.04"
tools:
python: "3.11"
sphinx: sphinx:
builder: html builder: html
configuration: docs/conf.py configuration: docs/conf.py
fail_on_warning: true fail_on_warning: true
python: python:
version: 3.7
install: install:
- method: pip - method: pip
path: . path: .
extra_requirements: extra_requirements:
- readthedocs - readthedocs
system_packages: true

View file

@ -1,3 +1,8 @@
Next
----
- Removed debug-level logging of processing metric
- Stop testing Python 3.7
:tag:`1.0.0 <0.1.0...1.0.0>` (20-Jul-2021) :tag:`1.0.0 <0.1.0...1.0.0>` (20-Jul-2021)
------------------------------------------ ------------------------------------------
- Added ``Connector.timer`` method (addresses :issue:`8`) - Added ``Connector.timer`` method (addresses :issue:`8`)

View file

@ -1,4 +1,4 @@
Copyright 2021 AWeber Communications, Inc. Copyright 2021-2023 AWeber Communications, Inc.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:

View file

@ -3,8 +3,10 @@ import sprockets_statsd
project = 'sprockets-statsd' project = 'sprockets-statsd'
version = sprockets_statsd.version version = sprockets_statsd.version
copyright = '2021 AWeber Communications, Inc.' copyright = '2021 AWeber Communications, Inc.'
html_theme = 'pyramid' html_theme = 'python_docs_theme'
extensions = [] extensions = []
html_static_path = ['.']
html_css_files = ['custom.css']
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
extensions.append('sphinx.ext.autodoc') extensions.append('sphinx.ext.autodoc')
@ -19,9 +21,10 @@ intersphinx_mapping = {
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
extensions.append('sphinx.ext.extlinks') extensions.append('sphinx.ext.extlinks')
extlinks = { extlinks = {
'issue': ("https://github.com/sprockets/sprockets-statsd/issues/%s", "#"), 'issue':
("https://github.com/sprockets/sprockets-statsd/issues/%s", "#%s"),
'tag': ("https://github.com/sprockets/sprockets-statsd/compare/%s", "%s"), 'tag': ("https://github.com/sprockets/sprockets-statsd/compare/%s", "%s"),
} }
# https://pypi.org/project/sphinx-autodoc-typehints/ # https://pypi.org/project/sphinx-autodoc-typehints/
extensions.append('sphinx_autodoc_typehints') # extensions.append('sphinx_autodoc_typehints')

1
docs/custom.css Normal file
View file

@ -0,0 +1 @@
div.sphinxsidebarwrapper { overflow-x: scroll }

View file

@ -23,6 +23,7 @@ classifiers =
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Communications Topic :: Communications
Topic :: Internet Topic :: Internet
Topic :: Software Development Topic :: Software Development
@ -36,18 +37,17 @@ install_requires =
tornado = tornado =
tornado>=5 tornado>=5
dev = dev =
asynctest==0.13.0 coverage==7.2.7
coverage==5.5
flake8==3.9.2 flake8==3.9.2
flake8-import-order==0.18.1 flake8-import-order==0.18.1
sphinx==4.1.1 python-docs-theme==2023.5
sphinx-autodoc-typehints==1.12.0 sphinx>=7,<8
sprockets.http==2.2.0 sprockets.http==2.2.0
tornado>=5 tornado>=5
yapf==0.31.0 yapf==0.31.0
readthedocs = readthedocs =
sphinx==4.1.1 python-docs-theme==2023.5
sphinx-autodoc-typehints==1.12.0 sphinx>=7,<8
tornado>=5 tornado>=5
[options.packages.find] [options.packages.find]

View file

@ -636,7 +636,6 @@ class Processor:
try: try:
metric = await asyncio.wait_for(self.queue.get(), metric = await asyncio.wait_for(self.queue.get(),
self._wait_timeout) self._wait_timeout)
self.logger.debug('received %r from queue', metric)
self.queue.task_done() self.queue.task_done()
except asyncio.TimeoutError: except asyncio.TimeoutError:
# we still want to invoke the protocol send in case # we still want to invoke the protocol send in case

View file

@ -6,23 +6,16 @@ import time
import typing import typing
import unittest.mock import unittest.mock
import asynctest
from sprockets_statsd import statsd from sprockets_statsd import statsd
from tests import helpers from tests import helpers
class ProcessorTestCase(asynctest.TestCase): class ProcessorTestCase(unittest.IsolatedAsyncioTestCase):
ip_protocol: int ip_protocol: int
async def setUp(self): def setUp(self):
self.test_timeout = 5.0 self.test_timeout = 5.0
super().setUp() super().setUp()
await self.asyncSetUp()
async def tearDown(self):
await self.asyncTearDown()
super().tearDown()
async def wait_for(self, fut): async def wait_for(self, fut):
try: try:
@ -31,6 +24,7 @@ class ProcessorTestCase(asynctest.TestCase):
self.fail('future took too long to resolve') self.fail('future took too long to resolve')
async def asyncSetUp(self): async def asyncSetUp(self):
await super().asyncSetUp()
self.statsd_server = helpers.StatsdServer(self.ip_protocol) self.statsd_server = helpers.StatsdServer(self.ip_protocol)
self.statsd_task = asyncio.create_task(self.statsd_server.run()) self.statsd_task = asyncio.create_task(self.statsd_server.run())
await self.statsd_server.wait_running() await self.statsd_server.wait_running()
@ -38,6 +32,7 @@ class ProcessorTestCase(asynctest.TestCase):
async def asyncTearDown(self): async def asyncTearDown(self):
self.statsd_server.close() self.statsd_server.close()
await self.statsd_server.wait_closed() await self.statsd_server.wait_closed()
await super().asyncTearDown()
class ProcessorTests(ProcessorTestCase): class ProcessorTests(ProcessorTestCase):

11
tox.ini
View file

@ -1,5 +1,5 @@
[tox] [tox]
envlist = lint,distcheck,py37,py38,py39,tornado5 envlist = lint,distcheck,py38,py39,py311,tornado5,docs
toxworkdir = ./build/tox toxworkdir = ./build/tox
[testenv] [testenv]
@ -14,6 +14,8 @@ commands =
yapf -dr sprockets_statsd tests setup.py docs/conf.py yapf -dr sprockets_statsd tests setup.py docs/conf.py
[testenv:distcheck] [testenv:distcheck]
allowlist_externals =
rm
deps = deps =
twine twine
wheel wheel
@ -25,6 +27,13 @@ commands =
rm -fr {envtmpdir}/dist rm -fr {envtmpdir}/dist
[testenv:tornado5] [testenv:tornado5]
base_python = py39
deps = deps =
tornado>=5,<6 tornado>=5,<6
.[dev] .[dev]
[testenv:docs]
deps =
.[readthedocs]
commands =
python -m sphinx -b html -aE docs build/sphinx