发布

  • [OPIK-6835] [SDK] feat: support OPIK_TRACK_DISABLE in TypeScript SDK (#7106)

    frostbyte_neo 发布于 2026-06-16 09:56:52 +00:00

    • [OPIK-6835] [SDK] feat: support OPIK_TRACK_DISABLE in TypeScript SDK

    Add OPIK_TRACK_DISABLE support to the TypeScript SDK, mirroring the Python
    SDK: when disabled, the track decorator and integrations skip tracing while
    the low-level client API stays active, and Cloud credential validation is
    relaxed so an instrumented app runs without a key or local deployment.

    Adds a runtime config (TracingRuntimeConfig) with a global toggle API
    (isTracingActive / setTracingActive / resetTracingToConfigDefault) whose
    default is derived once from trackDisable and cached. The decorator and each
    integration gate on isTracingActive() before doing any tracing work.

    Includes an onboarding design doc (design/TRACING.md) covering the trace/span
    model, native API, decorator, integrations, and disabling/runtime toggle.

    Implements OPIK-6835: Support OPIK_TRACK_DISABLE in TypeScript SDK

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

    • fix(typescript): gate tracing in core primitives, not integrations

    The integration packages (opik-openai/gemini/langchain/vercel) build against
    the published opik peer dependency, so they cannot reference the new
    isTracingActive export / trackDisable field added in this PR — the
    build-and-publish jobs failed with TS2305 (no exported member
    'isTracingActive').

    Move the OPIK_TRACK_DISABLE gate from the integration packages into the core
    primitives (OpikClient.trace and Trace/Span .span/.update/.score), which every
    tracing path — the decorator, direct client calls, and all integrations — goes
    through. Integrations now honor the flag transparently with zero
    integration-package changes. The decorator keeps its caller-side short-circuit.

    Trade-off vs Python: a direct client.trace() is now also gated (Python keeps
    the low-level client live); for Opik 'disabled means send nothing' this is the
    safer, single-gate default. Documented in design/TRACING.md.

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

    • docs(typescript): document OPIK_TRACK_DISABLE for the TypeScript SDK

    Fill in the TypeScript tab of the 'Disabling the logging process' section
    (previously 'not supported in the Typescript SDK') with the OPIK_TRACK_DISABLE
    env var and the runtime toggle API (isTracingActive / setTracingActive /
    resetTracingToConfigDefault), and update the SDK configuration comparison and
    TypeScript options tables. Applied to both the live (docs-v2) and v1 trees.

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

    • docs(typescript): simplify track-disable note to 'disables all tracing'

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

    下载附件