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

feat:opendata upload #660

Merged
merged 4 commits into from
Mar 11, 2025
Merged

feat:opendata upload #660

merged 4 commits into from
Mar 11, 2025

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Mar 10, 2025

metrics integration for https://github.com/TigreGotico/metrics-server-docker or equivalent

{
  "open_data": {
    "intent_urls": [
       "http://localhost:8000/intents",
       "https://metrics.tigregotico.pt/intents"
    ]
   }
}

img

Summary by CodeRabbit

  • New Features
    • Improved tracking for language interpretation by automatically reporting intent matching data to a configured endpoint, enhancing performance monitoring and diagnostics.
    • Introduced a method for uploading intent match data to specified servers.

Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

The changes introduce a new method _upload_match_data in the IntentService class, which uploads intent match data to a specified server if configured. This method constructs a data payload with the utterance, intent, language, and match data, sending it via a POST request to a user-defined API URL. The _emit_match_message method is modified to call _upload_match_data after emitting a reply message. The import statements have been reorganized to include requests for HTTP communication.

Changes

File Change Summary
ovos_core/intent_services/init.py Added _upload_match_data to construct and upload intent match data using a POST request; reorganized imports to include requests for HTTP calls

Sequence Diagram(s)

sequenceDiagram
    participant IS as IntentService
    participant Req as requests (HTTP)
    participant API as User API Server

    IS->>IS: _emit_match_message (process intent match)
    alt Match Found
        IS->>IS: Construct data payload
        IS->>Req: _upload_match_data(payload)
        Req->>API: POST payload
        API-->>Req: Response
        Req-->>IS: Return response
    else No Match
        IS->>IS: Log failure
    end
Loading

Poem

I'm a rabbit hopping through the code,
With data to post on the digital road.
New methods bloom like carrots in a row,
Sending match data where the network flows.
Hop along, dear coder – let the updates glow!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ad156c7 and 84743ee.

📒 Files selected for processing (1)
  • ovos_core/intent_services/__init__.py (2 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 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 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.

@github-actions github-actions bot added feature and removed feature labels Mar 10, 2025
Copy link

@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: 2

🧹 Nitpick comments (1)
ovos_core/intent_services/__init__.py (1)

358-381: Consider privacy and performance optimizations.

The current implementation sends all utterances to the metrics server, which raises privacy considerations and could generate significant network traffic.

Consider:

  1. Adding a sampling mechanism to only upload a percentage of interactions
  2. Ensuring users are informed about data collection
  3. Implementing the upload asynchronously to avoid blocking the main thread
# Example of asynchronous implementation using ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor

# Create a thread pool at class level
self._metrics_executor = ThreadPoolExecutor(max_workers=2)

# In the _upload_match_data method:
def _upload_match_data(self, utterance, intent, lang, match_data):
    # ... existing code ...
    
    # Sample data (e.g., only send 10% of interactions)
    if config.get("sampling_rate", 100) < random.randint(1, 100):
        return
        
    # Submit to thread pool instead of blocking
    self._metrics_executor.submit(self._do_upload, api_url, data, headers)
    
def _do_upload(self, api_url, data, headers):
    try:
        response = requests.post(api_url, data=data, headers=headers, timeout=3)
        LOG.info(f"Uploaded metrics - Response: {response.status_code}")
    except Exception as e:
        LOG.warning(f"Failed to upload metrics: {e}")
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f0659b and 21300f9.

📒 Files selected for processing (1)
  • ovos_core/intent_services/__init__.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: end2end_tests (3.11)
  • GitHub Check: unit_tests (3.11)
  • GitHub Check: license_tests
🔇 Additional comments (2)
ovos_core/intent_services/__init__.py (2)

19-19: Added the requests library for HTTP communication.

This new dependency is correctly imported to support the metrics upload functionality.


346-356: Good integration of metrics upload into the intent matching flow.

The code properly handles both successful matches and failures, providing valuable data points for metrics collection.

Copy link

codecov bot commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.

Project coverage is 69.53%. Comparing base (23f0bab) to head (84743ee).
Report is 203 commits behind head on dev.

Files with missing lines Patch % Lines
ovos_core/intent_services/__init__.py 58.33% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #660      +/-   ##
==========================================
- Coverage   75.33%   69.53%   -5.81%     
==========================================
  Files          15       15              
  Lines        3094     1671    -1423     
==========================================
- Hits         2331     1162    -1169     
+ Misses        763      509     -254     
Flag Coverage Δ
end2end 53.62% <58.33%> (?)
unittests 46.02% <33.33%> (-29.32%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions github-actions bot added feature and removed feature labels Mar 10, 2025
@github-actions github-actions bot added feature and removed feature labels Mar 10, 2025
@github-actions github-actions bot added feature and removed feature labels Mar 10, 2025
@JarbasAl JarbasAl merged commit beb1c4e into dev Mar 11, 2025
6 of 8 checks passed
@JarbasAl JarbasAl deleted the feat/opendata branch March 11, 2025 16:46
JarbasAl added a commit that referenced this pull request Mar 11, 2025
* remove mycroft (#439)

* breaking!:remove mycroft module

* drop cps

* Update translations

* Increment Version to 1.0.0a1

* Update Changelog

* Update skills-essential.txt (#656)

add https://github.com/OpenVoiceOS/ovos-skill-diagnostics to default skills

* Increment Version to 1.0.0a2

* Update Changelog

* Update skills-media.txt (#658)

add youtube music to extras list

* Increment Version to 1.0.0a3

* Update Changelog

* feat:opendata upload (#660)

* feat:opendata upload

metrics integration for https://github.com/TigreGotico/metrics-server-docker or equivalent

* Update ovos_core/intent_services/__init__.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* support multiple urls

* fix config

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Increment Version to 1.1.0a1

* Update Changelog

---------

Co-authored-by: JarbasAI <[email protected]>
Co-authored-by: JarbasAl <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant