Skip to content

Conversation

@yiyuan-he
Copy link
Contributor

Which problem is this PR solving?

This PR adds the initial project skeleton to kickstart a new instrumentation-langchain package.

Original PR raised by our intern: #3024

Short description of the changes

Mostly package metadata and licensing information. @mxiamxia and I (@yiyuan-he) also volunteer to be component owners for this new package.

@yiyuan-he yiyuan-he requested a review from a team as a code owner October 1, 2025 18:30
@yiyuan-he yiyuan-he force-pushed the skeleton-instrumentation-langchain branch from 952c0ef to 7a2c838 Compare October 1, 2025 18:47
@trentm trentm changed the title feat: add initial package skeleton for instrumentation-langchain feat(instrumentation-langchain): add initial package skeleton for instrumentation-langchain Oct 15, 2025

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `captureMessageContent` | `boolean` | `false` | Capture prompt and completion content. Can also be set via `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment variable. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this env variable available in the specification? is it used in different places right now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env var is used in instrumentation-openai. I'll remove it from this PR to keep the skeleton minimal and focused on structure. Will add the env var back along with supporting implementation (for message content capture) in a follow-up PR.


## Semantic Conventions

This package uses OpenTelemetry Semantic Conventions for GenAI operations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add specific semantic convention version planned for this, latest I assume?

https://github.com/open-telemetry/semantic-conventions/blob/v1.38.0/docs/README.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added v1.38.0, thanks!

},
"devDependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/contrib-test-utils": "^0.52.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"@opentelemetry/contrib-test-utils": "^0.55.0",
"@opentelemetry/sdk-logs": "^0.208.0",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks


export class LangChainInstrumentation extends InstrumentationBase<LangChainInstrumentationConfig> {
constructor(config: LangChainInstrumentationConfig = {}) {
super(PACKAGE_NAME, PACKAGE_VERSION, config);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to add code to handle env variable you mentioned in readme?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to remove the env var for now to facilitate a cleaner review. Related

"packages/instrumentation-knex": {},
"packages/instrumentation-koa": {},
"packages/instrumentation-langchain": {
"skip-github-release": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to ensure this would not be tried to be released as is currently a not fully functional instrumentation, I do not know if this will be sufficient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure how to verify this since i'm not too familiar with this repo. However, i looked through examples/bunyan/package.json and found the "private": true configuration which should add another layer of safety by preventing npm publish. Let me know if you think this will not be sufficient though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private: true works for npm, that's how we usually do it.
This here makes sure we don't see it in the GitHub releases.

That's the two places where we would like to avoid publishing things for now, so I think this works 👍

Copy link
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pichlermarc pichlermarc self-assigned this Dec 3, 2025
@JamieDanielson
Copy link
Member

It seems there is an error in the dependency tree. Error in log shows "npm error Could not resolve dependency:
npm error peer @langchain/core@">=0.2.21 <0.4.0" from [email protected]". Since this seems to be an older package version I wonder if one of the dependency needs to be pinned or at least more strict to avoid dependency conflicts?

Copy link
Contributor

@JacksonWeber JacksonWeber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from Hector's comment regarding ensuring that this does not get tied to releases, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants