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(perf): Add Python Snippet for Custom Perf Metrics #5391

Merged
merged 3 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/includes/performance/custom-performance-metrics/python.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Adding custom metrics is supported in Sentry's Python SDK version `1.5.12` and above.

To enable the capturing of custom metrics, you'll need to enable the `custom_measurements` experiment option.

```python
sentry_sdk.init(
dsn="__DSN__",
_experiments={
"custom_measurements": True,
},
)
```

```python
transaction = Hub.current.scope.transaction;

# Record amount of memory used
transaction.set_measurement('memory_used', 123, 'byte');

# Record time when job was started
transaction.set_measurement('job_start_time', 1.3, 'second');

# Record amount of times cache was read
transaction.set_measurement('cache_read_count', 4);
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ title: Performance Metrics
sidebar_order: 20
supported:
- javascript
- python
notSupported:
- javascript.cordova
- javascript.electron
- react-native
- dotnet
- python
- go
- java
- android
Expand Down