Skip to content

Commit

Permalink
[chore] improve docstrings a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gr1N committed Nov 29, 2019
1 parent 4f107b0 commit 82a0cdc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 0.9.0 (2019-XX-XX)

- Added sample rate as class attribute, for setting sample rate class-wide, #11 by @aviramha
- Added timer contextmanager for easily timing events, #12 by @aviramha
- Added timer context manager for easily timing events, #12 by @aviramha
- Added Python 3.8.* support, #7

## 0.8.0 (2019-11-03)
Expand Down
13 changes: 6 additions & 7 deletions aiodogstatsd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ def __init__(
"""
Initialize a client object.
You can pass host and port of the DogStatsD server, namespace to prefix all
metric names, constant tags to attach to all metrics.
You can pass `host` and `port` of the DogStatsD server, `namespace` to prefix
all metric names, `constant_tags` to attach to all metrics.
Also, you can specify default read timeout which will be used to read messages
from an AsyncIO queue, and you can specify close timeout which will be used
as wait time for client closing.
sample_rate can be used for adjusting the frequency of stats sending.
Also, you can specify: `read_timeout` which will be used to read messages from
an AsyncIO queue; `close_timeout` which will be used as wait time for client
closing; `sample_rate` can be used for adjusting the frequency of stats sending.
"""
self._host = host
self._port = port
Expand Down Expand Up @@ -234,7 +233,7 @@ def timeit(
sample_rate: Optional[typedefs.MSampleRate] = None,
) -> Iterator[None]:
"""
Context for easily timing methods
Context manager for easily timing methods.
"""
loop = get_event_loop()
started_at = loop.time()
Expand Down
15 changes: 8 additions & 7 deletions aiodogstatsd/contrib/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ async def middleware(
loop = get_event_loop()
request_started_at = loop.time()

# By default response status is 500 because we don't want to write any logic
# for catching exceptions except exceptions which inherited from `web.HTTPException`.
# And also we will override response status in case of any successful handler execution.
# By default response status is 500 because we don't want to write any logic for
# catching exceptions except exceptions which inherited from
# `web.HTTPException`. And also we will override response status in case of any
# successful handler execution.
response_status = cast(int, HTTPStatus.INTERNAL_SERVER_ERROR.value)

try:
Expand Down Expand Up @@ -109,10 +110,10 @@ def _proceed_collecting(

def _derive_request_path(request: web.Request) -> str:
"""
AIOHTTP has a lot of different route resources like DynamicResource and we need
to process them correctly to get a valid original request path, so if you found
an issue with the request path in your metrics then you need to go here and
extend deriving logic.
AIOHTTP has a lot of different route resources like DynamicResource and we need to
process them correctly to get a valid original request path, so if you found an
issue with the request path in your metrics then you need to go here and extend
deriving logic.
"""
if isinstance(request.match_info.route.resource, DynamicResource):
return request.match_info.route.resource.canonical
Expand Down

0 comments on commit 82a0cdc

Please sign in to comment.