Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ gb = GrowthBook(
plugins=[
request_context_plugin(), # Extracts request data
growthbook_tracking_plugin(
ingestor_host="https://gb-ingest.growthbook.io",
ingestor_host="https://us-east-1.gb-ingest.com",
# Optional: Add custom tracking callback
additional_callback=my_custom_tracker
)
Expand Down
4 changes: 2 additions & 2 deletions growthbook/plugins/growthbook_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class GrowthBookTrackingPlugin(GrowthBookPlugin):

def __init__(
self,
ingestor_host: str = "https://us1.gb-ingest.com",
ingestor_host: str = "https://us-east-1.gb-ingest.com",
track_experiment_viewed: bool = True,
track_feature_evaluated: bool = True,
batch_size: int = 10,
Expand All @@ -106,7 +106,7 @@ def __init__(
Initialize GrowthBook tracking plugin.
Args:
ingestor_host: Base URL of the GrowthBook ingestor (default: ``https://us1.gb-ingest.com``).
ingestor_host: Base URL of the GrowthBook ingestor (default: ``https://us-east-1.gb-ingest.com``).
track_experiment_viewed: Whether to auto-track experiment viewed events.
track_feature_evaluated: Whether to auto-track feature evaluated events.
batch_size: Number of events to accumulate before flushing to the ingestor.
Expand Down
26 changes: 24 additions & 2 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def fake_post(url, data, headers, timeout):
client_key="sdk-test-key",
plugins=[
growthbook_tracking_plugin(
ingestor_host="https://us1.gb-ingest.com",
ingestor_host="https://us-east-1.gb-ingest.com",
batch_size=1, # flush immediately
)
],
Expand Down Expand Up @@ -509,6 +509,28 @@ def fake_post(url, data, headers, timeout):
self.assertEqual(posted[0]["headers"]["Content-Type"], "text/plain")
gb.destroy()

def test_default_ingestor_host_is_us_east_1(self):
"""Without ingestor_host, events go to the us-east-1 ingest host."""
posted = []

def fake_post(url, data, headers, timeout):
posted.append(url)
response = MagicMock()
response.status_code = 200
return response

with patch("requests.post", side_effect=fake_post):
gb = GrowthBook(
attributes={"id": "user-42"},
client_key="sdk-test-key",
plugins=[growthbook_tracking_plugin(batch_size=1)],
)
gb.log_event("checkout_started", {})
import time; time.sleep(0.05)
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

self.assertEqual(posted, ["https://us-east-1.gb-ingest.com/track?client_key=sdk-test-key"])
gb.destroy()

def test_log_event_empty_properties(self):
"""log_event works with no properties argument."""
received = []
Expand Down Expand Up @@ -605,7 +627,7 @@ def test_async_client_plugin_wires_event_logger(self):
Options(
client_key="sdk-key",
tracking_plugins=[
growthbook_tracking_plugin(ingestor_host="https://us1.gb-ingest.com")
growthbook_tracking_plugin(ingestor_host="https://us-east-1.gb-ingest.com")
],
)
)
Expand Down
Loading