Skip to content

Commit c93dfa4

Browse files
authored
Merge pull request #1225 from newrelic/super-agent-supportability
Add super agent supportability metric.
2 parents 1807857 + 16f23c6 commit c93dfa4

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

newrelic/core/application.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
_logger = logging.getLogger(__name__)
5454

5555

56-
class Application():
57-
56+
class Application:
5857
"""Class which maintains recorded data for a single application."""
5958

6059
def __init__(self, app_name, linked_applications=None):
@@ -575,6 +574,13 @@ def connect_to_data_collector(self, activate_agent):
575574
1,
576575
)
577576

577+
# Super agent health check metric
578+
if os.environ.get("NEW_RELIC_SUPERAGENT_FLEET_ID", None):
579+
internal_metric(
580+
"Supportability/SuperAgent/Health/enabled",
581+
1,
582+
)
583+
578584
self._stats_engine.merge_custom_metrics(internal_metrics.metrics())
579585

580586
# Update the active session in this object. This will the

tests/agent_unittests/test_agent_connect.py

+20
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,23 @@ def test_ml_streaming_disabled_supportability_metrics():
101101
app.connect_to_data_collector(None)
102102

103103
assert app._active_session
104+
105+
106+
@override_generic_settings(
107+
SETTINGS,
108+
{
109+
"developer_mode": True,
110+
},
111+
)
112+
@validate_internal_metrics(
113+
[
114+
("Supportability/SuperAgent/Health/enabled", 1),
115+
]
116+
)
117+
def test_super_agent_health_supportability_metric(monkeypatch):
118+
monkeypatch.setenv("NEW_RELIC_SUPERAGENT_FLEET_ID", "foobar")
119+
120+
app = Application("Python Agent Test (agent_unittests-connect)")
121+
app.connect_to_data_collector(None)
122+
123+
assert app._active_session

0 commit comments

Comments
 (0)