-
Notifications
You must be signed in to change notification settings - Fork 421
refactor: Updated @langchain/core instrumentation to subscribe to events emitted
#3493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor: Updated @langchain/core instrumentation to subscribe to events emitted
#3493
Conversation
@langchain/core instrumentation to subscribe to events emitted
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3493 +/- ##
==========================================
- Coverage 97.81% 89.52% -8.29%
==========================================
Files 434 435 +1
Lines 56941 57091 +150
Branches 1 1
==========================================
- Hits 55698 51112 -4586
- Misses 1243 5979 +4736
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
51a3401 to
f44078a
Compare
9f9d6b0 to
7c0304a
Compare
427f4c0 to
a050bbb
Compare
bizob2828
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as google gen ai. we need to look at the spec for enabling/disabling AI monitoring, not sure if we have this correct
a050bbb to
4f874a9
Compare
bizob2828
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to have a lot of the same comments:
- remove optional chaining for checking configuration
- use
this.enabledto check if ai monitoring is enabled - add a
this.streamingEnabledand use that to check if streaming is enabled - We should only be checking if ai monitoring is enabled before creating LLM events, the segment should still be created
a51660c to
9fbf2c0
Compare
| if (!this.streamingEnabled) { | ||
| logger.warn('`ai_monitoring.streaming.enabled` is set to `false`, stream will not be instrumented.') | ||
| agent.metrics.getOrCreateMetric(STREAMING_DISABLED).incrementCallCount() | ||
| agent.metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine but all the other AIM instrumentations wraps this in an addLlmMeta, that can happen in #3487
cb5d298 to
c620c39
Compare
d2a7fd7 to
964d537
Compare
This PR resolves #3442.