mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-04 13:53:16 +00:00
feat: Send pipeline config hash every 100 runs (#4884)
* Add since_last_run property * Revert "Add since_last_run property" This reverts commit c1c907ef58a696a97d964fb9c45fbee0c80365aa. * Send pipeline config hash for each run * Send event every 100 runs * Merge branch 'main' into telemetry_since_last_run * PR review * Move constant
This commit is contained in:
parent
73380b194a
commit
179e9cea08
@ -73,6 +73,7 @@ class Pipeline:
|
|||||||
self.graph = DiGraph()
|
self.graph = DiGraph()
|
||||||
self.config_hash = None
|
self.config_hash = None
|
||||||
self.last_config_hash = None
|
self.last_config_hash = None
|
||||||
|
self.runs = 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def root_node(self) -> Optional[str]:
|
def root_node(self) -> Optional[str]:
|
||||||
@ -492,6 +493,8 @@ class Pipeline:
|
|||||||
about their execution. By default, this information includes the input parameters
|
about their execution. By default, this information includes the input parameters
|
||||||
the Nodes received and the output they generated. You can then find all debug information in the dictionary returned by this method under the key `_debug`.
|
the Nodes received and the output they generated. You can then find all debug information in the dictionary returned by this method under the key `_debug`.
|
||||||
"""
|
"""
|
||||||
|
self.runs += 1
|
||||||
|
|
||||||
send_pipeline_event(
|
send_pipeline_event(
|
||||||
pipeline=self,
|
pipeline=self,
|
||||||
query=query,
|
query=query,
|
||||||
@ -640,6 +643,8 @@ class Pipeline:
|
|||||||
about their execution. By default, this information includes the input parameters
|
about their execution. By default, this information includes the input parameters
|
||||||
the Nodes received and the output they generated. You can then find all debug information in the dictionary returned by this method under the key `_debug`.
|
the Nodes received and the output they generated. You can then find all debug information in the dictionary returned by this method under the key `_debug`.
|
||||||
"""
|
"""
|
||||||
|
self.runs += 1
|
||||||
|
|
||||||
send_pipeline_event(
|
send_pipeline_event(
|
||||||
pipeline=self,
|
pipeline=self,
|
||||||
queries=queries,
|
queries=queries,
|
||||||
|
@ -14,6 +14,7 @@ HAYSTACK_TELEMETRY_ENABLED = "HAYSTACK_TELEMETRY_ENABLED"
|
|||||||
HAYSTACK_EXECUTION_CONTEXT = "HAYSTACK_EXECUTION_CONTEXT"
|
HAYSTACK_EXECUTION_CONTEXT = "HAYSTACK_EXECUTION_CONTEXT"
|
||||||
HAYSTACK_DOCKER_CONTAINER = "HAYSTACK_DOCKER_CONTAINER"
|
HAYSTACK_DOCKER_CONTAINER = "HAYSTACK_DOCKER_CONTAINER"
|
||||||
CONFIG_PATH = Path("~/.haystack/config.yaml").expanduser()
|
CONFIG_PATH = Path("~/.haystack/config.yaml").expanduser()
|
||||||
|
SEND_EVENT_EVERY_N_RUNS = 100
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -146,14 +147,18 @@ def send_pipeline_event( # type: ignore
|
|||||||
telemetry.send_event(event_name="Public Demo", event_properties=event_properties)
|
telemetry.send_event(event_name="Public Demo", event_properties=event_properties)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Send this event only if the pipeline config has changed
|
# If pipeline config has not changed, send an event every SEND_EVENT_EVERY_N_RUNS runs
|
||||||
if pipeline.last_config_hash == pipeline.config_hash:
|
if pipeline.last_config_hash == pipeline.config_hash and pipeline.runs % SEND_EVENT_EVERY_N_RUNS == 0:
|
||||||
|
event_properties = {"pipeline.config_hash": pipeline.config_hash, "pipeline.runs": pipeline.runs}
|
||||||
|
telemetry.send_event(event_name="Pipeline", event_properties=event_properties)
|
||||||
return
|
return
|
||||||
pipeline.last_config_hash = pipeline.config_hash
|
pipeline.last_config_hash = pipeline.config_hash
|
||||||
|
pipeline.runs = 1
|
||||||
|
|
||||||
event_properties = {
|
event_properties = {
|
||||||
"pipeline.classname": pipeline.__class__.__name__,
|
"pipeline.classname": pipeline.__class__.__name__,
|
||||||
"pipeline.config_hash": pipeline.config_hash,
|
"pipeline.config_hash": pipeline.config_hash,
|
||||||
|
"pipeline.runs": pipeline.runs,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add document store
|
# Add document store
|
||||||
|
Loading…
x
Reference in New Issue
Block a user