Skip to content

Commit ef43486

Browse files
authoredJun 9, 2022
Merge pull request #559 from newrelic/develop-logging
APM Log Forwarding
2 parents a472c54 + 84749b9 commit ef43486

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2711
-363
lines changed
 

‎newrelic/api/application.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Application(object):
2929
_delayed_callables = {}
3030

3131
@staticmethod
32-
def _instance(name):
32+
def _instance(name, activate=True):
3333
if name is None:
3434
name = newrelic.core.config.global_settings().app_name
3535

@@ -44,7 +44,7 @@ def _instance(name):
4444

4545
instance = Application._instances.get(name, None)
4646

47-
if not instance:
47+
if not instance and activate:
4848
with Application._lock:
4949
# Now try again with lock so that only one gets
5050
# to create and add it.
@@ -150,6 +150,10 @@ def record_transaction(self, data):
150150
if self.active:
151151
self._agent.record_transaction(self._name, data)
152152

153+
def record_log_event(self, message, level=None, timestamp=None, priority=None):
154+
if self.active:
155+
self._agent.record_log_event(self._name, message, level, timestamp, priority=priority)
156+
153157
def normalize_name(self, name, rule_type="url"):
154158
if self.active:
155159
return self._agent.normalize_name(self._name, name, rule_type)
@@ -162,8 +166,8 @@ def compute_sampled(self):
162166
return self._agent.compute_sampled(self._name)
163167

164168

165-
def application_instance(name=None):
166-
return Application._instance(name)
169+
def application_instance(name=None, activate=True):
170+
return Application._instance(name, activate=activate)
167171

168172

169173
def register_application(name=None, timeout=None):

‎newrelic/api/import_hook.py

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
# These modules should not be added to the _uninstrumented_modules set
4141
# because they have been deemed okay to import before initialization by
4242
# the customer.
43+
"logging",
4344
"gunicorn.app.base",
4445
"wsgiref.simple_server",
4546
"gevent.wsgi",

0 commit comments

Comments
 (0)
Please sign in to comment.