Skip to content

Commit a7c0fc2

Browse files
chore(writer): enable health metrics based on config (#14661)
## Description Enable health metrics in the native writer based on configuration ## Testing <!-- Describe your testing strategy or note what tests are included --> ## Risks <!-- Note any risks associated with this change, or "None" if no risks --> ## Additional Notes <!-- Any other information that would be helpful for reviewers -->
1 parent 819ab95 commit a7c0fc2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

ddtrace/internal/native/_native.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ class TraceExporterBuilder:
323323
:param runtime_id: The runtime id to use for telemetry.
324324
"""
325325
...
326+
def enable_health_metrics(self) -> TraceExporterBuilder:
327+
"""
328+
Enable health metrics in the TraceExporter
329+
"""
330+
...
326331
def build(self) -> TraceExporter:
327332
"""
328333
Build and return a TraceExporter instance with the configured settings.

ddtrace/internal/writer/writer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ def _create_exporter(self) -> native.TraceExporter:
828828
config._telemetry_heartbeat_interval * 1000
829829
) # Convert DD_TELEMETRY_HEARTBEAT_INTERVAL to milliseconds
830830
builder.enable_telemetry(heartbeat_ms, get_runtime_id())
831+
if config._health_metrics_enabled:
832+
builder.enable_health_metrics()
831833

832834
return builder.build()
833835

src/native/data_pipeline/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ impl TraceExporterBuilderPy {
156156
Ok(slf.into())
157157
}
158158

159+
fn enable_health_metrics(mut slf: PyRefMut<'_, Self>) -> PyResult<Py<Self>> {
160+
slf.try_as_mut()?.enable_health_metrics();
161+
Ok(slf.into())
162+
}
163+
159164
/// Consumes the wrapped builder.
160165
///
161166
/// The builder shouldn't be reused

0 commit comments

Comments
 (0)