Skip to content

Comments

Add GenAI memory span instrumentation#4215

Open
nagkumar91 wants to merge 5 commits intoopen-telemetry:mainfrom
nagkumar91:nag/pr3250-memory-semconv-genai
Open

Add GenAI memory span instrumentation#4215
nagkumar91 wants to merge 5 commits intoopen-telemetry:mainfrom
nagkumar91:nag/pr3250-memory-semconv-genai

Conversation

@nagkumar91
Copy link
Contributor

@nagkumar91 nagkumar91 commented Feb 18, 2026

Summary

Implements the GenAI memory operation semantic conventions proposed in
open-telemetry/semantic-conventions#3250 for Python contrib instrumentations.

What changed

  • Added memory operation semantic-convention coverage in Python contrib GenAI instrumentation:
    • operation names: search_memory, update_memory, delete_memory,
      create_memory_store, delete_memory_store
    • span naming updates for memory store operations
    • memory semantic attributes extraction and emission
  • Added retriever memory search instrumentation in
    opentelemetry-instrumentation-langchain:
    • emits search_memory operation telemetry
    • records memory store/query/result-count attributes
  • Added/updated unit tests and changelog entries.

Related PRs

How has this been tested?

  • Ran unit tests for updated memory instrumentation and langchain callback handling.

Type of change

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

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist

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

Implement PR 3250 memory operation coverage in openai-agents-v2 and langchain, including memory span attributes and retriever memory search telemetry tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nagkumar91 and others added 3 commits February 23, 2026 10:01
…conv-genai

# Conflicts:
#	instrumentation-genai/opentelemetry-instrumentation-langchain/CHANGELOG.md
…ch_memory'

LangChain's retriever abstraction is generic — it covers both RAG/vector
DB search and memory retrieval. Defaulting all retrievers to search_memory
was incorrect for non-memory retrievers.

Now:
- Default operation is 'retrieval' for all retrievers
- Only use 'search_memory' when metadata explicitly indicates memory
  (memory_store_name, memory_store_id, or is_memory_retriever flag)
- Memory attributes (gen_ai.memory.*) are still attached when present

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Suppress reportUnknownArgumentType/reportUnknownVariableType on
  serialized_id list join (type comes from untyped dict[str, Any])
- Remove unnecessary isinstance(query, str) check — query param is
  already typed as str in on_retriever_start signature

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

6 participants