Models (harp.models)

The Models (harp.models) package define the base models for Harp, without any opinion on whether the represented data will or should be stored, nor how it should be stored.

Contents

class Blob[source]

Bases: Entity

Blob(*, id: str, data: bytes, content_type: str = None)

__init__(*, id, data, content_type=None)
Parameters:
Return type:

None

classmethod from_data(data, /, *, content_type=None)[source]
prettify()[source]
content_type: str = None
data: bytes
id: str
class Entity[source]

Bases: JsonSchemaMixin

id: Any
class Message[source]

Bases: Entity

Message(*, id: int = None, transaction_id: str, kind: str, summary: str, headers: str, body: str, created_at: datetime.datetime = None)

__init__(*, id=None, transaction_id, kind, summary, headers, body, created_at=None)
Parameters:
Return type:

None

body: str
created_at: datetime = None
headers: str
id: int = None
kind: str
summary: str
transaction_id: str
class Results[source]

Bases: Generic[TResult]

__init__()[source]
append(item)[source]
Parameters:

item (TResult)

class Transaction[source]

Bases: Entity

Transaction(*, id: str = None, type: str, endpoint: str = None, started_at: datetime.datetime, finished_at: datetime.datetime = None, elapsed: float = None, tpdex: int = None, messages: List[harp.models.messages.Message] = None, tags: dict = <factory>, extras: dict = <factory>, markers: set = <factory>)

__init__(*, id=None, type, endpoint=None, started_at, finished_at=None, elapsed=None, tpdex=None, messages=None, tags=<factory>, extras=<factory>, markers=<factory>)
Parameters:
Return type:

None

as_storable_dict(*, with_messages=False, with_tags=False)[source]

Create a dict that can be passed to a storage creation method.

elapsed: float = None

Elapsed time in seconds, if the transaction has ended.

endpoint: str = None

Endpoint name, if any (this describes which proxy controller handled the request).

extras: dict
finished_at: datetime = None

Timestamp of the transaction end (if it has ended), or None.

id: str = None

Unique identifier for this transaction.

markers: set
messages: List[Message] = None
started_at: datetime

Timestamp of the transaction start.

tags: dict
tpdex: int = None

TPDEX score, if the transaction has ended.

type: str

Type of ASGI transaction: http, websocket, lifecycle, …

Submodules