Skip to content

Commit

Permalink
Reduces telemetry sent (#1237)
Browse files Browse the repository at this point in the history
* Reduces telemetry sent

* Fixing telemetry tests

Need to set event count to higher since it seems to impact running tests.
  • Loading branch information
skrawcz authored Nov 22, 2024
1 parent 889b8b6 commit f818bb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hamilton/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
CLI_COMMAND = "os_hamilton_cli_command"
EXPERIMENT_SERVER = "os_hamilton_experiment_server"
TIMEOUT = 2
MAX_COUNT_SESSION = 100 # max number of events collected per python process
MAX_COUNT_SESSION = 10 # max number of events collected per python process
DEFAULT_CONFIG_URI = os.environ.get("HAMILTON_CONFIG_URI", "~/.hamilton.conf")
DEFAULT_CONFIG_LOCATION = os.path.expanduser(DEFAULT_CONFIG_URI)

Expand Down Expand Up @@ -155,6 +155,7 @@ def is_telemetry_enabled() -> bool:
"distinct_id": g_anonymous_id,
"hamilton_version": list(VERSION),
"telemetry_version": "0.0.1",
"$process_person_profile": False,
}


Expand Down
5 changes: 4 additions & 1 deletion tests/test_hamilton_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import pytest

from hamilton import base, node
from hamilton import base, node, telemetry
from hamilton.caching.adapter import HamiltonCacheAdapter
from hamilton.driver import (
Builder,
Expand All @@ -25,6 +25,8 @@
import tests.resources.test_for_materialization
import tests.resources.very_simple_dag

telemetry.MAX_COUNT_SESSION = 100

"""This file tests driver capabilities.
Anything involving execution is tested for multiple executors/driver configuration.
Anything not involving execution is tested for just the single driver configuration.
Expand Down Expand Up @@ -235,6 +237,7 @@ def test_capture_constructor_telemetry(send_event_json):
assert actual_event_dict["event"] == "os_hamilton_run_start"
# validate schema
expected_properties = {
"$process_person_profile",
"os_type",
"os_version",
"python_version",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from hamilton import async_driver, base, node, telemetry
from hamilton.lifecycle import base as lifecycle_base

telemetry.MAX_COUNT_SESSION = 100


@pytest.fixture
def blank_conf_file(tmp_path_factory):
Expand Down

0 comments on commit f818bb9

Please sign in to comment.