Skip to content

langchain instrumentor PR#448

Closed
haneric00 wants to merge 39 commits into
aws-observability:mainfrom
haneric00:langchain-instrumentation
Closed

langchain instrumentor PR#448
haneric00 wants to merge 39 commits into
aws-observability:mainfrom
haneric00:langchain-instrumentation

Conversation

@haneric00

Copy link
Copy Markdown

Migrated code from https://github.com/yiyuan-he/opentelemetry-langchain-instrumentation-v2 to this repo.

Made a new folder in root directory for this code. Because this is standalone from the rest of ADOT, therefore it felt more correct to keep this out as a standalone folder.

Longterm:

  • remove this package entirely from ADOT once it is contributed to upstream and when OTel releases it, and we bump ADOT version to that new release version

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@haneric00 haneric00 requested a review from a team as a code owner August 5, 2025 22:31
- removing unused imports
changing != to is not
removing f strings with no assignment
removing double defined functions
- change camel to snake case
- added headers
Comment thread aws-opentelemetry-distro/pyproject.toml Outdated
"opentelemetry-instrumentation-urllib3 == 0.54b1",
"opentelemetry-instrumentation-wsgi == 0.54b1",
"opentelemetry-instrumentation-cassandra == 0.54b1",
"langchain == 0.3.27",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not need some of these dependencies here.

For example, why do we need duckduckgo-search?

Comment thread aws-opentelemetry-distro/pyproject.toml Outdated
aws_configurator = "amazon.opentelemetry.distro.aws_opentelemetry_configurator:AwsOpenTelemetryConfigurator"

[project.entry-points.opentelemetry_instrumentor]
langchain = "amazon.opentelemetry.distro.instrumentation.mcp.instrumentation:McpInstrumentor"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo?

amazon.opentelemetry.distro.instrumentation.mcp.instrumentation:McpInstrumentor

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, thanks for looking

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have a pyproject.toml defined here but we are also adding dependencies in the ADOT root pyproject.toml file?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think this one can be deleted. I think we had it for the previous structure and I forgot to remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this file? Wouldn't this define ADOT's version to be "0.1.0"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we're adding the langchain instrumentation to ADOT, I don't think we need to define a version for the langchain instrumentor since it is not really a standalone package anymore.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What are all these cassette files for? Do we need these?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

no, can be deleted, these are generated from the old tests that would make API calls, will delete.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need test-requirements.txt when we already have a pyproject.toml file?

Comment thread dev-requirements.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as other comment.

@yiyuan-he

Copy link
Copy Markdown
Contributor

Mostly left comments about clean up and dependency related stuff so far.

Will take look at the instrumentation logic in the next round of review.

Comment thread dev-requirements.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This file can probably be removed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think the dev-requirements.txt file is from before me, are you sure I should delete it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah my bad, ignore this comment. I thought this was still the old requirements.txt file from before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we still need a version for our langchain instrumentor if it's just a part of ADOT now?

Comment thread aws-opentelemetry-distro/pyproject.toml Outdated
Comment on lines +90 to +91
"pytest-asyncio == 0.21.0",
"pytest-vcr == 1.0.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we should add these in the main dependencies since they are just for testing. For example, we don't like pytest here either.

Comment thread aws-opentelemetry-distro/pyproject.toml Outdated
Comment on lines +86 to +89
"langchain-core == 0.3.72",
"langchain-aws == 0.2.15",
"langchain-community == 0.3.27",
"langgraph == 0.6.3",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For instrumentation libraries, we normally don't add dependencies for the library we're instrumenting directly. For example, see the pyproject.toml in the upstream instrumentor.

The reason for this is because we only want to instrument a customer's library if they have it installed. Otherwise, our instrumentation logic will just not run.

…ts and deleted unnecessary dependencies from pyproject.toml and added new path to pyproject.toml
@yiyuan-he yiyuan-he closed this Jan 20, 2026
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.

2 participants