Skip to content

Commit

Permalink
Added callout for parameter name change
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Sep 12, 2024
1 parent 6342c57 commit 32839c0
Showing 1 changed file with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def eat_pizza(pizza):
eat_slice(pizza.slices.pop())
```

<Alert title="Changed in 2.15.0" level="info">

The parameter `name` in `start_span()` used to be called `description`. In version 2.15.0 `description` was deprecated and from 2.15.0 on, only `name` should be used. `description` will be removed in `3.0.0`.

</Alert>

### Using a Decorator

```python
Expand Down Expand Up @@ -88,10 +94,16 @@ def eat_slice(slice):
def eat_pizza(pizza):
with sentry_sdk.start_transaction(op="task", name="Eat Pizza"):
while pizza.slices > 0:
span = sentry_sdk.start_span(description="Eat Slice")
span = sentry_sdk.start_span(name="Eat Slice")
eat_slice(pizza.slices.pop())
span.finish()
```
<Alert title="Changed in 2.15.0" level="info">

The parameter `name` in `start_span()` used to be called `description`. In version 2.15.0 `description` was deprecated and from 2.15.0 on, only `name` should be used. `description` will be removed in `3.0.0`.

</Alert>


When you create your span manually, make sure to call `span.finish()` after the block of code you want to wrap in a span to finish the span. If you do not finish the span it will not be sent to Sentry.

Expand All @@ -113,6 +125,13 @@ def eat_slice(slice):
chew()
```

<Alert title="Changed in 2.15.0" level="info">

The parameter `name` in `start_span()` used to be called `description`. In version 2.15.0 `description` was deprecated and from 2.15.0 on, only `name` should be used. `description` will be removed in `3.0.0`.

</Alert>


### Using a Decorator

```python
Expand All @@ -136,15 +155,21 @@ def chew():
...

def eat_slice(slice):
parent_span = sentry_sdk.start_span(description="Eat Slice")
parent_span = sentry_sdk.start_span(name="Eat Slice")

child_span = parent_span.start_child(description="Chew")
child_span = parent_span.start_child(name="Chew")
chew()
child_span.finish()

parent_span.finish()
```

<Alert title="Changed in 2.15.0" level="info">

The parameter `name` in `start_span()` used to be called `description`. In version 2.15.0 `description` was deprecated and from 2.15.0 on, only `name` should be used. `description` will be removed in `3.0.0`.

</Alert>

The parameters of `start_span()` and `start_child()` are the same. See the [API reference](https://getsentry.github.io/sentry-python/api.html#sentry_sdk.api.start_span) for more details.

When you create your span manually, make sure to call `span.finish()` after the block of code you want to wrap in a span to finish the span. If you do not finish the span it will not be sent to Sentry.
Expand Down

0 comments on commit 32839c0

Please sign in to comment.