Skip to main content

LogSpanFunctionContent

Content type for custom application logic and function call spans.

Overview

LogSpanFunctionContent captures arbitrary function invocations in your application. It is wrapped in a LogSpanContent union via the actual_instance pattern.
from adaline_api.models.log_span_function_content import LogSpanFunctionContent

Fields

type
str
required
Must be "Function".
input
str
required
The input payload as a JSON string. Must be valid, parseable JSON (the result of json.dumps()).
output
str
required
The output payload as a JSON string. Must be valid, parseable JSON (the result of json.dumps()).

Construction Pattern

All span content is wrapped in LogSpanContent using the actual_instance parameter:
from adaline_api.models.log_span_content import LogSpanContent
from adaline_api.models.log_span_function_content import LogSpanFunctionContent

content = LogSpanContent(
    actual_instance=LogSpanFunctionContent(
        type="Function",
        input=json.dumps({"arg": "value"}),
        output=json.dumps({"result": "done"}),
    )
)

Example

import json
from adaline_api.models.log_span_content import LogSpanContent
from adaline_api.models.log_span_function_content import LogSpanFunctionContent

fn_input = {"user_id": "u_123", "action": "compute_score"}
fn_output = {"score": 87.5, "tier": "gold"}

span.update({
    "status": "success",
    "content": LogSpanContent(
        actual_instance=LogSpanFunctionContent(
            type="Function",
            input=json.dumps(fn_input),
            output=json.dumps(fn_output),
        )
    ),
})