Skip to content

Commit

Permalink
fix(deps): update minor updates (master) (#225)
Browse files Browse the repository at this point in the history
* fix(deps): update minor updates

* fix: support timestamps in prometheus 0.18

prometheus/client_python#967 jiggers with
the format of multiprocess metrics in a way that broke our custom
aggregation.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jakob van Santen <jvansanten@gmail.com>
  • Loading branch information
renovate[bot] and jvansanten committed Jan 8, 2024
1 parent afc7834 commit bd47d3c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
poetry run sphinx-build docs/sphinx public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.9.2
uses: peaceiris/actions-gh-pages@v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
10 changes: 6 additions & 4 deletions ampel/metrics/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ def write_metrics(metrics: Collection[Metric], histogram_file: str, counter_file
continue

for sample in metric.samples:
# prometheus_client 0.4+ adds extra fields
name, labels, value = sample[:3]
key = mmap_dict.mmap_key(
metric.name, name, list(labels.keys()), list(labels.values()), metric.documentation,
metric.name, sample.name, list(sample.labels.keys()), list(sample.labels.values()), metric.documentation,
)
sink.write_value(key, value)
# prometheus_client 0.18.0 adds timestamps, but only for MultiProcessValues
try:
sink.write_value(key, sample.value, sample.timestamp or 0.0) # type: ignore[call-arg]
except TypeError:
sink.write_value(key, sample.value) # type: ignore[call-arg]
finally:
histograms.close()
counters.close()
4 changes: 2 additions & 2 deletions ampel/test/test_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ async def test_multiprocess_metrics(prometheus_multiproc_dir):
if sample
}
read_mmap = lambda fname: {
k: v
for k, v, p in mmap_dict.MmapedDict.read_all_values_from_file(
item[0]: item[1]
for item in mmap_dict.MmapedDict.read_all_values_from_file(
prometheus_multiproc_dir / fname
)
}
Expand Down
97 changes: 48 additions & 49 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,27 @@ pydantic = "^1.9.0"
sjcl = "^0.2.1"
schedule = "^1.0.0"
yq = "^3.0.0"
prometheus-client = ">=0.16,<0.17"
prometheus-client = ">=0.16,<0.20"
xxhash = "^3.0.0"
psutil = "^5.8.0"
appdirs = "^1.4.4"
requests = "^2.0"
fastapi = {version = ">=0.95,<0.96", optional = true}
uvicorn = {version = ">=0.21.1,<0.22.0", optional = true, extras = ["standard"]}
Sphinx = {version = ">=7.0.1,<7.1.0", optional = true}
fastapi = {version = ">=0.95,<0.106", optional = true}
uvicorn = {version = ">=0.21.1,<0.26.0", optional = true, extras = ["standard"]}
Sphinx = {version = ">=7.0.1,<7.3.0", optional = true}
sphinx-press-theme = {version = ">=0.5.1,<0.9.0", optional = true}
sphinx-autodoc-typehints = {version = "^1.11.1", optional = true}
tomlkit = {version = "^0.11.0", optional = true}
tomlkit = {version = "^0.11.0 || ^0.12.0", optional = true}
slack-sdk = {version = "^3.18.1", optional = true}

[tool.poetry.dev-dependencies]
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
mypy = "^1.7.1"
mypy = "^1.8.0"
pytest-asyncio = "^0.23.2"
pytest-mock = "^3.12.0"
mongomock = "^4.1.2"
httpx = "^0.25.2"
httpx = "^0.26.0"
types-setuptools = "^65.1.0"
types-PyYAML = "^6.0.12"

Expand Down

0 comments on commit bd47d3c

Please sign in to comment.