Skip to content

Conversation

wrisa
Copy link
Contributor

@wrisa wrisa commented Jun 25, 2025

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented Jun 25, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@wrisa wrisa force-pushed the genai-instrumentation-langchain-support branch from 6215a69 to 92b9929 Compare June 27, 2025 17:10
@wrisa wrisa marked this pull request as ready for review June 27, 2025 20:15
@wrisa wrisa requested a review from a team as a code owner June 27, 2025 20:15
@wrisa wrisa force-pushed the genai-instrumentation-langchain-support branch from 92b9929 to a93b6d6 Compare July 8, 2025 15:03
@wrisa wrisa force-pushed the genai-instrumentation-langchain-support branch 2 times, most recently from b31b8b1 to a62d75f Compare July 14, 2025 17:25
@wrisa
Copy link
Contributor Author

wrisa commented Jul 15, 2025

@samuelcolvin @emdneto are there any outstanding concerns? Can I get approval if everything looks ok? Thanks!

@samuelcolvin
Copy link
Contributor

I'm not an expert (my review was really a drive-by), but overall LGTM.

@wrisa wrisa force-pushed the genai-instrumentation-langchain-support branch from a62d75f to 6850d01 Compare July 16, 2025 15:08
Copy link
Member

@aabmass aabmass left a 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?

# 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",
]

Copy link
Member

@aabmass aabmass left a 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

@wrisa
Copy link
Contributor Author

wrisa commented Jul 21, 2025

@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

Copy link
Member

@aabmass aabmass left a 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 😓

@aabmass
Copy link
Member

aabmass commented Jul 25, 2025

LGTM thank you for your patience!

@aabmass aabmass merged commit 80d5ba1 into open-telemetry:main Jul 25, 2025
625 checks passed
@liustve liustve mentioned this pull request Aug 5, 2025
7 tasks
devmonkey22 pushed a commit to devmonkey22/opentelemetry-python-contrib that referenced this pull request Aug 5, 2025
* 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
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.

10 participants