Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions newrelic/core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,33 @@ def connect_to_data_collector(self, activate_agent):
f"Supportability/InfiniteTracing/gRPC/Compression/{'enabled' if infinite_tracing_compression else 'disabled'}",
1,
)
if configuration.distributed_tracing.enabled:
if configuration.distributed_tracing.sampler.full_granularity.enabled:
internal_metric(
f"Supportability/Python/FullGranularity/Root/{configuration.distributed_tracing.sampler._root}",
1,
)
internal_metric(
f"Supportability/Python/FullGranularity/RemoteParentSampled/{configuration.distributed_tracing.sampler._remote_parent_sampled}",
1,
)
internal_metric(
f"Supportability/Python/FullGranularity/RemoteParentNotSampled/{configuration.distributed_tracing.sampler._remote_parent_not_sampled}",
1,
)
if configuration.distributed_tracing.sampler.partial_granularity.enabled:
internal_metric(
f"Supportability/Python/PartialGranularity/Root/{configuration.distributed_tracing.sampler.partial_granularity._root}",
1,
)
internal_metric(
f"Supportability/Python/PartialGranularity/RemoteParentSampled/{configuration.distributed_tracing.sampler.partial_granularity._remote_parent_sampled}",
1,
)
internal_metric(
f"Supportability/Python/PartialGranularity/RemoteParentNotSampled/{configuration.distributed_tracing.sampler.partial_granularity._remote_parent_not_sampled}",
1,
)

# Agent Control health check metric
if self._agent_control.health_check_enabled:
Expand Down
8 changes: 0 additions & 8 deletions newrelic/core/data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ def send_ml_events(self, sampling_info, custom_event_data):

def send_span_events(self, sampling_info, span_event_data):
"""Called to submit sample set for span events."""
# TODO: remove this later after list types are suported.
for span_event in span_event_data:
try:
ids = span_event[1].get("nr.ids")
if ids:
span_event[1]["nr.ids"] = ",".join(ids)
except:
pass
payload = (self.agent_run_id, sampling_info, span_event_data)
return self._protocol.send("span_event_data", payload)

Expand Down
20 changes: 20 additions & 0 deletions tests/agent_unittests/test_agent_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ def test_ml_streaming_disabled_supportability_metrics():
assert app._active_session


@override_generic_settings(
SETTINGS, {"developer_mode": True, "distributed_tracing.sampler.partial_granularity.enabled": True}
)
@validate_internal_metrics(
[
("Supportability/Python/FullGranularity/Root/default", 1),
("Supportability/Python/FullGranularity/RemoteParentSampled/default", 1),
("Supportability/Python/FullGranularity/RemoteParentNotSampled/default", 1),
("Supportability/Python/PartialGranularity/Root/default", 1),
("Supportability/Python/PartialGranularity/RemoteParentSampled/default", 1),
("Supportability/Python/PartialGranularity/RemoteParentNotSampled/default", 1),
]
)
def test_sampler_supportability_metrics():
app = Application("Python Agent Test (agent_unittests-connect)")
app.connect_to_data_collector(None)

assert app._active_session


@override_generic_settings(SETTINGS, {"developer_mode": True})
@validate_internal_metrics([("Supportability/AgentControl/Health/enabled", 1)])
def test_agent_control_health_supportability_metric(monkeypatch, tmp_path):
Expand Down
Loading