I have integrate my python default logger with raven . Now my errors are being logged on sentry.io/my_app. But I wanted to ask is there any way we can write unit tests for this function that generates an error and then somehow confirm that this error exits on sentry.
Python : How can I test that my error has been logged on sentry?
2.2k views Asked by M. Zulqarnain At
2
There are 2 answers
0
Markus Unterwaditzer
On
In Raven-Python you can implement a custom transport to swap out the HTTP request for a simple callback. This is done by implementing an abstract class for which there does not exist a lot of documentation unfortunately and the data you get is a bytestring of json-encoded data. You can find the abstract class here: https://github.com/getsentry/raven-python/blob/285b257cf386bfac78f6fe334c9044af65f98561/raven/transport/base.py#L26
This is slightly easier in the new SDK where you can write (without providing a DSN):
events = []
init(transport=events.append)
to collect events into an array instead of sending them to a server.
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in LOGGING
- ModuleNotFoundError: No module named 'src' while importing logging
- How to get domains in Shadowsocks server log with Shadowsocks Android
- How to enable log to console Cosmos Client SDK requests
- pino-pretty logging special characters as literal
- unable to serialize JSON type logs In fluentd(logging-operator)
- How to configure different loggers separately in structlog?
- detect catalina.out log path from a running tomcat on non-Windows
- apache2 rotatelogs creates log file but its empty when deployed to azure web app
- Ubuntu:24.04 Container generating excessive logs
- Transform Load pipeline for a logs system: Apache Airflow or Kafka Connect?
- Deisred log is not rotating
- Purpose of setting debug="false" in log4j at configuration level
- RobotFramework hangs after xx lines of log
- logging in multiprocess writes to same log
- Masking in logback.xml with all request and responses
Related Questions in SENTRY
- How to configure Sentry Webpack sourcemap uploading in Quasar?
- Cannot able to see the issues in Sentry dashboard
- Setup sentry to only log transactions occuring on a specific subpage
- Sentry with loggingIntegration in python not observing event_level=logging.CRITICAL
- Safari parsing JSON-LD error on 'telephone' ('Object.prototype.hasOwnProperty.call(e,"telephone")')
- Sentry, sequelizejs: Is there a way to capture the SQL statement that cause the error?
- Execution data for class does not match in Jacoco when use the latest Sentry dependencies
- Failed to resolve plugin for module "@sentry/react-native/expo"
- Sentry crash reports with react native ignite app
- Next.js sending strange request to routes
- Chrome extension refused to create a worker from blob because it violates the following Content Security Policy
- Is react-native in conjunction with Sentry javascript .sdk capable of handling offline logging
- Sentry API Retrieve Event
- django.security.csrf: Forbidden (Origin checking failed - https://sentry.domain.com does not match any trusted origins.)
- Sentry doesn't show all transactions and Web Vitals
Related Questions in RAVEN
- How to async join tables in RavenDB
- How do I get Sentry reference ID in html template using sentry-sdk?
- How to upgrade one individual file from node_modules folder instead of upgrading the whole package
- How to set clause between two fields in RavenDb?
- Filter RavenDB query by entries of list
- How to prevent Sentry from grouping errors/alerts on a specific type of error?
- How do I update a value within an array in Ravendb? I need to use Query
- Configuring Sentry handler for Django with new sentry_sdk without raven
- Send additional information with Raven.send_event
- Why does Sentry's recommended Django logging configuration silence logging from django.db.backends?
- How can I initialize new Sentry instance after init?
- Python - Sanitize keys in Sentry logging handler (django)
- ASGI: Sentry errors appear to show mixed tracebacks from different requests
- Sentry doesn't group exceptions correctly (React app)
- "Warning: We detected the use of uwsgi with disabled threads" when using Sentry/Raven with Django and PythonAnywhere
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You can use pytest https://docs.pytest.org/en/latest/ to write unit tests for your code. However sentry is used for monitoring of application which helps you to fix bug as per priority. Rather than confirming an error message from sentry, fixing the error by looking into sentry is more useful.