Skip to main content

Module metadata

Module metadata 

Source
Expand description

Bounded, redacted JSON metadata helpers for ingest pipelines. Bounded and redacted JSON metadata helpers for untrusted ingest input.

Constants§

MAX_METADATA_JSON_BYTES
Maximum encoded metadata size before the payload is replaced by a truncation marker.
MAX_METADATA_KEY_CHARS
Maximum number of Unicode scalar values retained from a metadata key.
MAX_METADATA_OBJECT_FIELDS
Maximum number of elements retained from a metadata object or array.
MAX_METADATA_STRING_CHARS
Maximum number of Unicode scalar values retained from a metadata string.

Functions§

attrs_to_metadata_object
Build a sanitized JSON object from key/value attributes while enforcing field limits.
bounded_metadata_json
Sanitize and encode metadata, replacing oversized results with a valid JSON truncation marker.
try_bounded_metadata_json
Like bounded_metadata_json, but refuses to truncate: returns None when the sanitized encoding exceeds MAX_METADATA_JSON_BYTES, so callers whose metadata carries load-bearing keys (e.g. the extracted agent_docker identity) can back out instead of losing them.