Serializes top-level metadata values into "key":value JSON fragments and
adds them to entries, overwriting fragments of existing keys.
Keys with null, undefined, function or symbol values are skipped. Values
are serialized one by one, so a value that fails to serialize is replaced
with "<failed to serialize>" instead of dropping the whole metadata
object. New keys beyond MAX_OBSERVATION_METADATA_KEYS are dropped
with a warning.
Callers can keep entries and pass it again on the next update, so only
the keys of that update are serialized.
Parameters
metadata: object
Metadata to serialize
entries: Map<string,string> = ...
Fragments of earlier metadata, keyed by metadata key
Serializes top-level metadata values into
"key":valueJSON fragments and adds them toentries, overwriting fragments of existing keys.Keys with
null,undefined, function or symbol values are skipped. Values are serialized one by one, so a value that fails to serialize is replaced with"<failed to serialize>"instead of dropping the whole metadata object. New keys beyond MAX_OBSERVATION_METADATA_KEYS are dropped with a warning.Callers can keep
entriesand pass it again on the next update, so only the keys of that update are serialized.