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] argilla server: add user and server id on telemetry metrics #5445

Conversation

frascuchon
Copy link
Member

Description

This PR restores the server_id for telemetry purposes and also add the user.id and user.role when tracking API requests.

Type of change

  • Improvement (change adding some improvement to an existing functionality)
  • Documentation update

How Has This Been Tested

Checklist

  • I added relevant documentation
  • I followed the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • I confirm My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.33%. Comparing base (00b6caa) to head (e047a04).
Report is 1 commits behind head on feat/5204-feature-add-huggingface_hubutilssend_telemetry-to-the-argilla-server.

Files with missing lines Patch % Lines
...lla-server/src/argilla_server/telemetry/_client.py 86.66% 2 Missing ⚠️
...la-server/src/argilla_server/telemetry/_helpers.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@                                                Coverage Diff                                                 @@
##           feat/5204-feature-add-huggingface_hubutilssend_telemetry-to-the-argilla-server    #5445      +/-   ##
==================================================================================================================
- Coverage                                                                           91.34%   91.33%   -0.02%     
==================================================================================================================
  Files                                                                                 140      141       +1     
  Lines                                                                                5767     5791      +24     
==================================================================================================================
+ Hits                                                                                 5268     5289      +21     
- Misses                                                                                499      502       +3     
Flag Coverage Δ
argilla-server 91.33% <89.74%> (-0.02%) ⬇️

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.

Also, review and simplify the track_data method
@frascuchon frascuchon marked this pull request as ready for review September 2, 2024 12:45

_LOGGER = logging.getLogger(__name__)


@dataclasses.dataclass
class TelemetryClient:
_server_id: int = uuid.getnode()
Copy link
Member Author

Choose a reason for hiding this comment

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

The uuid.getnode returns an integer value. We can use it "as is".

Copy link
Member

Choose a reason for hiding this comment

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

We should check that uuid.getnode() is returning the same value on HF Spaces even after a factory rebuild.

if count is not None:
user_agent["count"] = count
async def track_data(self, topic: str, data: dict):
library_name = "argilla-server"
Copy link
Member Author

@frascuchon frascuchon Sep 2, 2024

Choose a reason for hiding this comment

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

This aligns the library name (argilla-server) to the package published in pypi.org


_LOGGER = logging.getLogger(__name__)


@dataclasses.dataclass
class TelemetryClient:
_server_id: int = uuid.getnode()
Copy link
Member

Choose a reason for hiding this comment

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

We should check that uuid.getnode() is returning the same value on HF Spaces even after a factory rebuild.

@jfcalvo jfcalvo self-requested a review September 2, 2024 16:44
@frascuchon frascuchon force-pushed the feat/argilla-server/add-user-and-server-id-on-telemetry-metrics branch from 4290b5f to e047a04 Compare September 2, 2024 16:57
@frascuchon
Copy link
Member Author

We should check that uuid.getnode() is returning the same value on HF Spaces even after a factory rebuild.

Changes introduced storing the server ID allow reuse of the server ID on restart when persistent storage is enabled. We can add also info about persistent storage on server startup.

@frascuchon frascuchon merged commit 942455d into feat/5204-feature-add-huggingface_hubutilssend_telemetry-to-the-argilla-server Sep 2, 2024
6 checks passed
@frascuchon frascuchon deleted the feat/argilla-server/add-user-and-server-id-on-telemetry-metrics branch September 2, 2024 17:07
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.

2 participants