-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add reproduction for getsentry/sentry-python#2983
- Loading branch information
1 parent
8c0f275
commit c32e051
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Reproduction of getsentry/sentry#2983. | ||
|
||
## Reproduction steps | ||
|
||
1. Clone this repository. | ||
2. Enter this directory: | ||
|
||
```zsh | ||
% cd issue-reproductions/getsentry/sentry-python/2983 | ||
``` | ||
|
||
3. Set the `SENTRY_DSN` environment variable to your Sentry DSN (if not already set). | ||
4. Run the `run.zsh` script: | ||
|
||
```zsh | ||
% ./run.zsh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import time | ||
import sentry_sdk | ||
|
||
sentry_sdk.init(traces_sample_rate=1.0, profiles_sample_rate=1.0, debug=True) | ||
|
||
if __name__ == "__main__": | ||
print("Hello world") | ||
sentry_sdk.metrics.increment("counter_metric", 10) | ||
sentry_sdk.metrics.incr("drank-drinks", 1, tags={"kind": "coffee"}) | ||
|
||
with sentry_sdk.metrics.timing(key="timing_metric"): | ||
print("Sleeping for 3 seconds") | ||
print("Pressing Ctrl+C will send the metrics immediately") | ||
time.sleep(3) | ||
print("Done sleeping") | ||
|
||
sentry_sdk.metrics.incr("sleep-finished", 1) | ||
|
||
# Metrics are only sent when the line below is uncommented | ||
# sentry_sdk.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
certifi==2024.2.2 | ||
sentry-sdk==1.45.0 | ||
urllib3==2.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /bin/zsh | ||
|
||
if [[ -z $SENTRY_DSN ]] then | ||
echo "SENTRY_DSN must be set!" | ||
exit 1 | ||
fi | ||
|
||
if ! [[ -d .venv ]] then | ||
echo "Creating virtual environment..." | ||
python3 -m venv .venv | ||
fi | ||
|
||
echo "Activating virtual environment..." | ||
source .venv/bin/activate | ||
|
||
echo "Installing requirements..." | ||
pip install -r requirements.txt | ||
|
||
echo "Running main.py..." | ||
python main.py |