Mutable label holder yielded by :func:`track_request_latency`. Callers that need to resolve labels *inside* the ``with`` block (e.g. ``/get-online-features`` where the feature count is only known after ``_get_features`` succeeds) can set the attributes on the yielded object and they
| 300 | |
| 301 | |
| 302 | class RequestMetricsContext: |
| 303 | """Mutable label holder yielded by :func:`track_request_latency`. |
| 304 | |
| 305 | Callers that need to resolve labels *inside* the ``with`` block |
| 306 | (e.g. ``/get-online-features`` where the feature count is only |
| 307 | known after ``_get_features`` succeeds) can set the attributes |
| 308 | on the yielded object and they will be picked up in ``finally``. |
| 309 | """ |
| 310 | |
| 311 | __slots__ = ("feature_count", "feature_view_count") |
| 312 | |
| 313 | def __init__(self, feature_count: str = "", feature_view_count: str = ""): |
| 314 | self.feature_count = feature_count |
| 315 | self.feature_view_count = feature_view_count |
| 316 | |
| 317 | |
| 318 | @contextmanager |
no outgoing calls
no test coverage detected