(
self,
platform: str = "transaction",
timestamp: datetime | None = None,
duration: timedelta | None = None,
**kwargs: Any,
)
| 3282 | } |
| 3283 | |
| 3284 | def load_data( |
| 3285 | self, |
| 3286 | platform: str = "transaction", |
| 3287 | timestamp: datetime | None = None, |
| 3288 | duration: timedelta | None = None, |
| 3289 | **kwargs: Any, |
| 3290 | ) -> dict[str | int, Any]: |
| 3291 | if timestamp is None: |
| 3292 | timestamp = self.ten_mins_ago |
| 3293 | |
| 3294 | min_age = before_now(minutes=10) |
| 3295 | if timestamp > min_age: |
| 3296 | # Sentry does some rounding of timestamps to improve cache hits in snuba. |
| 3297 | # This can result in events not being returns if the timestamps |
| 3298 | # are too recent. |
| 3299 | raise Exception( |
| 3300 | f"Please define a timestamp older than 10 minutes to avoid flakey tests. Want a timestamp before {min_age}, got: {timestamp} " |
| 3301 | ) |
| 3302 | |
| 3303 | start_timestamp = None |
| 3304 | if duration is not None: |
| 3305 | start_timestamp = timestamp - duration |
| 3306 | start_timestamp = start_timestamp - timedelta( |
| 3307 | microseconds=start_timestamp.microsecond % 1000 |
| 3308 | ) |
| 3309 | |
| 3310 | return load_data(platform, timestamp=timestamp, start_timestamp=start_timestamp, **kwargs) |
| 3311 | |
| 3312 | def create_span( |
| 3313 | self, |
no test coverage detected