Skip to content

Commit

Permalink
feat: Add reproduction for getsentry/sentry-python#2983
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Apr 16, 2024
1 parent 8c0f275 commit c32e051
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
17 changes: 17 additions & 0 deletions getsentry/sentry-python/2983/README.md
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
```
20 changes: 20 additions & 0 deletions getsentry/sentry-python/2983/main.py
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()
3 changes: 3 additions & 0 deletions getsentry/sentry-python/2983/requirements.txt
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
20 changes: 20 additions & 0 deletions getsentry/sentry-python/2983/run.zsh
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

0 comments on commit c32e051

Please sign in to comment.