Skip to content
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

test: Add testing of cognee telemetry #573

Merged
merged 6 commits into from
Feb 27, 2025

Conversation

dexters1
Copy link
Collaborator

@dexters1 dexters1 commented Feb 24, 2025

Description

Add testing of cognee telemetry

DCO Affirmation

I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin

Summary by CodeRabbit

  • Tests

    • Introduced an automated testing process for telemetry components, running unit tests across multiple environments to ensure consistent performance. The workflow efficiently manages test execution and error reporting, speeding up development cycles.
  • Chores

    • Enhanced dependency management and cleanup procedures, significantly contributing to overall system stability, faster feedback cycles, and improved release quality.

@dexters1 dexters1 self-assigned this Feb 24, 2025
Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

Walkthrough

A new GitHub Actions workflow file (.github/workflows/test_telemetry.yml) has been added for automated testing of telemetry-related components. The workflow is triggered via manual dispatch or on pull request events (labeled/synchronized) and utilizes concurrency controls based on the pull request number or reference. It runs on a matrix of operating systems, sets up a Python environment with Poetry for dependency management, creates a telemetry identifier, executes unit tests, performs cleanup, and finally builds and installs the project package.

Changes

File(s) Change Summary
.github/workflows/test_telemetry.yml Added a workflow to automate telemetry testing. Configured to trigger on manual dispatch or PR events with labels/synchronizations. Sets up an environment (Ubuntu 22.04), installs Python (3.12.x) and Poetry, installs project dependencies, creates a telemetry identifier, runs unit tests, cleans up, and builds the package.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/PR Event
    participant WA as GitHub Actions
    participant Job as run_common Job
    participant Env as Environment Setup
    
    U->>WA: Trigger workflow (manual dispatch/PR event)
    WA->>Job: Launch run_common on matrix OS
    Job->>Env: Checkout code, setup Python 3.12.x, install Poetry
    Env->>Job: Install dependencies
    Job->>Job: Create telemetry ID (.anon_id), execute unit tests
    Job->>Job: Cleanup temporary files and caches
    Job->>WA: Build project package using Poetry
    WA-->>U: Report results
Loading

Poem

Oh, I'm a rabbit, hopping in the code,
Testing telemetry along a bumpy road.
With workflows that dance on Ubuntu skies,
Poetry manages the magic before my eyes.
I celebrate these changes with a joyful, twitchy nose!
🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 906a8cc and 181ceb6.

📒 Files selected for processing (1)
  • .github/workflows/test_telemetry.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test_telemetry.yml
⏰ Context from checks skipped due to timeout of 90000ms (29)
  • GitHub Check: run_notebook_test / test
  • GitHub Check: run_notebook_test / test
  • GitHub Check: run_notebook_test / test
  • GitHub Check: Test on macos-15
  • GitHub Check: Test on macos-15
  • GitHub Check: Test on macos-13
  • GitHub Check: Test on macos-13
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: Test on macos-15
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: Test on macos-13
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: run_notebook_test / test
  • GitHub Check: test
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: windows-latest
  • GitHub Check: run_dynamic_steps_example_test / test
  • GitHub Check: test
  • GitHub Check: run_simple_example_test / test
  • GitHub Check: run_networkx_metrics_test / test
  • GitHub Check: run_eval_framework_test / test
  • GitHub Check: run_multimedia_example_test / test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: docker-compose-test
  • GitHub Check: Build Cognee Backend Docker App Image

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/test_telemetry.yml (3)

1-2: Workflow Name Review:
The workflow name “test | test telemetry” is descriptive for its purpose. Consider simplifying the name if it will be displayed in dashboards to improve clarity.


12-15: Global Environment Variables:
The environment variables are set to enforce an ERROR log level and local environment. Consider if you might later need to parameterize these for different environments.


33-36: Checkout Action Version:
The workflow uses actions/checkout@master. It is recommended to pin to a stable version (e.g., actions/checkout@v3) to avoid potential disruptions if the default branch changes.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e56744 and e05b389.

📒 Files selected for processing (1)
  • .github/workflows/test_telemetry.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (33)
  • GitHub Check: Test on macos-15
  • GitHub Check: run_notebook_test / test
  • GitHub Check: run_multimedia_example_test / test
  • GitHub Check: Test on macos-13
  • GitHub Check: run_notebook_test / test
  • GitHub Check: run_notebook_test / test
  • GitHub Check: test
  • GitHub Check: run_notebook_test / test
  • GitHub Check: Test on macos-15
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: Test on macos-15
  • GitHub Check: run_networkx_metrics_test / test
  • GitHub Check: Test on macos-15
  • GitHub Check: run_simple_example_test / test
  • GitHub Check: run_eval_framework_test / test
  • GitHub Check: test
  • GitHub Check: Test on macos-13
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: Test on macos-13
  • GitHub Check: run_dynamic_steps_example_test / test
  • GitHub Check: windows-latest
  • GitHub Check: Test on macos-13
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: Test on ubuntu-22.04
  • GitHub Check: lint (ubuntu-latest, 3.11.x)
  • GitHub Check: lint (ubuntu-latest, 3.10.x)
  • GitHub Check: docker-compose-test
  • GitHub Check: Build Cognee Backend Docker App Image
🔇 Additional comments (14)
.github/workflows/test_telemetry.yml (14)

3-7: Event Trigger Configuration:
The workflow is correctly configured to trigger on both manual dispatch and pull request events (types: labeled, synchronize). This ensures tests run at appropriate times for telemetry changes.


8-11: Concurrency Settings Validation:
The concurrency group uses a composite key based on the workflow name and either the pull request number or branch reference, which will help prevent redundant runs.


16-32: Jobs and Matrix Configuration:
The run_common job is well configured to run on a matrix of operating systems with clear commentary on the OS labels. The use of fail-fast: false and specifying Bash as the shell ensures consistency across environments.


37-41: Python Setup Step:
The Python setup step using actions/setup-python@v5 with version 3.12.x is correctly specified, ensuring the desired Python version is used for the job.


42-49: Poetry Installation:
The installation of Poetry via snok/install-poetry@v1.4.1 with in-project virtual environments and parallel installation is effective. Ensure this version aligns with your project’s compatibility requirements.


50-52: Dependency Installation:
The step invoking poetry install --no-interaction -E docs -E evals correctly targets the extra groups. Confirm that the extras “docs” and “evals” include all necessary dependencies for telemetry testing.


53-55: NLTK Data Download:
The workflow downloads NLTK resources using poetry run python -m nltk.downloader punkt_tab averaged_perceptron_tagger_eng. Please verify that punkt_tab is the intended resource, as the common tokenizer package is usually named punkt.


56-59: Telemetry Identifier Setup:
The identifier “test-machine” is echoed into .anon_id, which appears appropriate for telemetry testing. Ensure this file is properly ignored in production builds if not required.


60-62: Unit Test Execution:
The workflow properly runs unit tests from cognee/tests/unit/ using pytest. Confirm that these tests adequately cover telemetry functionality.


63-65: Integration Test Execution:
Integration tests are executed on cognee/tests/integration/, and this step is well configured for telemetry integration testing.


66-77: Default Basic Pipeline Run:
This step sets several environment variables (including secret references) and runs a basic pipeline test via python ./cognee/tests/test_library.py. The use of secrets is appropriate; just ensure they’re masked in logs and only available during test runs.


78-83: Disk Cleanup Step:
The cleanup step uses sudo privileges to clean cache directories and prints disk usage. Verify that the runner’s permissions allow these commands and that no required caches for debugging or subsequent steps are removed inadvertently.


85-87: Build with Poetry:
The build step using poetry build is straightforward and correctly placed before package installation.


88-92: Package Installation:
Changing into the dist directory and installing the generated wheel via pip install *.whl is a clear method to test the built package. Consider verifying that only one wheel exists to avoid ambiguity.

@dexters1
Copy link
Collaborator Author

image

# - ubuntu-22.04: Linux
# - macos-13: macOS Intel
# - macos-15: macOS ARM (public preview)
os: [ubuntu-22.04, macos-13, macos-15]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine if we check it only on ubuntu.

installer-parallel: true

- name: Install dependencies
run: poetry install --no-interaction -E docs -E evals
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need docs and evals?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For unit and integration tests I think

@borisarzentar borisarzentar merged commit c9aee6f into dev Feb 27, 2025
36 checks passed
@borisarzentar borisarzentar deleted the COG-1398-test-telemetry-integration branch February 27, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants