Esta función está en fase beta pública.

Configuración automática

La recopilación de métricas de tiempo de ejecución puede activarse con un parámetro de configuración en el cliente de rastreo, ya sea a través de la opción del rastreador: tracer.init({ runtimeMetrics: true }) o a través de la variable de entorno: DD_RUNTIME_METRICS_ENABLED=true

export DD_RUNTIME_METRICS_ENABLED=true
export DD_ENV=prod
export DD_SERVICE=my-web-app
export DD_VERSION=1.0.3
const tracer = require('dd-trace').init({
  env: 'prod',
  service: 'my-web-app',
  version: '1.0.3',
  runtimeMetrics: true
})

Las métricas de tiempo de ejecución se pueden ver en correlación con tus servicios de Node. Consulta el Catálogo de servicios en Datadog.

Por defecto, las métricas de tiempo de ejecución de tu aplicación se envían al Datadog Agent con DogStatsD en el puerto 8125. Asegúrate de que DogStatsD está habilitado para el Agent. Si estás ejecutando el Agent como un contenedor, asegúrate de que DD_DOGSTATSD_NON_LOCAL_TRAFFIC está configurado como true y que el puerto 8125 está abierto en el Agent. En Kubernetes, vincula el puerto de DogStatsD a un puerto host; en ECS, establece los indicadores apropiados en tu definición de tarea.

Alternativamente, el Agent puede ingerir métricas con un Unix Domain Socket (UDS) como alternativa al transporte UDP. Para más información, lee DogStatsD en Unix Domain Socket.

Datos recopilados

Las siguientes métricas se recopilan por defecto después de activar las métricas de tiempo de ejecución.

runtime.node.cpu.user
(gauge)
CPU usage in user code
Shown as percent
runtime.node.cpu.system
(gauge)
CPU usage in system code
Shown as percent
runtime.node.cpu.total
(gauge)
Total CPU usage
Shown as percent
runtime.node.mem.rss
(gauge)
Resident set size
Shown as byte
runtime.node.mem.heap_total
(gauge)
Total heap memory
Shown as byte
runtime.node.mem.heap_used
(gauge)
Heap memory usage
Shown as byte
runtime.node.mem.external
(gauge)
External memory
Shown as byte
runtime.node.heap.total_heap_size
(gauge)
Total heap size
Shown as byte
runtime.node.heap.total_heap_size_executable
(gauge)
Total executable heap size
Shown as byte
runtime.node.heap.total_physical_size
(gauge)
Total physical heap size
Shown as byte
runtime.node.heap.used_heap_size
(gauge)
Used heap size
Shown as byte
runtime.node.heap.heap_size_limit
(gauge)
Heap size limit
Shown as byte
runtime.node.heap.malloced_memory
(gauge)
Malloced memory
Shown as byte
runtime.node.heap.peak_malloced_memory
(gauge)
Peak allocated memory
Shown as byte
runtime.node.heap.size.by.space
(gauge)
Heap space size
Shown as byte
runtime.node.heap.used_size.by.space
(gauge)
Heap space used size
Shown as byte
runtime.node.heap.available_size.by.space
(gauge)
Heap space available size
Shown as byte
runtime.node.heap.physical_size.by.space
(gauge)
Heap space physical size
Shown as byte
runtime.node.process.uptime
(gauge)
Process uptime
Shown as second
runtime.node.event_loop.delay.max
(gauge)
Maximum event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.min
(gauge)
Minimum event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.avg
(gauge)
Average event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.sum
(rate)
Total event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.median
(gauge)
Median event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.95percentile
(gauge)
95th percentile event loop delay
Shown as nanosecond
runtime.node.event_loop.delay.count
(rate)
Event loop iteration count where a delay is detected
Shown as execution
runtime.node.gc.pause.max
(gauge)
Maximum garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.min
(gauge)
Minimum garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.avg
(gauge)
Average garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.sum
(rate)
Total garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.median
(gauge)
Median garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.95percentile
(gauge)
95th percentile garbage collection pause
Shown as nanosecond
runtime.node.gc.pause.count
(rate)
Number of garbage collections
Shown as garbage collection
runtime.node.gc.pause.by.type.max
(gauge)
Maximum garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.min
(gauge)
Minimum garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.avg
(gauge)
Average garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.sum
(rate)
Total garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.median
(gauge)
Median garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.95percentile
(gauge)
95th percentile garbage collection pause by type
Shown as nanosecond
runtime.node.gc.pause.by.type.count
(rate)
Number of garbage collections by type
Shown as garbage collection

Además de mostrar estas métricas en tu Página de servicios de APM, Datadog proporciona un dashboard de tiempo de ejecución de Node predeterminado.

Leer más