diff --git a/newrelic/core/application.py b/newrelic/core/application.py index f0c455c5d..46ef6d394 100644 --- a/newrelic/core/application.py +++ b/newrelic/core/application.py @@ -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: diff --git a/newrelic/core/data_collector.py b/newrelic/core/data_collector.py index c303fad90..244fa4f9f 100644 --- a/newrelic/core/data_collector.py +++ b/newrelic/core/data_collector.py @@ -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) diff --git a/tests/agent_unittests/test_agent_connect.py b/tests/agent_unittests/test_agent_connect.py index a783faddc..9a37f4ffc 100644 --- a/tests/agent_unittests/test_agent_connect.py +++ b/tests/agent_unittests/test_agent_connect.py @@ -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):