mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-28 07:29:06 +00:00
chore: telemetry for rankers, readers, retrievers, writers (#6075)
* add telemetry to pipelines 2.0 * only collect data if telemetry is on * reno * add downsampling * typing * manual tests * pylint * simplify code * Update haystack/preview/telemetry/__init__.py * look for _telemetry_data * rather index by component type * black * mypy * error handling * comment * review feedback & small improvements * defaultdict * stray changes * try-catch * method instead of attribute * fixes * remove print statements * lint * invert condition * always send the first event of the day * collect specs * track 2nd and 3rd events too * send first event and then max 1 event a minute * rename constant * black * add test * add telemetry for rankers readers and retrievers * get only the type of docstore, not the whole object
This commit is contained in:
parent
490de4e119
commit
6b097928ff
@ -56,6 +56,12 @@ class SimilarityRanker:
|
||||
self.model = None
|
||||
self.tokenizer = None
|
||||
|
||||
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
return {"model": str(self.model_name_or_path)}
|
||||
|
||||
def warm_up(self):
|
||||
"""
|
||||
Warm up the model and tokenizer used in scoring the documents.
|
||||
|
||||
@ -67,6 +67,12 @@ class ExtractiveReader:
|
||||
self.no_answer = no_answer
|
||||
self.calibration_factor = calibration_factor
|
||||
|
||||
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
return {"model": self.model_name_or_path}
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Serialize this component to a dictionary.
|
||||
|
||||
@ -41,6 +41,12 @@ class MemoryBM25Retriever:
|
||||
self.top_k = top_k
|
||||
self.scale_score = scale_score
|
||||
|
||||
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
return {"document_store": type(self.document_store).__name__}
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Serialize this component to a dictionary.
|
||||
|
||||
@ -44,6 +44,12 @@ class MemoryEmbeddingRetriever:
|
||||
self.scale_score = scale_score
|
||||
self.return_embedding = return_embedding
|
||||
|
||||
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
return {"document_store": type(self.document_store).__name__}
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Serialize this component to a dictionary.
|
||||
|
||||
@ -19,6 +19,12 @@ class DocumentWriter:
|
||||
self.document_store = document_store
|
||||
self.policy = policy
|
||||
|
||||
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
return {"document_store": type(self.document_store).__name__}
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Serialize this component to a dictionary.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user