langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

callbacks: introduce new callback handler pattern for wrapping Chain and LLM calls in spans, add OpenTelemetryCallbacksHandler

Open aannirajpatel opened this issue 1 year ago • 4 comments

Addresses issue #652

PR Checklist

  • ✅ Read the Contributing documentation.
  • ✅ Read the Code of conduct documentation.
  • ✅ Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • ✅ Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • ✅ Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves.
  • ✅ Describes the source of new concepts.
  • ✅ References existing implementations as appropriate.
  • ✅ Contains test coverage for new functions.
  • ✅ Passes all golangci-lint checks.

aannirajpatel avatar Jul 02 '24 01:07 aannirajpatel

Ready for review. @tmc, @recht

aannirajpatel avatar Jul 02 '24 02:07 aannirajpatel

Hi @codefromthecrypt,

Thank you for taking the time to review!

I've added some docs that talk about the example at docs/docs/modules/callbacks/opentelemetry/index.mdx (https://github.com/tmc/langchaingo/blob/1b9a058eb393df90fe5f2d6a08312bd1833e61e4/docs/docs/modules/callbacks/opentelemetry/index.mdx) - please let me know if I should move or reference this via a fresh README in the corresponding example directory.

aannirajpatel avatar Aug 20 '24 11:08 aannirajpatel

Thanks for the pointer to instructions!

please let me know if I should move or reference this via a fresh README in the corresponding example directory.

I started clicking down examples and at least the first several all have a README where the example is defined. Maybe look at some of the others are handling this, if they refer index.mdx to the example README or if the content is duplicated?

codefromthecrypt avatar Aug 20 '24 23:08 codefromthecrypt

There is a summary thing I notice which is that we are adding attributes who are not required with zero values. This also applies to setting Status to unset. I think we should avoid doing that as it clutters

  • [ ] Tracking this as a todo

aannirajpatel avatar Aug 21 '24 12:08 aannirajpatel