-
Notifications
You must be signed in to change notification settings - Fork 766
Start supporting langchain instrumentation #3600
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
Start supporting langchain instrumentation #3600
Conversation
6215a69
to
92b9929
Compare
instrumentation-genai/opentelemetry-instrumentation-langchain/pyproject.toml
Show resolved
Hide resolved
92b9929
to
a93b6d6
Compare
instrumentation-genai/opentelemetry-instrumentation-langchain/pyproject.toml
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-langchain/pyproject.toml
Show resolved
Hide resolved
b31b8b1
to
a62d75f
Compare
@samuelcolvin @emdneto are there any outstanding concerns? Can I get approval if everything looks ok? Thanks! |
I'm not an expert (my review was really a drive-by), but overall LGTM. |
a62d75f
to
6850d01
Compare
opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py
Outdated
Show resolved
Hide resolved
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.
Can you opt-in to type checking as well?
opentelemetry-python-contrib/pyproject.toml
Lines 188 to 210 in f20fa77
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#type-check-rule-overrides | |
[tool.pyright] | |
typeCheckingMode = "strict" | |
reportUnnecessaryTypeIgnoreComment = true | |
reportMissingTypeStubs = false | |
pythonVersion = "3.9" | |
reportPrivateUsage = false # Ignore private attributes added by instrumentation packages. | |
# Add progressively instrumentation packages here. | |
include = [ | |
"instrumentation/opentelemetry-instrumentation-aiokafka", | |
"instrumentation/opentelemetry-instrumentation-asyncclick", | |
"instrumentation/opentelemetry-instrumentation-threading", | |
"instrumentation-genai/opentelemetry-instrumentation-vertexai", | |
] | |
# We should also add type hints to the test suite - It helps on finding bugs. | |
# We are excluding for now because it's easier, and more important to add to the instrumentation packages. | |
exclude = [ | |
"instrumentation/opentelemetry-instrumentation-aiokafka/tests/**/*.py", | |
"instrumentation/opentelemetry-instrumentation-asyncclick/tests/**/*.py", | |
"instrumentation/opentelemetry-instrumentation-threading/tests/**", | |
"instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/**/*.py", | |
"instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/**/*.py", | |
] |
opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py
Outdated
Show resolved
Hide resolved
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.
Will take a deeper review but thanks for the PR
instrumentation-genai/opentelemetry-instrumentation-langchain/pyproject.toml
Show resolved
Hide resolved
@aabmass Nir Gazit approved to go with same name with v2 version, please refer slack conversation here: https://cloud-native.slack.com/archives/C06KR7ARS3X/p1753006496166969?thread_ts=1752177146.822809&cid=C06KR7ARS3X |
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.
Thanks for your patience, hopefully this PR can be used as a sample for future boilerplate 😓
...entelemetry-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/version.py
Outdated
Show resolved
Hide resolved
LGTM thank you for your patience! |
* Added base files for the project * Added fix for generate and pre-commit * Added package.py * tox generate changes to auto-generated files * tox ruff reformatted file * removed python 3.8 from classifiers * addressed comments * addressed aabmass's comments
Description
This PR establishes the foundational files for the LangChain instrumentation project, referencing /opentelemetry-instrumentation-openai-v2 files. In future, this langchain instrumentation support(inspired by Traceloop's LangChain instrumentation) will extend functionality to include spans, metrics, and event logs. A POC has been completed at Cisco-Splunk, showcasing the generation of separate spans, metrics, and event logs for LangChain features like LLM invocation, chains, RAG, and tools. The ultimate goal is to align these implementations with semantic conventions.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.