Commit 75ed094
authored
feat(python): Add 3.x version of span metrics page (#14477)
Adding a 3.x version of the Span Metrics page. The contents are
identical except for changing 2.x-style `set_data()` to 3.x-style
`set_attribute()`.
Since the 3.x page is a brand new file, it shows up all green on the
diff. This is the actual difference between the old page and the new
`index__v3.x.mdx` page:
```diff
--- index.mdx 2025-07-21 14:06:41
+++ index__v3.x.mdx 2025-07-28 09:44:24
@@ -23,11 +23,11 @@
span = sentry_sdk.get_current_span()
if span:
# Add individual metrics
- span.set_data("database.rows_affected", 42)
- span.set_data("cache.hit_rate", 0.85)
- span.set_data("memory.heap_used", 1024000)
- span.set_data("queue.length", 15)
- span.set_data("processing.duration_ms", 127)
+ span.set_attribute("database.rows_affected", 42)
+ span.set_attribute("cache.hit_rate", 0.85)
+ span.set_attribute("memory.heap_used", 1024000)
+ span.set_attribute("queue.length", 15)
+ span.set_attribute("processing.duration_ms", 127)
### Best Practices for Span Data
@@ -48,11 +48,11 @@
name="Database Query Metrics"
) as span:
# Set metrics after creating the span
- span.set_data("db.query_type", "SELECT")
- span.set_data("db.table", "users")
- span.set_data("db.execution_time_ms", 45)
- span.set_data("db.rows_returned", 100)
- span.set_data("db.connection_pool_size", 5)
+ span.set_attribute("db.query_type", "SELECT")
+ span.set_attribute("db.table", "users")
+ span.set_attribute("db.execution_time_ms", 45)
+ span.set_attribute("db.rows_returned", 100)
+ span.set_attribute("db.connection_pool_size", 5)
# Your database operation here
pass
```1 parent 5ddfa37 commit 75ed094
1 file changed
+99
-0
lines changedLines changed: 99 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments