Skip to content

Commit

Permalink
Better name for the setting as this is sort of decoupled from overflo…
Browse files Browse the repository at this point in the history
…w (but also not really)
  • Loading branch information
tkaemming committed Mar 26, 2024
1 parent 4f2ec9d commit d0c6aef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion posthog/api/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def capture_internal(
candidate_partition_key = f"{token}:{distinct_id}"
if (
not historical
and settings.CAPTURE_OVERFLOW_ENABLED
and settings.CAPTURE_ALLOW_RANDOM_PARTITIONING
and (distinct_id.lower() in LIKELY_ANONYMOUS_IDS or is_randomly_partitioned(candidate_partition_key))
):
kafka_partition_key = None
Expand Down
10 changes: 6 additions & 4 deletions posthog/settings/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
# KEEP IN SYNC WITH plugin-server/src/config/config.ts
BUFFER_CONVERSION_SECONDS = get_from_env("BUFFER_CONVERSION_SECONDS", default=60, type_cast=int)

# Whether or not overflow (random partitioning) should be enabled *at all*.
# Note that this setting takes precedence over other overflow-related settings
# below, if disabled.
CAPTURE_OVERFLOW_ENABLED = get_from_env("CAPTURE_OVERFLOW_ENABLED", True, type_cast=str_to_bool)
# Whether or not random partitioning (i.e. overflow routing) should be enabled
# at all. Enabling this setting this does not cause messages to be randomly
# partitioned, but only allows them to be be randomly partitioned if other
# criteria are met. Note that this setting takes precedence over other
# partition-related settings below, if disabled.
CAPTURE_ALLOW_RANDOM_PARTITIONING = get_from_env("CAPTURE_ALLOW_RANDOM_PARTITIONING", True, type_cast=str_to_bool)

# A list of <team_id:distinct_id> pairs (in the format 2:myLovelyId) that we should use
# random partitioning for when producing events to the Kafka topic consumed by the plugin server.
Expand Down

0 comments on commit d0c6aef

Please sign in to comment.