Skip to content

Conversation

@sunym1991
Copy link
Collaborator

@sunym1991 sunym1991 commented Nov 21, 2025

Description

This PR adds comprehensive instrumentation for Mem0, a memory management system for AI applications. The changes include a complete test suite with unit tests, integration tests, and VCR-based HTTP recording/playback tests to validate the instrumentation implementation.

Key changes:

  • Adds tox test environment configuration for mem0 instrumentation
  • Implements comprehensive test suite covering utility functions, metrics, extractors, configuration, and instrumentor functionality
  • Includes VCR-based integration tests for both Memory and MemoryClient operations
  • Provides test fixtures and configuration for OpenTelemetry span/metric/log collection

Fixes #73

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • 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

  • Add unit tests.

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

@CLAassistant
Copy link

CLAassistant commented Nov 21, 2025

CLA assistant check
All committers have signed the CLA.

Change-Id: Ifca2517d822c14a87fde2c6bcb39a13360c3ed21
Co-developed-by: Cursor <[email protected]>
sunym1991 and others added 3 commits November 24, 2025 14:22
Change-Id: I4fb5d565c4b1a22c7946193e25979339b07ab287
Co-developed-by: Cursor <[email protected]>
Change-Id: I61194a674d7f2bfb800b656b6f3cb86fad4cd155
Co-developed-by: Cursor <[email protected]>
Change-Id: I24e7730baca2e4363823b55780654a1104a88882
Co-developed-by: Cursor <[email protected]>
Cirilla-zmh and others added 5 commits November 24, 2025 22:38
Change-Id: I1be20585e67d726b6690f7efc64bbf86c23ee077
Co-developed-by: Cursor <[email protected]>
Change-Id: I7d4a73207bce41f9c6880992b7a97c5957538498
Co-developed-by: Cursor <[email protected]>
Change-Id: I59d846db2d90c33b4573a7bcc2ff203983fa0023
Co-developed-by: Cursor <[email protected]>
Change-Id: I570e3f8ea4810890df3e05bf01868f1d063d9a66
Co-developed-by: Cursor <[email protected]>
Change-Id: Ibac64ce263d8d8f79f6909399e7af5779a866e18
Co-developed-by: Cursor <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive instrumentation for Mem0, a memory management system for AI applications. The changes include a complete test suite with unit tests, integration tests, and VCR-based HTTP recording/playback tests to validate the instrumentation implementation.

Key changes:

  • Adds tox test environment configuration for mem0 instrumentation
  • Implements comprehensive test suite covering utility functions, metrics, extractors, configuration, and instrumentor functionality
  • Includes VCR-based integration tests for both Memory and MemoryClient operations
  • Provides test fixtures and configuration for OpenTelemetry span/metric/log collection

Reviewed changes

Copilot reviewed 46 out of 49 changed files in this pull request and generated 28 comments.

Show a summary per file
File Description
tox-loongsuite.ini Adds test and lint environments for mem0 instrumentation
test_util.py Tests for utility functions (string handling, type conversion, extraction)
test_thread_pool_handler.py Tests for ThreadPool context propagation
test_metrics.py Tests for metrics container and recording
test_memory_operations_vcr.py VCR integration tests for Memory operations with fake dependencies
test_memory_operations_record_vcr.py VCR integration tests using recorded HTTP cassettes
test_memory_client_vcr.py VCR tests for MemoryClient (managed API) operations
test_memory_client_errors_vcr.py VCR tests for HTTP error scenarios
test_instrumentor.py Tests for instrumentation lifecycle and wrapping
test_extractors.py Tests for attribute extraction from operations
test_config.py Tests for configuration functions and environment variables
conftest.py Shared fixtures, fake classes, and VCR configuration
cassettes/*.yaml VCR cassettes for HTTP recording/playback
test-requirements.txt Test dependencies specification
pytest-min.ini Minimal pytest configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sunym1991 and others added 2 commits November 26, 2025 16:02
Change-Id: Iaea498e4ddf5cf822c7a3a590fbb8741a1a5c2be
Co-developed-by: Cursor <[email protected]>
…/opentelemetry/instrumentation/mem0/__init__.py

Co-authored-by: Minghui Zhang <[email protected]>
@github-actions github-actions bot requested a review from Cirilla-zmh November 26, 2025 08:19
Change-Id: I324d7e152f097805dc3afabdbb33007b076aa1e5
Co-developed-by: Cursor <[email protected]>
Change-Id: Ic60c2d9f8abf076088cba61eae79e86ec1ba9502
Co-developed-by: Cursor <[email protected]>
Change-Id: Icfae8ed38f023aa35b96acaa2fadafcb8cafb728
Co-developed-by: Cursor <[email protected]>
Change-Id: I6360f9da62347262ef11d957ea698279ad64419a
Co-developed-by: Cursor <[email protected]>
Change-Id: Idb0f2c6b3438a8fd9adc6a818b7e7c7e94f75d88
Co-developed-by: Cursor <[email protected]>
Change-Id: Ie4bc1f9aef0e62f37e5b98bc74247a6df00c6ed2
Co-developed-by: Cursor <[email protected]>
Change-Id: I2e6325995de5f52a0f4bac2db4a5f0e4c442821c
Co-developed-by: Cursor <[email protected]>
Change-Id: I5b38076c88af14d3939a9e27e21aa051e02fe418
Co-developed-by: Cursor <[email protected]>
Change-Id: I759159f3e456b8707933fc01d69557bb1da6a0b4
Co-developed-by: Cursor <[email protected]>
Change-Id: Id5e98a6c31924de35913e06b8e7b26e07c1c4b15
Co-developed-by: Cursor <[email protected]>
Copy link
Collaborator

@Cirilla-zmh Cirilla-zmh left a comment

Choose a reason for hiding this comment

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

Great PR! Several comments need to be resolved before merging this. Thanks!

@Cirilla-zmh Cirilla-zmh requested review from Aicheng-opensource and removed request for Aicheng-opensource December 1, 2025 02:11
Change-Id: I75fc347cad09e33dc54c89ff480ad081884d3652
Co-developed-by: Cursor <[email protected]>
@github-actions github-actions bot requested a review from Cirilla-zmh December 1, 2025 02:36
Copy link
Collaborator

@Cirilla-zmh Cirilla-zmh left a comment

Choose a reason for hiding this comment

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

LGTM

Change-Id: Idf5110cfde8789737ab0f984ba7c36ac2eae151c
Co-developed-by: Cursor <[email protected]>
@github-actions github-actions bot requested a review from Cirilla-zmh December 1, 2025 07:20
Change-Id: I7d122b5f2730d85bed1dc0619ba494f633649c40
Co-developed-by: Cursor <[email protected]>
Copy link
Collaborator

@123liuziming 123liuziming left a comment

Choose a reason for hiding this comment

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

LGTM

Change-Id: I5b5baa52398ca86ff3ee477e0920cc9531c02320
Co-developed-by: Cursor <[email protected]>
@Cirilla-zmh Cirilla-zmh merged commit e519645 into alibaba:main Dec 1, 2025
658 checks passed
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.

[feat] Add instrumentation for mem0

5 participants