Langfuse JS/TS SDKs
    Preparing search index...

    Function serializeObservationMetadata

    • Internal

      Serializes observation metadata into the single JSON value written to the langfuse.observation.metadata span attribute.

      Top-level 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.

      Parameters

      • metadata: unknown

        Metadata to serialize

      Returns undefined | string

      JSON string, or undefined if there is no metadata to write

      Error if metadata has more than MAX_OBSERVATION_METADATA_KEYS top-level keys