Skip to content

Commit 31d957e

Browse files
authored
[CHORE] In colab telemetry (#2270)
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Adds telemetry to detect if a client is launched in a colab env - New functionality - None ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?* None
1 parent 28e62d8 commit 31d957e

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

chromadb/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,18 @@
4646

4747
__version__ = "0.5.0"
4848

49+
4950
# Workaround to deal with Colab's old sqlite3 version
50-
try:
51-
import google.colab # noqa: F401
51+
def is_in_colab() -> bool:
52+
try:
53+
import google.colab # noqa: F401
5254

53-
IN_COLAB = True
54-
except ImportError:
55-
IN_COLAB = False
55+
return True
56+
except ImportError:
57+
return False
58+
59+
60+
IN_COLAB = is_in_colab()
5661

5762
is_client = False
5863
try:

chromadb/telemetry/product/events.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
class ClientStartEvent(ProductTelemetryEvent):
88
def __init__(self) -> None:
99
super().__init__()
10+
# Lazy import to avoid circular imports
11+
from chromadb import is_in_colab
12+
13+
self.in_colab = is_in_colab()
1014

1115

1216
class ServerStartEvent(ProductTelemetryEvent):

docs/docs.trychroma.com/pages/telemetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ANONYMIZED_TELEMETRY=False
3535

3636
We will only track usage details that help us make product decisions, specifically:
3737

38-
- Chroma version and environment
38+
- Chroma version and environment details (e.g. OS, Python version, is it running in a container, or in a jupyter notebook)
3939
- Usage of embedding functions that ship with Chroma and aggregated usage of custom embeddings (we collect no information about the custom embeddings themselves)
4040
- Collection commands. We track the anonymized uuid of a collection as well as the number of items
4141
- `add`

0 commit comments

Comments
 (0)