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

feat: support all possible elasticapm.* settings #5

Merged
merged 5 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 6 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@ on:
branches:
- master
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 3 * * *'


jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Test with pytest
if: always()
run: cd $GITHUB_WORKSPACE && ./pytest
python-version: 3.8
- run: pip install -U pip
- run: pip install -e . -r requirements.lock
- run: pytest
env:
PYTHONUNBUFFERED: 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ dmypy.json

# AppEnv
.pytest/
.envrc
27 changes: 17 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# See https://pre-commit.com for more information
# See https://github.com/bettermarks/.github#git-hooks for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:

- repo: https://github.com/bettermarks/.github
# to get the latest SHA use `gh api /repos/bettermarks/.github/commits/HEAD -q .sha`
rev: b8bcd419de6a66a6b3a5d7ca3197b801348690be
hooks:
- id: no-commit-to-default-branch
# the default branch of the repository containing this yaml file
args: [master]
- id: pre-commit-autoupdate
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.6.0
hooks:

# These are the most critical checks.
Expand Down Expand Up @@ -52,27 +59,27 @@ repos:
# This checks that all links to our VCS are permalinks. How oddly specific!
- id: check-vcs-permalinks

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v2.9.0
rev: v3.15.2
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0 # pick the isort version you'd like to use from https://github.com/pre-commit/mirrors-isort/releases
rev: v5.10.1 # pick the isort version you'd like to use from https://github.com/pre-commit/mirrors-isort/releases
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 20.8b1
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/mgedmin/check-manifest
rev: '0.46'
rev: '0.49'
hooks:
- id: check-manifest
34 changes: 31 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ pyramid-elasticapm

elastic-apm integration for the Pyramid framework

This package is inspired by https://www.elastic.co/de/blog/creating-custom-framework-integrations-with-the-elastic-apm-python-agent.
This package is inspired by https://www.elastic.co/de/blog/creating-custom-framework-integrations-with-the-elastic-apm-python-agent

**This fork is using pyramid 1.10 and python 3.8**
https://docs.pylonsproject.org/projects/pyramid/en/1.10-branch/

Since it is not published as a package, you have to install it from source,
e.g. by adding the following to requirements.in/requirements.txt::

pyramid_elasticapm @ git+https://github.com/betermarks/pyramid_elasticapm.git

Installation
============

Install with pip::

$ pip install pyramid_elasticapm
$ pip install git+https://github.com/betermarks/pyramid_elasticapm.git


Then include it in your pyramid application via config::
Expand All @@ -31,7 +38,7 @@ Settings


Settings for the elasticapm client can be specified via the `elasticapm`
namespace:
namespace, e.g.:

* `elasticapm.server_url`: Specify the apm server url.
* `elasticapm.secret_token`: Your secret authentication token for the server.
Expand All @@ -43,3 +50,24 @@ namespace:
* `elasticapm.transactions_ignore_patterns`: Whitespace separated list of
ignore patterns.
* `elasticapm.transaction_sample_rate`: Transaction sample rate
* `elasticapm.collect_local_variables`: Possible values: `errors` (default), `transactions`, `all`, `off`
Keep in mind that those things can contain data that is covered by GDPR policies

All possible configuration options are supported, see
https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html

Contributing
============

1. install direnv: https://direnv.net/docs/installation.html
2. hook direnv: https://direnv.net/docs/hook.html
3. create a new file called `.envrc` with the following content::

# https://github.com/direnv/direnv/wiki/Python#venv-stdlib-module
export VIRTUAL_ENV=venv
layout python python3.8
4. use `direnv allow` so direnv creates and activates the virtual env when entering the directory
5. use `pip install -e . -r requirements.lock` to install the dependencies
6. run the tests `pytest`
7. use `pre-commit install` before your first commit, see https://github.com/bettermarks/.github#git-hooks
8. use `pip freeze --local > requirements.lock` to update the lock file, after the input changed
Loading