From ba38c82f6f2f26dc256c451ee51271b82b74267b Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 5 Aug 2022 11:33:47 -0400 Subject: [PATCH 1/3] feat(perf): Add Python Snippet for Custom Perf Metrics --- .../custom-performance-metrics/python.mdx | 25 +++++++++++++++++++ .../instrumentation/performance-metrics.mdx | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/includes/performance/custom-performance-metrics/python.mdx 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 0000000000000..04d38cbb70dce --- /dev/null +++ b/src/includes/performance/custom-performance-metrics/python.mdx @@ -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); +``` diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index e3378085083a0..1615061a278c5 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 From a265017f17f14d894b748630fc3c6c05230bc957 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 5 Aug 2022 12:45:24 -0400 Subject: [PATCH 2/3] clean up --- .../performance/custom-performance-metrics/python.mdx | 2 ++ .../performance/instrumentation/performance-metrics.mdx | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/includes/performance/custom-performance-metrics/python.mdx b/src/includes/performance/custom-performance-metrics/python.mdx index 04d38cbb70dce..0130d16fdb3a3 100644 --- a/src/includes/performance/custom-performance-metrics/python.mdx +++ b/src/includes/performance/custom-performance-metrics/python.mdx @@ -11,6 +11,8 @@ sentry_sdk.init( ) ``` +To capture in the SDK: + ```python transaction = Hub.current.scope.transaction; diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index 1615061a278c5..c42e5cd05b8fd 100644 --- a/src/platforms/common/performance/instrumentation/performance-metrics.mdx +++ b/src/platforms/common/performance/instrumentation/performance-metrics.mdx @@ -31,12 +31,13 @@ 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). From 5937b6776c8ff66e666379eb1c0777399402ff06 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 5 Aug 2022 13:11:08 -0400 Subject: [PATCH 3/3] fix note --- .../performance/instrumentation/performance-metrics.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/platforms/common/performance/instrumentation/performance-metrics.mdx b/src/platforms/common/performance/instrumentation/performance-metrics.mdx index c42e5cd05b8fd..39c54a2557b6d 100644 --- a/src/platforms/common/performance/instrumentation/performance-metrics.mdx +++ b/src/platforms/common/performance/instrumentation/performance-metrics.mdx @@ -31,13 +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 - 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). +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).