Skip to content

Make Traceloop genuinely optional for raindrop-ai direct/external-OTel usage #34

Description

@lukeramsden

Summary

raindrop-ai eagerly imports the full Traceloop SDK and its provider instrumentation packages even when configured to use an existing OpenTelemetry SDK and direct tool-span shipping:

new Raindrop({
  writeKey,
  useExternalOtel: true,
  bypassOtelForTools: true,
});

Could Traceloop become a genuinely optional peer dependency, loaded only when a Traceloop-backed tracing mode is used? A lightweight entry point such as raindrop-ai/direct would also solve this if lazy loading is impractical.

Current behavior

In the configuration above:

  • Traceloop is initialized with tracingEnabled: false.
  • Raindrop does not create an OTel SDK/provider/exporter.
  • interaction.trackTool() uses Raindrop's direct HTTP shipper.
  • The consumer does not call createSpanProcessor() or getInstrumentations().

Despite that, importing raindrop-ai eagerly resolves Traceloop and instrumentation packages for Anthropic, OpenAI, Bedrock, Vertex AI, Cohere, Pinecone, ChromaDB, Qdrant, and Together.

This materially increases installation and CI layer size for consumers that do not use those integrations.

Reproduction

0.2.4-otelv2 already declares @traceloop/node-server-sdk as an optional dependency, but omitting optional dependencies makes the base package unloadable:

mkdir /tmp/raindrop-no-optional
cd /tmp/raindrop-no-optional
npm init -y
npm install --omit=optional raindrop-ai@0.2.4-otelv2
node -e "require('raindrop-ai')"

Result:

Error: Cannot find module '@traceloop/instrumentation-anthropic'
Require stack:
- node_modules/raindrop-ai/dist/index.js

Size impact

Measured using fresh isolated npm installations on macOS:

Package node_modules size
raindrop-ai@0.1.3 238 MiB
raindrop-ai@0.2.4 238 MiB
raindrop-ai@0.2.4-otelv2 144 MiB
raindrop-ai@0.2.4-otelv2 --omit=optional 70 MiB, but import fails

Exact sizes vary by platform, but the dependency difference is substantial.

Suggested behavior

  1. Declare Traceloop and its instrumentation packages as optional peer dependencies.
  2. Lazy-load them only when automatic/Traceloop-backed tracing is enabled.
  3. Allow useExternalOtel: true plus bypassOtelForTools: true to work without Traceloop installed.
  4. Alternatively, expose a lightweight entry point that excludes Traceloop imports.
  5. Add a smoke test that installs with --omit=optional and imports/constructs the direct/external-OTel configuration.

If Workshop is not the correct public tracker for the JavaScript SDK, please transfer or point me to the appropriate repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions