diff --git a/src/includes/performance/custom-performance-metrics/python.mdx b/src/includes/performance/custom-performance-metrics/python.mdx new file mode 100644 index 00000000000000..0130d16fdb3a31 --- /dev/null +++ b/src/includes/performance/custom-performance-metrics/python.mdx @@ -0,0 +1,27 @@ +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, + }, +) +``` + +To capture in the SDK: + +```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); +``` diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index e3378085083a04..39c54a2557b6db 100644 --- a/src/platforms/common/performance/instrumentation/performance-metrics.mdx +++ b/src/platforms/common/performance/instrumentation/performance-metrics.mdx @@ -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 @@ -31,12 +31,17 @@ description: "Learn how to attach performance metrics to your transactions." Sentry's SDKs support sending performance metrics data to Sentry. These are numeric values attached to transactions that are aggregated and displayed in Sentry. + + + + ## Custom Metrics + - organization can set custom metrics in the SDK, the ability to see the data generated by these metrics is in beta and is only available if your organization is participating in its limited release. Features in beta are still in-progress and may have bugs. We recognize the irony. If you’re interested in participating, [join the waitlist](https://sentry.io/for/performance/#updates-signup). +Although you can set custom metrics in the SDK, the ability to see the data generated by these metrics is in beta and is only available if your organization is participating in its limited release. Features in beta are still in-progress and may have bugs. We recognize the irony. If you’re interested in participating, [join the waitlist](https://sentry.io/for/performance/#updates-signup).