From caa9485861f23c5e9b68aca29decf8b7d8d0f741 Mon Sep 17 00:00:00 2001 From: Hannah Stepanek Date: Wed, 26 Oct 2022 11:41:41 -0700 Subject: [PATCH] Feature increased custom event limit (#674) * Update reservoir size for custom events. * [Mega-Linter] Apply linters fixes * Increase custom event limit. (#666) * Remove duplicated CUSTOM_EVENT_RESERVOIR_SIZE Co-authored-by: Tim Pansino Co-authored-by: TimPansino Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> Co-authored-by: Uma Annamalai --- newrelic/api/transaction.py | 4 ++-- newrelic/core/config.py | 3 ++- tests/agent_features/test_configuration.py | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/newrelic/api/transaction.py b/newrelic/api/transaction.py index 1c0c1bd088..08638e0566 100644 --- a/newrelic/api/transaction.py +++ b/newrelic/api/transaction.py @@ -59,7 +59,7 @@ DST_NONE, DST_TRANSACTION_TRACER, ) -from newrelic.core.config import DEFAULT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE +from newrelic.core.config import CUSTOM_EVENT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE from newrelic.core.custom_event import create_custom_event from newrelic.core.log_event_node import LogEventNode from newrelic.core.stack_trace import exception_stack @@ -333,7 +333,7 @@ def __init__(self, application, enabled=None, source=None): capacity=self._settings.event_harvest_config.harvest_limits.log_event_data ) else: - self._custom_events = SampledDataSet(capacity=DEFAULT_RESERVOIR_SIZE) + self._custom_events = SampledDataSet(capacity=CUSTOM_EVENT_RESERVOIR_SIZE) self._log_events = SampledDataSet(capacity=LOG_EVENT_RESERVOIR_SIZE) def __del__(self): diff --git a/newrelic/core/config.py b/newrelic/core/config.py index 60520c1134..4111c71495 100644 --- a/newrelic/core/config.py +++ b/newrelic/core/config.py @@ -52,6 +52,7 @@ # reservoir. Error Events have a different default size. DEFAULT_RESERVOIR_SIZE = 1200 +CUSTOM_EVENT_RESERVOIR_SIZE = 3600 ERROR_EVENT_RESERVOIR_SIZE = 100 SPAN_EVENT_RESERVOIR_SIZE = 2000 LOG_EVENT_RESERVOIR_SIZE = 10000 @@ -738,7 +739,7 @@ def default_host(license_key): ) _settings.event_harvest_config.harvest_limits.custom_event_data = _environ_as_int( - "NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED", DEFAULT_RESERVOIR_SIZE + "NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED", CUSTOM_EVENT_RESERVOIR_SIZE ) _settings.event_harvest_config.harvest_limits.span_event_data = _environ_as_int( diff --git a/tests/agent_features/test_configuration.py b/tests/agent_features/test_configuration.py index 5846e38080..5df69d71e9 100644 --- a/tests/agent_features/test_configuration.py +++ b/tests/agent_features/test_configuration.py @@ -438,12 +438,12 @@ def test_delete_setting_parent(): TSetting("event_harvest_config.harvest_limits.error_event_data", 100, 100), ), ( - TSetting("custom_insights_events.max_samples_stored", 1200, 1200), - TSetting("event_harvest_config.harvest_limits.custom_event_data", 9999, 1200), + TSetting("custom_insights_events.max_samples_stored", 3600, 3600), + TSetting("event_harvest_config.harvest_limits.custom_event_data", 9999, 3600), ), ( - TSetting("custom_insights_events.max_samples_stored", 9999, 1200), - TSetting("event_harvest_config.harvest_limits.custom_event_data", 1200, 1200), + TSetting("custom_insights_events.max_samples_stored", 9999, 3600), + TSetting("event_harvest_config.harvest_limits.custom_event_data", 3600, 3600), ), ( TSetting("application_logging.forwarding.max_samples_stored", 10000, 10000),