发布

  • [OPIK-6321] [SDK][FE] feat: hide non-essential LangGraph internal spans by default (#7095)

    frostbyte_neo 发布于 2026-06-16 10:28:17 +00:00

    • [OPIK-6321] [SDK][FE] feat: hide non-essential LangGraph internal spans by default

    SDK (langchain integration): tag LangGraph framework-plumbing spans with
    metadata.opik = {framework: langgraph, category: internal}. Classification keys
    on the langgraph
    * run metadata: a chain span inside a graph is internal unless its
    run name equals langgraph_node (the node/sub-agent boundary). LLM and tool runs are
    always kept; runs without langgraph_* metadata (plain LCEL) are out of scope.

    FE (v2 trace tree): trust the metadata, framework-agnostic. A small decision layer
    (spanVisibility) decides hideability via composable rules; hiddenSpans drops hidden
    spans and re-parents their children; a persisted per-user toggle and a displayed/total
    span count are self-contained components. Generic tree viewer/store/helpers untouched.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • fix(traces): address PR review on langgraph internal-span hiding
    • VisibleSpanCount: count hidden over spans only so the trace root can't undercount displayed
    • langchain: coerce a non-dict reserved _opik before tagging internal spans
    • hiddenSpans.test: rename cases to the should…when convention

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • test(langchain): cover langgraph span classifier with real-run-driven tests
    • drive is_internal_langgraph_run / get_run_metadata off run_dicts captured from a
      real no-LLM LangGraph run instead of hand-built fixtures
    • keep synthetic cases only for markers and malformed inputs real runs can't surface
    • integration test asserts the exact set of visible (non-internal) spans, so new
      undetected plumbing breaks the test instead of leaking into the UI

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • fix(traces): drop langgraph framework tag from _opik metadata; fix FE lint
    • _opik now stores only {category: internal}; the framework name was never read by the
      UI (which keys solely on category), keeping the categorization framework-neutral
    • VisibleSpanCount: wrap useMemo callback to satisfy prettier

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • refactor(traces): use _opik.is_internal flag instead of category=internal

    Replace the generic {category: internal} categorization with an explicit
    {is_internal: true} flag across the SDK tagging, FE decision layer, and tests.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com


    Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com

    下载附件