Skip to main content

Fake Sentry service for debugging and integration tests

Project description

Kent is a service for debugging and integration testing Sentry.

Code:

https://github.com/willkg/kent/

Issues:

https://github.com/willkg/kent/issues

License:

MPL v2

Goals

Goals of Kent:

  1. make it possible to debug before_send and before_breadcrumb sanitization code when using sentry-sdk

  2. make it possible to debug other sentry error submission payload issues

  3. make it possible to write integration tests against a fake sentry instance

Quick start

Installing and running on your local machine

  1. Install Kent.

    You can install Kent from PyPI with pipx or pip or whatever:

    pipx install kent

    You can install a REVISH (“main”, branch name, commit, whatever) from GitHub:

    pipx install https://github.com/willkg/kent/archive/refs/heads/<REVISH>.zip

    You can install from a checked out version of this repository:

    pipx install .
  2. Run Kent:

    kent-server run [-h HOST] [-p PORT]

Running in a Docker container

I’m using something like this:

FROM python:3.10.1-alpine3.15

WORKDIR /app/

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

RUN pip install -U 'pip>=8' && \
    pip install --no-cache-dir 'kent==VERSION'

USER guest

ENTRYPOINT ["/usr/local/bin/kent-server"]
CMD ["run"]

Replace VERSION with the version of Kent you want to use. See https://pypi.org/project/kent for releases.

Then:

$ docker build -t faksentry:latest .
$ docker run --rm --publish 8000:8000 fakesentry:latest run --host 0.0.0.0 --port 8000

Things to know about Kent

Kent is the fakest of fake Sentry servers. It supports a single Sentry project with id 1. You can set up a Sentry DSN to point to Kent and have your application send errors.

Kent is a refined fake Sentry service and doesn’t like fast food.

Kent will keep track of the last 100 it received in memory. Nothing is persisted to disk.

You can access the list of errors and error data with your web browser by going to Kent’s index page.

You can also access it with the API. This is most useful for integration tests that want to assert things about errors.

/api/errorlist/

List of all errors in memory with a unique error id.

/api/error/ERRORID

Retrieve the payload for a specific error by id.

Kent definitely works with:

  • Python sentry-sdk client

I don’t know about anything else. If you use Kent with another Sentry client, add an issue with details or a pull request to update the README.

Release process

  1. Check out main tip.

  2. Update __version__ in src/kent/__init__.py.

  3. Run:

    $ make checkrot
    $ make test
    $ make testdocker
    $ check-manifest

    Fix any issues from that.

  4. Update HISTORY.rst.

  5. Push any changes to GitHub.

  6. Release:

    $ git tag --sign 1.0.0
    # Use contents from HISTORY.rst for tag comment
    
    $ make clean
    $ python setup.py sdist bdist_wheel
    $ twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kent-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kent-0.1.0-py2.py3-none-any.whl (22.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file kent-0.1.0.tar.gz.

File metadata

  • Download URL: kent-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for kent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42684aa1e0798a62300a0360a0d85c8f789d433dc27999e2b8813bb25f0c5c37
MD5 4c582b5a4e5bfdcafeac6e382e3eb83e
BLAKE2b-256 8f295ccb1e9532348fca73ada21bce58e4de19ace06e425657be637c70e58048

See more details on using hashes here.

File details

Details for the file kent-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: kent-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for kent-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b636c7138da2efe15e486ceee7455aa09f659e82634b1f63fb63f8ff2c472a8a
MD5 39b5d185f5eb0db9789a71789346605f
BLAKE2b-256 83bb9bf910999ab156fc01cefb8d2d7cf738d22718bafdf5f7e8487b20eadc04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page