Skip to content

Commit aa23eaa

Browse files
authored
Revert "Custom Event Limit Increase (#591)" (#622)
This reverts commit 6ef9bce.
1 parent 6ef9bce commit aa23eaa

File tree

3 files changed

+19
-30
lines changed

3 files changed

+19
-30
lines changed

newrelic/api/transaction.py

+14-24
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
import weakref
2626
from collections import OrderedDict
2727

28+
from newrelic.api.application import application_instance
2829
import newrelic.core.database_node
2930
import newrelic.core.error_node
31+
from newrelic.core.log_event_node import LogEventNode
3032
import newrelic.core.root_node
3133
import newrelic.core.transaction_node
3234
import newrelic.packages.six as six
33-
from newrelic.api.application import application_instance
3435
from newrelic.api.time_trace import TimeTrace, get_linking_metadata
3536
from newrelic.common.encoding_utils import (
3637
DistributedTracePayload,
@@ -60,9 +61,8 @@
6061
DST_NONE,
6162
DST_TRANSACTION_TRACER,
6263
)
63-
from newrelic.core.config import CUSTOM_EVENT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE
64+
from newrelic.core.config import DEFAULT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE
6465
from newrelic.core.custom_event import create_custom_event
65-
from newrelic.core.log_event_node import LogEventNode
6666
from newrelic.core.stack_trace import exception_stack
6767
from newrelic.core.stats_engine import CustomMetrics, SampledDataSet
6868
from newrelic.core.thread_utilization import utilization_tracker
@@ -324,14 +324,10 @@ def __init__(self, application, enabled=None, source=None):
324324
self.enabled = True
325325

326326
if self._settings:
327-
self._custom_events = SampledDataSet(
328-
capacity=self._settings.event_harvest_config.harvest_limits.custom_event_data
329-
)
330-
self._log_events = SampledDataSet(
331-
capacity=self._settings.event_harvest_config.harvest_limits.log_event_data
332-
)
327+
self._custom_events = SampledDataSet(capacity=self._settings.event_harvest_config.harvest_limits.custom_event_data)
328+
self._log_events = SampledDataSet(capacity=self._settings.event_harvest_config.harvest_limits.log_event_data)
333329
else:
334-
self._custom_events = SampledDataSet(capacity=CUSTOM_EVENT_RESERVOIR_SIZE)
330+
self._custom_events = SampledDataSet(capacity=DEFAULT_RESERVOIR_SIZE)
335331
self._log_events = SampledDataSet(capacity=LOG_EVENT_RESERVOIR_SIZE)
336332

337333
def __del__(self):
@@ -1477,35 +1473,31 @@ def set_transaction_name(self, name, group=None, priority=None):
14771473
self._group = group
14781474
self._name = name
14791475

1476+
14801477
def record_log_event(self, message, level=None, timestamp=None, priority=None):
14811478
settings = self.settings
1482-
if not (
1483-
settings
1484-
and settings.application_logging
1485-
and settings.application_logging.enabled
1486-
and settings.application_logging.forwarding
1487-
and settings.application_logging.forwarding.enabled
1488-
):
1479+
if not (settings and settings.application_logging and settings.application_logging.enabled and settings.application_logging.forwarding and settings.application_logging.forwarding.enabled):
14891480
return
1490-
1481+
14911482
timestamp = timestamp if timestamp is not None else time.time()
14921483
level = str(level) if level is not None else "UNKNOWN"
1493-
1484+
14941485
if not message or message.isspace():
14951486
_logger.debug("record_log_event called where message was missing. No log event will be sent.")
14961487
return
1497-
1488+
14981489
message = truncate(message, MAX_LOG_MESSAGE_LENGTH)
14991490

15001491
event = LogEventNode(
15011492
timestamp=timestamp,
15021493
level=level,
15031494
message=message,
1504-
attributes=get_linking_metadata(),
1495+
attributes=get_linking_metadata(),
15051496
)
15061497

15071498
self._log_events.add(event, priority=priority)
15081499

1500+
15091501
def record_exception(self, exc=None, value=None, tb=None, params=None, ignore_errors=None):
15101502
# Deprecation Warning
15111503
warnings.warn(
@@ -1877,9 +1869,7 @@ def record_log_event(message, level=None, timestamp=None, application=None, prio
18771869
"record_log_event has been called but no transaction or application was running. As a result, "
18781870
"the following event has not been recorded. message: %r level: %r timestamp %r. To correct "
18791871
"this problem, supply an application object as a parameter to this record_log_event call.",
1880-
message,
1881-
level,
1882-
timestamp,
1872+
message, level, timestamp,
18831873
)
18841874
elif application.enabled:
18851875
application.record_log_event(message, level, timestamp, priority=priority)

newrelic/core/config.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
# reservoir. Error Events have a different default size.
5353

5454
DEFAULT_RESERVOIR_SIZE = 1200
55-
CUSTOM_EVENT_RESERVOIR_SIZE = 30000
5655
ERROR_EVENT_RESERVOIR_SIZE = 100
5756
SPAN_EVENT_RESERVOIR_SIZE = 2000
5857
LOG_EVENT_RESERVOIR_SIZE = 10000
@@ -739,7 +738,7 @@ def default_host(license_key):
739738
)
740739

741740
_settings.event_harvest_config.harvest_limits.custom_event_data = _environ_as_int(
742-
"NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED", CUSTOM_EVENT_RESERVOIR_SIZE
741+
"NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED", DEFAULT_RESERVOIR_SIZE
743742
)
744743

745744
_settings.event_harvest_config.harvest_limits.span_event_data = _environ_as_int(

tests/agent_features/test_configuration.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ def test_delete_setting_parent():
438438
TSetting("event_harvest_config.harvest_limits.error_event_data", 100, 100),
439439
),
440440
(
441-
TSetting("custom_insights_events.max_samples_stored", 30000, 30000),
442-
TSetting("event_harvest_config.harvest_limits.custom_event_data", 9999, 30000),
441+
TSetting("custom_insights_events.max_samples_stored", 1200, 1200),
442+
TSetting("event_harvest_config.harvest_limits.custom_event_data", 9999, 1200),
443443
),
444444
(
445-
TSetting("custom_insights_events.max_samples_stored", 9999, 30000),
446-
TSetting("event_harvest_config.harvest_limits.custom_event_data", 30000, 30000),
445+
TSetting("custom_insights_events.max_samples_stored", 9999, 1200),
446+
TSetting("event_harvest_config.harvest_limits.custom_event_data", 1200, 1200),
447447
),
448448
(
449449
TSetting("application_logging.forwarding.max_samples_stored", 10000, 10000),

0 commit comments

Comments
 (0)