Skip to content

Commit

Permalink
Release 0.41.0 (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
zippolyte authored Apr 15, 2021
1 parent 33f727c commit 8bb75df
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 41 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Ensure labels"
on: # yamllint disable-line rule:truthy
pull_request:
types:
- labeled
- unlabeled
- opened
- synchronize
- reopened
- ready_for_review

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Check changelog labels
if: github.event.pull_request.draft == false && false == contains(join(github.event.pull_request.labels.*.name, ','), 'changelog/')
run: |-
echo "::error Add 'changelog/*' label";
exit 1;
- name: OK
run: echo "Thank you!"
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
pull_request:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on Ubuntu 20.04
runs-on: ubuntu-20.04
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v2
# Include all history and tags, needed for building the right version
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.9'

- name: Install datadog_checks_dev
run: |
python -m pip install datadog_checks_dev[cli]
- name: Set ddev pypi credentials
run: |
ddev config set pypi.user __token__
ddev config set pypi.pass ${{ secrets.PYPI_TOKEN }}
- name: Publish the wheel to PyPI
run: |
ddev release upload . --sdist
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
CHANGELOG
=========
# Changelog

## 0.41.0 / 2021-04-15

* [Fixed] Fix decorator dependency for Python 2.7. See [#646](https://github.com/DataDog/datadogpy/pull/646). Thanks [artem888881](https://github.com/artem888881).
* [Fixed] [dogstatsd] Fix buffer operation thread-safety. See [#642](https://github.com/DataDog/datadogpy/pull/642).
* [Fixed] [dogstatsd] Improve performance of telemetry serialization. See [#641](https://github.com/DataDog/datadogpy/pull/641).

## 0.40.1 / 2021-03-01

* [Fixed] Fix blocking connections in dogstatsd. See [#634](https://github.com/DataDog/datadogpy/pull/634).
Expand Down
20 changes: 9 additions & 11 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ Our team will trigger the release pipeline.
- Install [datadog_checks_dev](https://datadog-checks-base.readthedocs.io/en/latest/datadog_checks_dev.cli.html#installation) using Python 3.
- Setup PyPI, see the internal documentation for more details

### Update Changelog
#### Commands
- See changes ready for release by running `ddev release show changes .` at the root of this project. Add any missing labels to PRs if needed.
- Run `ddev release changelog . <NEW_VERSION>` to update the `CHANGELOG.md` file at the root of this repository
- Commit the changes to the repository in a release branch and open a PR. Do not merge yet.
### Update Changelog and version

### Release
1. See changes ready for release by running `ddev release show changes .` at the root of this project. Add any missing labels to PRs if needed.
1. Run `ddev release changelog . <NEW_VERSION>` to update the `CHANGELOG.md` file at the root of this repository
1. Commit the changes to the repository in a release branch and open a PR. Do not merge yet.
1. Bump the version in [`datadog/version.py`](datadog/version.py) and push it to your changelog PR. [Example](https://github.com/DataDog/datadogpy/pull/495/files#diff-2eeaed663bd0d25b7e608891384b7298)
1. Merge the PR to master.
1. Create the release on GitHub. [Example](https://github.com/DataDog/datadogpy/releases/tag/v0.33.0)
1. Checkout the tag created at the previous step.
1. Run `ddev release build .` and `ddev release upload --sdist . `.
- Make sure that both an `sdist` and a [universal wheel](https://packaging.python.org/guides/distributing-packages-using-setuptools/#universal-wheels) have been uploaded to [PyPI](https://pypi.python.org/pypi/datadog/).
1. Bump the version again in `datadog/version.py` to a dev version (e.g. `0.34.0` -> `0.34.1.dev`), open a PR and merge it to master.

### Release
1. Create the release on GitHub. [Example](https://github.com/DataDog/datadogpy/releases/tag/0.40.0)
1. A github action will kick off that builds and publishes this tag to PyPI. Confirm the [release is available](https://pypi.org/project/datadog/#history)
1. Bump the version again in `datadog/version.py` to a dev version (e.g. `0.34.0` -> `0.34.1.dev`), open a PR and merge it to master.
45 changes: 27 additions & 18 deletions datadog/dogstatsd/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@
# Telemetry pre-computed formatting string. Pre-computation
# increases throughput of composing the result by 2-15% from basic
# '%'-based formatting with a `join`.
TELEMETRY_FORMATTING_STR = "\n".join([
"datadog.dogstatsd.client.metrics:%s|c|#%s",
"datadog.dogstatsd.client.events:%s|c|#%s",
"datadog.dogstatsd.client.service_checks:%s|c|#%s",
"datadog.dogstatsd.client.bytes_sent:%s|c|#%s",
"datadog.dogstatsd.client.bytes_dropped:%s|c|#%s",
"datadog.dogstatsd.client.packets_sent:%s|c|#%s",
"datadog.dogstatsd.client.packets_dropped:%s|c|#%s",
])
TELEMETRY_FORMATTING_STR = "\n".join(
[
"datadog.dogstatsd.client.metrics:%s|c|#%s",
"datadog.dogstatsd.client.events:%s|c|#%s",
"datadog.dogstatsd.client.service_checks:%s|c|#%s",
"datadog.dogstatsd.client.bytes_sent:%s|c|#%s",
"datadog.dogstatsd.client.bytes_dropped:%s|c|#%s",
"datadog.dogstatsd.client.packets_sent:%s|c|#%s",
"datadog.dogstatsd.client.packets_dropped:%s|c|#%s",
]
)


class DogStatsd(object):
Expand Down Expand Up @@ -374,8 +376,8 @@ def close_buffer(self):
invocation.
"""

if not hasattr(self, 'buffer'):
raise BufferError('Cannot close buffer that was never opened')
if not hasattr(self, "buffer"):
raise BufferError("Cannot close buffer that was never opened")

try:
self._send = self._send_to_server
Expand Down Expand Up @@ -591,13 +593,20 @@ def _flush_telemetry(self):
telemetry_tags = ",".join(self._add_constant_tags(self._client_tags))

return TELEMETRY_FORMATTING_STR % (
self.metrics_count, telemetry_tags,
self.events_count, telemetry_tags,
self.service_checks_count, telemetry_tags,
self.bytes_sent, telemetry_tags,
self.bytes_dropped, telemetry_tags,
self.packets_sent, telemetry_tags,
self.packets_dropped, telemetry_tags
self.metrics_count,
telemetry_tags,
self.events_count,
telemetry_tags,
self.service_checks_count,
telemetry_tags,
self.bytes_sent,
telemetry_tags,
self.bytes_dropped,
telemetry_tags,
self.packets_sent,
telemetry_tags,
self.packets_dropped,
telemetry_tags,
)

def _is_telemetry_flush_time(self):
Expand Down
2 changes: 1 addition & 1 deletion datadog/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.41.0.dev"
__version__ = "0.41.0"
16 changes: 7 additions & 9 deletions tests/unit/dogstatsd/test_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,15 +738,13 @@ def batch_metrics(index, dsd):

# This is a bit of a tricky thing to test for - initially only our data packet is
# sent but then telemetry is flushed/reset and the subsequent metric xmit includes
# the telemetry data for the previous packet. The reason for 726 -> 727 increase is
# because packet #2 sends a three digit byte count ("726") that then increases the
# next metric size by 1 byte.
expected_xfer_metrics = [
(33, 1),
(726, 2),
(727, 2),
(727, 2),
]
# the telemetry data for the previous packet.
expected_xfer_metrics = [(33, 1)]
for i in range(num_threads - 1):
expected_xfer_metrics.append(
(33 + len(telemetry_metrics(
metrics=2, bytes_sent=expected_xfer_metrics[i][0], packets_sent=expected_xfer_metrics[i][1]
)), 2))

for idx in range(num_threads):
expected_message = "page.%d.views:123|g\ntimer.%d:123|ms" % (idx, idx)
Expand Down

0 comments on commit 8bb75df

Please sign in to comment.