Commit 2d49b74
Allow new integration setup on the instance with config options (#5047)
### Description
Currently `setup_once` is called without any arguments so cannot access
either the SDK init `options` or the integration specific init arguments
on the instance. This PR enables a separate backwards compat optional
`setup_once_with_options` as an **instance** method.
Note that we we will use this rarely but I need it to unblock the
OTLPIntegration since I need the DSN there.
#### Example
before
```python
sentry_sdk.init(dsn="")
class FooIntegration(Integration):
def __init__(self, bar=42):
self.bar = bar
@staticmethod
def setup_once():
self.bar # Not available
options.dsn # Not available
```
after
```python
def setup_once_with_options(self, options=None):
self.bar
options.dsn
```
---------
Co-authored-by: Ivana Kellyer <[email protected]>1 parent 3e86962 commit 2d49b74
3 files changed
+17
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| 412 | + | |
412 | 413 | | |
413 | 414 | | |
414 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
178 | 180 | | |
179 | | - | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| |||
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| 226 | + | |
224 | 227 | | |
225 | 228 | | |
226 | 229 | | |
| |||
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
0 commit comments