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

Bugfixes/review pr 1687 #1745

Merged
merged 24 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ff6bfa2
feat(Client): validate token classification annotations in client (#…
frascuchon Sep 9, 2022
3cd1e3a
feat(Datasets): restrict dataset deletion only to creators and super-…
frascuchon Sep 13, 2022
202df1a
ci: set a proper cleanlab version for tests
frascuchon Sep 20, 2022
f066518
feat(Datasets): delete records by query (#1721)
frascuchon Sep 21, 2022
da35728
ci: HF tests only for master and releases branches (#1720)
frascuchon Sep 21, 2022
91d2359
ci: closing inactive issues (#1716)
frascuchon Sep 21, 2022
5a36849
ci: automatic insert license header (#1710)
frascuchon Sep 21, 2022
19acc1a
refactor: accept flat text as input for token classification mapper (…
Ankush-Chander Sep 22, 2022
d973eac
feat(Client): expose client extra headers in init function (#1715)
frascuchon Sep 22, 2022
5bd7586
style: Align App UI with the design system (#1672)
leiyre Sep 22, 2022
82fe331
docs: Add interpret tutorial with Transformers (#1728)
dvsrepo Sep 22, 2022
3af102f
[pre-commit.ci] pre-commit autoupdate (#1712)
pre-commit-ci[bot] Sep 13, 2022
4e78d79
chore: upgrade version
frascuchon Sep 27, 2022
a64fd6c
docs: fixing the active learning tutorial with `small-text` (#1726)
frascuchon Sep 27, 2022
66bb9c0
fix: search tag reset prior annotation (#1736)
keithCuniah Sep 28, 2022
f62dc23
docs: using official token class. mapper since is compatible now (#1738)
frascuchon Sep 30, 2022
9c309d3
chore: frontend version
frascuchon Sep 30, 2022
80762cc
tests: disable sending data to segment
frascuchon Oct 3, 2022
0215488
refactor: passing system data as event context
frascuchon Oct 3, 2022
d005f97
Show an early message warning about the server telemetry feature
frascuchon Oct 3, 2022
10be987
docs: Include telemetry under Reference section
frascuchon Oct 4, 2022
e3a46a0
Review telemetry warning
frascuchon Oct 4, 2022
cb3ab7d
Merge branch 'releases/0.x' into bugfixes/review-pr-1687
frascuchon Oct 4, 2022
bfd1b95
Using print instead of dramatic warnings
frascuchon Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ You can join the conversation on Slack! We are a very friendly and inclusive com
:caption: Reference
:hidden:

reference/telemetry
reference/python/index
reference/webapp/index

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions src/rubrix/server/commons/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,19 @@ def __post_init__(self):
"platform": platform.platform(),
"python_version": platform.python_version(),
"sys_version": platform.version(),
"rubrix_version": __version__,
"version": __version__,
}

def track_data(
self, action: str, data: Dict[str, Any], include_system_info: bool = True
):
event_data = data.copy()
if include_system_info:
event_data.update(self.__system_info__)
self.client.track(self.__server_id_str__, action, event_data)
self.client.track(
user_id=self.__server_id_str__,
event=action,
properties=event_data,
context=self.__system_info__ if include_system_info else {},
)


def _process_request_info(request: Request):
Expand Down
33 changes: 33 additions & 0 deletions src/rubrix/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"""
This module configures the global fastapi application
"""
import inspect
import os
import sys
import warnings
from pathlib import Path

from brotli_asgi import BrotliMiddleware
Expand Down Expand Up @@ -127,6 +130,35 @@ def configure_app_logging(app: FastAPI):
version=str(rubrix_version),
)


def configure_telemetry(app):
message = "\n"
message += inspect.cleandoc(
"""
Rubrix uses telemetry to report anonymous usage and error information.

You can know more about what information is reported at:

https://rubrix.readthedocs.io/en/stable/reference/telemetry.html

Telemetry is currently enabled. If you want to disable it, you can configure
the environment variable before relaunching the server:
"""
)
message += "\n\n "
message += (
"#set RUBRIX_ENABLE_TELEMETRY=0"
if os.name == "nt"
else "$>export RUBRIX_ENABLE_TELEMETRY=0"
)
message += "\n"

@app.on_event("startup")
async def check_telemetry():
if settings.enable_telemetry:
print(message, flush=True)


for app_configure in [
configure_app_logging,
configure_middleware,
Expand All @@ -135,5 +167,6 @@ def configure_app_logging(app: FastAPI):
configure_api_router,
configure_app_statics,
configure_app_storage,
configure_telemetry,
]:
app_configure(app)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def telemetry_track_data(mocker):
client = telemetry._TelemetryClient.get()
if client:
# Disable sending data for tests
client._client = telemetry._configure_analytics(disable_send=True)
client.client = telemetry._configure_analytics(disable_send=True)
spy = mocker.spy(client, "track_data")

return spy
Expand Down