Skip to content

Add OpenTelemetry Auto-Instrumentation for Langchain Library #7

@galkleinman

Description

@galkleinman

Description

Add a new OpenTelemetry auto-instrumentation for Langchain Library. This instrumentation will greatly improve the observability and tracing capabilities of the Langchain based applications.

Details

  • Instrumentation Name: instrumentation-langchain
  • Description: This instrumentation will provide automatic tracing and observability for the Langchain Library.
  • Language: TypeScript

Motivation

Adding this instrumentation will allow seamless integration of OpenTelemetry with Langchain enabling better visibility into chains which will be represented as workflows/traces in tracing data and Traceloop dashoard.

High Level Instructions

  1. Add a new package in this monorepo which should called instrumentation-langchain, with the same structure/boilerplate of instrumentation-openai.
  2. Implement the auto instrumentation such that (quite similar to the instrumentation logic in the python sdk):
  • Every chain in Langchain will produce a span with the name <chain class name>.task
  • Traceloop Span Kind attribute from the semantic-convetions should be set to task and the span name is <chain class name>.task.
  • Propagate also the Workflow Name and Correlation Ids as well.
  • Produce workflow span For SequentialChain & RetrievalQA chains.
  1. Integrate the above implemented instrumentation within traceloop-sdk
  2. Add tests

Checklist

Please make sure the following criteria are met:

  • I have searched the existing issues and confirmed that this request is not a duplicate.
  • I have provided a clear and concise description of the requested instrumentation.
  • I have explained the motivation and benefits of adding this instrumentation.
  • I have included any additional information or resources that may be relevant.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions