Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

origin rebase #9

Merged
merged 111 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
b2dc04b
Version 2.9.0
albertodonato Aug 18, 2023
4c9f389
[snap] fix build
albertodonato Aug 18, 2023
c176444
[snap] udpate metadata
albertodonato Aug 27, 2023
992724d
Dockerfile support for arm64 arch (#160)
darioef Oct 9, 2023
bcf4aa8
[github] add python3.12
albertodonato Oct 9, 2023
e019e96
disable python3.12 for now
albertodonato Oct 9, 2023
363005d
update to prometheus-aioexporter 2.0 (#165)
albertodonato Oct 28, 2023
e9b289b
[snap] [docker] add ClickHouse support
albertodonato Oct 28, 2023
84ae66c
Update README.rst (#167)
Shubhamkashyap1601 Oct 28, 2023
7fb2545
Update README.rst (#166)
paman6415 Oct 28, 2023
af92755
fix typo README.rst (#168)
daulatojha17 Oct 28, 2023
058f730
Version 2.9.1
albertodonato Oct 28, 2023
ee53181
update version
albertodonato Oct 28, 2023
2467a29
Update CHANGES.rst (#170)
paman6415 Oct 28, 2023
b599be6
Update README.rst (#169)
mudit-loya Oct 28, 2023
3947e93
fix main script (fixes #171).
albertodonato Oct 28, 2023
295f0d0
Version 2.9.2
albertodonato Oct 28, 2023
8d5a16c
fix(typs): Fixed minor typos (#172)
Abhishek-Mallick Oct 29, 2023
1744cea
Bugfix- Added support for ODBC version 17 using argument (#174)
ilantnt Nov 10, 2023
54cad96
update readme
albertodonato Nov 1, 2023
cb110cb
switch to ruff (#181)
albertodonato Dec 28, 2023
7f1e7aa
add metric to track query execution timestamp (fixes #178) (#182)
albertodonato Dec 28, 2023
852f949
[docker] define a volume containing the config file (fixes #158) (#184)
albertodonato Jan 17, 2024
2347efe
fix tests for changed jsonschema error message
albertodonato Jan 17, 2024
0f39657
drop codecov
albertodonato Jan 22, 2024
1bc8aa0
fix columns names in InvalidResultColumnNames being reported the wron…
andrewjw Jan 25, 2024
f9c3734
Version 2.10.0
albertodonato Jan 28, 2024
6661e01
Update the base image to 3.13-slim-bookworm (#197)
flo-02-mu Oct 20, 2024
cd96f39
switch back to isort+black+flake8
albertodonato Oct 20, 2024
e4cb28a
gh: add python 3.13 to matrix
albertodonato Oct 20, 2024
ee638b3
enable strict mode for mypy
albertodonato Apr 17, 2023
55f20c8
set scope for asyncio fixture in tests
albertodonato Oct 24, 2024
8f1f568
typing fix
albertodonato Oct 29, 2024
5c21517
revert switch back from ruff
albertodonato Oct 29, 2024
9b296f8
drop unnecessary asyncio test markers
albertodonato Oct 29, 2024
6734c13
snap: update to core24
albertodonato Oct 29, 2024
e69372c
snap: specify build architectures
albertodonato Oct 30, 2024
ec9893a
require Python 3.11
albertodonato Oct 30, 2024
6bf0bb4
switch to SQLAlchemy 2 (#198)
albertodonato Nov 2, 2024
b7447b3
add typing to config tests
albertodonato Nov 2, 2024
52ba335
Version 2.11.0
albertodonato Nov 19, 2024
73913df
Version 2.11.1
albertodonato Nov 19, 2024
15632f1
chore: update ruff config
albertodonato Dec 10, 2024
20f9df4
type fixes
albertodonato Dec 13, 2024
99a18fd
chore: add dependabot config (#209)
albertodonato Dec 17, 2024
192a97f
Bump actions/checkout from 3 to 4 (#211)
dependabot[bot] Dec 17, 2024
287144d
Bump actions/setup-python from 4 to 5 (#210)
dependabot[bot] Dec 17, 2024
660f54b
upate dependabot config
albertodonato Dec 18, 2024
0b1736b
update dependabot config
albertodonato Dec 20, 2024
14d1698
define requirements.txt
albertodonato Dec 18, 2024
7dffca8
rename tox target to update-dependencies
albertodonato Dec 27, 2024
56c8c63
docker action
albertodonato Dec 16, 2024
185c6ce
update docker workflow config
albertodonato Dec 27, 2024
39a75af
switch to prometheus-aioexporter 3.0 (fixes #199)
albertodonato Nov 8, 2024
928c510
change "increment" default value for counters to False
albertodonato Dec 29, 2024
1832b08
update dependencies
albertodonato Dec 27, 2024
25f2804
docker/snap changes
albertodonato Dec 12, 2024
dccc38c
update doc
albertodonato Dec 16, 2024
0fcd90f
add more typing to tests
albertodonato Dec 29, 2024
c3ab60f
fix snap description
albertodonato Dec 30, 2024
3fbe22a
Version 3.0.0
albertodonato Dec 30, 2024
bfe5535
chore: fix typo in readme
albertodonato Dec 30, 2024
6b47645
chore(docker): build image on tag pushes
albertodonato Dec 30, 2024
966482b
chore(snap): build images only for amd64 and arm64
albertodonato Dec 30, 2024
c216092
chore(docker): document GHCR builds
albertodonato Dec 30, 2024
b6b18b3
chore: split configuration file format docs (#215)
albertodonato Jan 1, 2025
4a859f9
feat: support YAML tags for env, file, and include (fixes #188) (#216)
albertodonato Jan 2, 2025
f394f39
chore: split yaml module code
albertodonato Jan 2, 2025
4981404
chore: add table documenting exporter options
albertodonato Jan 2, 2025
7c3176e
chore: better typing
albertodonato Jan 2, 2025
c404f2c
feat: support combining config from multiple files (fixes #108) (#218)
albertodonato Jan 3, 2025
700e358
chore: error if file content is not a mapping
albertodonato Jan 3, 2025
1aa22e8
chore: update doc
albertodonato Jan 4, 2025
777e689
chore: fix table in doc
albertodonato Jan 4, 2025
ffc00b2
chore: more tests typing fixes
albertodonato Jan 4, 2025
11d8dfb
chore: complete typing for tests
albertodonato Jan 5, 2025
b6d52cf
Bump pygments from 2.18.0 to 2.19.0 in the minor group (#219)
dependabot[bot] Jan 6, 2025
1dd563e
Version 3.1.0
albertodonato Jan 6, 2025
d5bc5b9
typo in README.rst (#220)
lucasfcnunes Jan 9, 2025
6003044
chore: add PyPI downloads badge to readme
albertodonato Jan 9, 2025
726fefb
chore: extract module with builtin metrics
albertodonato Jan 9, 2025
4c79e93
chore: fix badge in README
albertodonato Jan 9, 2025
1bc4139
chore: drop unused s390x arch from packages
albertodonato Jan 11, 2025
6faf55b
Bump sqlalchemy from 2.0.36 to 2.0.37 (#221)
dependabot[bot] Jan 13, 2025
37d8be9
Bump pygments from 2.19.0 to 2.19.1 (#222)
dependabot[bot] Jan 13, 2025
672ebfe
chore: combine execute logic
albertodonato Jan 16, 2025
24c3717
chore: move label definition
albertodonato Jan 17, 2025
9602756
chore: add contribution guidelines (#226)
albertodonato Jan 18, 2025
c5880c2
Bump referencing from 0.35.1 to 0.36.1 in the minor group (#227)
dependabot[bot] Jan 20, 2025
018fb18
chore: refactory Query adding QueryExecution (#229)
albertodonato Jan 21, 2025
c092fbe
Bump structlog from 24.4.0 to 25.1.0 in the major group (#228)
dependabot[bot] Jan 21, 2025
9ae1cf7
chore: add discussions to the doc
albertodonato Jan 21, 2025
e003f36
feat: add query interval metric (fixes #225) (#230)
albertodonato Jan 22, 2025
30421c5
chore: fix url
albertodonato Jan 22, 2025
d1647cb
feat: run queries in explicit transactions, deprecate autocommit flag…
albertodonato Jan 22, 2025
cc67ec0
Add the ability to connect to snowflake
lfyorke Aug 14, 2023
c0a2684
Infrastructure to support the query exporter.
lfyorke Aug 15, 2023
a095247
fix testing
lfyorke Aug 15, 2023
502a312
fix testing
lfyorke Aug 15, 2023
a351c37
Fix the testing
lfyorke Aug 15, 2023
7f48d6e
Fix tests
lfyorke Aug 15, 2023
38eb04a
fix test merges
bradsbrown Jan 23, 2025
512207a
Merge branch 'main' into origin-rebase
bradsbrown Jan 23, 2025
5f0c16f
fix requirements
bradsbrown Jan 24, 2025
1d8f7b2
mypy and functional fixes
bradsbrown Jan 24, 2025
81b1f4c
don't mypy tests
bradsbrown Jan 24, 2025
36bafae
more mypy fixes
bradsbrown Jan 24, 2025
9ed9c19
coverage fix and pyproject format
bradsbrown Jan 24, 2025
d6755f1
include testing extras in install
bradsbrown Jan 24, 2025
5e46d60
drop tests to align with current
bradsbrown Jan 24, 2025
f01f8e4
drop unused import
bradsbrown Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
groups:
minor:
update-types: [minor]
major:
update-types: [major]
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
all:
update-types: [major, minor]
38 changes: 19 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,60 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Repository checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.13"

- name: Install dependencies
run: |
pip install --upgrade pip tox

- name: Lint
run: |
tox -e lint
tox run -e lint

check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Repository checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install --upgrade pip tox

- name: Check
run: |
tox -e check
tox run -e check

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Repository checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -69,11 +76,4 @@ jobs:

- name: Test
run: |
tox -e coverage -- --cov-report xml:coverage.xml

- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON
full_report: coverage.xml
tox run -e coverage
64 changes: 64 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Docker image

on:
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,prefix=sha-

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
111 changes: 100 additions & 11 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,92 @@
v3.1.0 - 2025-01-08
===================

- Support passing multiple configuration files (#108).
- Support YAML tags for ``env``, ``file``, and ``include`` (#188).

**NOTE**:
The ``env:`` and ``file:`` prefixes for DSNs string form is now deprecated in
favor of the corresponding tags, and will be dropped in the next major release.


v3.0.0 - 2024-12-30
===================

- Convert all logging to structured (#199).
- Look for ``config.yaml`` configuration file by default, configuration file
can be optionally specified with ``--config``.
- Support passing configuration options via environment variables.
- Support loading ``.env`` file with environment variables for configuration.
- [docker] Run exporter from the ``/config`` directory, supporting having
``.env`` file there.
- [snap] Run exporter from the ``$SNAP_DATA`` directory, supporting having
``.env`` file there.

**NOTE**:
This release introduces a few breaking changes from the 2.x series,
specificially:

- The ``--log-level`` option now takes lowercase names for levels.
- The configuration file is no longer a required option, since
``config.yaml`` in the current directory is looked up automatically. If a
different file is specified, it should be done as an optional parameter
with ``--config``.
- Metrics of type ``counter`` are now set by default to values returned by
queries. To preserve the old default behavior of incrementing it by the
returned value, ``increment`` should be set to ``true`` in the metric
configuration.


v2.11.1 - 2024-11-19
====================

- Update ``prometheus-aioexporter`` dependency range.


v2.11.0 - 2024-11-19
====================

- Switch to SQLAlchemy 2.
- Require Python 3.11.
- [docker] Use Python 3.13 on Debian Bookwork as base image.
- [snap] Rebase on core24.


v2.10.0 - 2024-01-28
====================

- Fix columns names in InvalidResultColumnNames being reported the wrong way
round (#185).
- Add a metric to track query execution timestamp (#178).
- [docker] Define a volume containing the config file (#158).
- [docker] Add support for ODBC version 17, support alternative versions.
- Switch to ruff for formatting.


v2.9.2 - 2023-10-28
===================

- Fix main script (#171).
- Typos fixes in documentation.


v2.9.1 - 2023-10-28
===================

- Update dependency to ``prometheus-aioexporter`` 2.0.
- [snap] Add support for ClickHouse.
- [docker] Add support for ClickHouse.


v2.9.0 - 2023-08-18
===================

- Add ``increment`` flag for counter metrics (#124).
- Rework project setup.
- [docker] Add ``pymssql`` package (#133).
- [docker] Fix setup for Microsoft repository (#159).


v2.8.3 - 2022-07-16
===================

Expand All @@ -8,23 +97,23 @@ v2.8.3 - 2022-07-16
v2.8.2 - 2022-07-16
===================

- Require Python 3.10
- [snap] Change base to core22
- [docker] Use Python 3.10
- [docker] Base on Debian 11
- Require Python 3.10.
- [snap] Change base to core22.
- [docker] Use Python 3.10.
- [docker] Base on Debian 11.


v2.8.1 - 2022-02-18
===================

- Require `sqlalchemy_aio` 0.17.0, drop workaround for previous versions
- Require ``sqlalchemy_aio`` 0.17.0, drop workaround for previous versions
(#105).


v2.8.0 - 2022-01-18
===================

- Add support for paramters matrix in queries.
- Add support for parameters matrix in queries.
- Allow freetext name for databases in config (#99).


Expand Down Expand Up @@ -89,7 +178,7 @@ v2.4.0 - 2020-06-20
===================

- Add a ``query_latency`` metric to track query execution times. This is
lebeled by database and query name (#46).
labeled by database and query name (#46).


v2.3.0 - 2020-06-04
Expand Down Expand Up @@ -159,7 +248,7 @@ v2.0.0 - 2020-02-02

- Only named parameters with the ``:param`` style are now supported, queries
using positional parameters or other styles of named parameters need to be
udpated.
updated.
- Literal ``:`` at the beginning of a word need to be escaped (with backslash)
to avoid confusion with parameter markers. Colons that appear inside words
don't need to be escaped.
Expand Down Expand Up @@ -209,13 +298,13 @@ v1.8.0 - 2019-05-25
- Disable queries that will certainly always fail (e.g. because of invalid.
returned column names/number) (#6).
- Support disconnecting from after each query (#8).
- Rework tests to use actualy SQLite in-memory databases instead of fakes.
- Rework tests to use actually SQLite in-memory databases instead of fakes.


v1.7.0 - 2019-04-07
===================

- Add a ``queries`` and ``database_errors`` metrics lebeled by database (#1).
- Add a ``queries`` and ``database_errors`` metrics labeled by database (#1).
- Support database DSNs defined as ``env:<VARNAME>`` to supply the dns from the
environment (#5).

Expand All @@ -239,7 +328,7 @@ v1.4.0 - 2018-06-08
===================

- Support for python3.7.
- Use asynctest for asyncronous tests.
- Use asynctest for asynchronous tests.
- Updated toolrack dependency.


Expand Down
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM python:3.10-slim-bullseye AS build-image
FROM python:3.13-slim-bookworm AS build-image

RUN apt-get update
RUN apt-get full-upgrade -y
RUN apt-get install -y --no-install-recommends \
build-essential \
curl \
default-libmysqlclient-dev \
freetds-dev \
libkrb5-dev \
libpq-dev \
pkg-config \
unixodbc-dev \
Expand All @@ -16,18 +18,24 @@ COPY . /srcdir
RUN python3 -m venv /virtualenv
ENV PATH="/virtualenv/bin:$PATH"
RUN pip install \
/srcdir \
-r /srcdir/requirements.txt \
cx-Oracle \
clickhouse-sqlalchemy \
"ibm-db-sa; platform_machine == 'x86_64' or platform_machine == 'ppc64le'" \
mysqlclient \
psycopg2

RUN curl \
https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip \
https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linux$(arch | sed -e 's/x86_64/x64/g; s/aarch64/-arm64/g').zip \
-o instantclient.zip
RUN unzip instantclient.zip
RUN mkdir -p /opt/oracle/instantclient
RUN mv instantclient*/* /opt/oracle/instantclient


FROM python:3.10-slim-bullseye
FROM python:3.13-slim-bookworm
ARG ODBC_DRIVER_VERSION=18
ENV ODBC_DRIVER=msodbcsql${ODBC_DRIVER_VERSION}

RUN apt-get update && \
apt-get full-upgrade -y && \
Expand All @@ -42,7 +50,7 @@ RUN apt-get update && \
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
(. /etc/os-release; echo "deb https://packages.microsoft.com/debian/$VERSION_ID/prod $VERSION_CODENAME main") > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql18 && \
ACCEPT_EULA=Y apt-get install -y --no-install-recommends $ODBC_DRIVER && \
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man && \
apt-get clean

Expand All @@ -53,7 +61,10 @@ COPY --from=build-image /srcdir /app
ENV PATH="/virtualenv/bin:$PATH"
ENV VIRTUAL_ENV="/virtualenv"
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient"
# IPv6 support is not enabled by default, only bind IPv4
ENV QE_HOST="0.0.0.0"

EXPOSE 9560/tcp
# IPv6 support is not enabled by default, only bind IPv4
ENTRYPOINT ["query-exporter", "/config.yaml", "-H", "0.0.0.0"]
VOLUME /config
WORKDIR /config
ENTRYPOINT ["query-exporter"]
Loading
Loading