Supported OS Linux Windows Mac OS

Información general

k6 es una herramienta de pruebas de carga de código abierto que te ayuda a detectar antes los problemas de rendimiento y las regresiones.

Con la integración de k6, puedes realizar un rastreo de las métricas de rendimiento de tests de k6 para:

  • Correlacionar el rendimiento de la aplicación con las métricas de tests de carga.
  • Crear alertas basadas en métricas de tests de rendimiento.
  • Analizar y visualizar métricas de k6 utilizando el dashboard de k6 Datadog o el Metrics Explorer.

Dashboard de k6 Datadog

Configuración

Para obtener instrucciones detalladas, consulta la documentación de k6.

Instalación

  1. En Datadog, ve a integraciones > API para copiar tu clave de API.

  2. Ejecuta el Datadog Agent:

    Para llevar métricas de k6 a Datadog, k6 envía métricas a través del Datadog Agent, que recopila, agrega y reenvía métricas a la plataforma de Datadog.

    Ejecuta el servicio del Datadog Agent como contenedor de Docker con este comando:

    DOCKER_CONTENT_TRUST=1 \
    docker run -d \
        --name datadog \
        -v /var/run/docker.sock:/var/run/docker.sock:ro \
        -v /proc/:/host/proc/:ro \
        -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
        -e DD_SITE="datadoghq.com" \
        -e DD_API_KEY=<YOUR_DATADOG_API_KEY> \
        -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 \
        -p 8125:8125/udp \
        datadog/agent:latest
    

    Nota: Sustituye <YOUR_DATADOG_API_KEY> por tu clave de API. Si tu cuenta está registrada con Datadog EU, cambia el valor de DD_SITE por datadoghq.eu.

  3. Ejecuta el test de k6 y envía los resultados a Datadog.

    Una vez que el servicio del Datadog Agent esté funcionando, ejecuta el test de k6 y envía las métricas al Agent con:

    K6_STATSD_ENABLE_TAGS=true k6 run --out statsd script.js
    
  4. Visualiza las métricas de k6 en Datadog.

    Mientras se ejecuta el test, k6 envía métricas periódicamente a Datadog. Por defecto, estas métricas tienen k6. como prefijo del nombre.

    Puedes visualizar métricas de k6 en tiempo real con el Metrics Explorer, monitores, o dashboards personalizados.

    k6 Datadog Metrics Explorer

    Además, la primera vez que Datadog detecta la métrica k6.http_reqs, el cuadro de integración de k6 se instala automáticamente y el dashboard de k6 por defecto se añade a tu lista de dashboard.

    Dashboard de k6 Datadog

Datos recopilados

Métricas

k6.data_sent
(count)
The amount of data sent
Shown as byte
k6.data_received
(count)
The amount of received data
Shown as byte
k6.http_req_blocked.avg
(gauge)
Average time spent blocked before initiating the request
Shown as millisecond
k6.http_req_blocked.max
(gauge)
Max time spent blocked before initiating the request
Shown as millisecond
k6.http_req_blocked.median
(gauge)
Median time spent blocked before initiating the request
Shown as millisecond
k6.http_req_blocked.95percentile
(gauge)
95th time spent blocked before initiating the request
Shown as millisecond
k6.http_req_blocked.99percentile
(gauge)
99th time spent blocked before initiating the request
Shown as millisecond
k6.http_req_blocked.count
(rate)
The number of httpreqblocked values submitted during the interval
Shown as unit
k6.http_req_connecting.avg
(gauge)
Average time spent establishing TCP connection
Shown as millisecond
k6.http_req_connecting.max
(gauge)
Max time spent establishing TCP connection
Shown as millisecond
k6.http_req_connecting.median
(gauge)
Median time spent establishing TCP connection
Shown as millisecond
k6.http_req_connecting.95percentile
(gauge)
95th time spent blocked before initiating the request
Shown as millisecond
k6.http_req_connecting.99percentile
(gauge)
99th time spent blocked before initiating the request
Shown as millisecond
k6.http_req_connecting.count
(rate)
The number of httpreqconnecting values submitted during the interval
Shown as unit
k6.http_req_duration.avg
(gauge)
Average request time
Shown as millisecond
k6.http_req_duration.max
(gauge)
Max request time
Shown as millisecond
k6.http_req_duration.median
(gauge)
Median request time
Shown as millisecond
k6.http_req_duration.95percentile
(gauge)
95th request time
Shown as millisecond
k6.http_req_duration.99percentile
(gauge)
99th request time
Shown as millisecond
k6.http_req_duration.count
(rate)
The number of httpreqduration values submitted during the interval
Shown as unit
k6.http_reqs
(count)
Total number of HTTP requests
Shown as request
k6.http_req_receiving.avg
(gauge)
Average time spent receiving response data
Shown as millisecond
k6.http_req_receiving.max
(gauge)
Max time spent receiving response data
Shown as millisecond
k6.http_req_receiving.median
(gauge)
Median time spent receiving response data
Shown as millisecond
k6.http_req_receiving.95percentile
(gauge)
95th time spent receiving response data
Shown as millisecond
k6.http_req_receiving.99percentile
(gauge)
99th time spent receiving response data
Shown as millisecond
k6.http_req_receiving.count
(rate)
The number of httpreqreceiving values submitted during the interval
Shown as unit
k6.http_req_sending.avg
(gauge)
Average time spent sending data
Shown as millisecond
k6.http_req_sending.max
(gauge)
Max time spent sending data
Shown as millisecond
k6.http_req_sending.median
(gauge)
Median time spent sending data
Shown as millisecond
k6.http_req_sending.95percentile
(gauge)
95th time spent sending data
Shown as millisecond
k6.http_req_sending.99percentile
(gauge)
99th time spent sending data
Shown as millisecond
k6.http_req_sending.count
(rate)
The number of httpreqsending values submitted during the interval
Shown as unit
k6.http_req_tls_handshaking.avg
(gauge)
Average time spent handshaking TLS session
Shown as millisecond
k6.http_req_tls_handshaking.max
(gauge)
Max time spent handshaking TLS session
Shown as millisecond
k6.http_req_tls_handshaking.median
(gauge)
Median time spent handshaking TLS session
Shown as millisecond
k6.http_req_tls_handshaking.95percentile
(gauge)
95th time spent handshaking TLS session
Shown as millisecond
k6.http_req_tls_handshaking.99percentile
(gauge)
99th time spent handshaking TLS session
Shown as millisecond
k6.http_req_tls_handshaking.count
(rate)
The number of httpreqtls_handshaking values submitted during the interval
Shown as unit
k6.http_req_waiting.avg
(gauge)
Average time spent waiting for response (TTFB)
Shown as millisecond
k6.http_req_waiting.max
(gauge)
Max time spent waiting for response (TTFB)
Shown as millisecond
k6.http_req_waiting.median
(gauge)
Median time spent waiting for response (TTFB)
Shown as millisecond
k6.http_req_waiting.95percentile
(gauge)
95th time spent waiting for response (TTFB)
Shown as millisecond
k6.http_req_waiting.99percentile
(gauge)
99th time spent waiting for response (TTFB)
Shown as millisecond
k6.http_req_waiting.count
(rate)
The number of httpreqwaiting values submitted during the interval
Shown as unit
k6.iteration_duration.avg
(gauge)
Average time spent for a VU iteration
Shown as millisecond
k6.iteration_duration.max
(gauge)
Max time spent for a VU iteration
Shown as millisecond
k6.iteration_duration.median
(gauge)
Median time spent for a VU iteration
Shown as millisecond
k6.iteration_duration.95percentile
(gauge)
95th time spent for a VU iteration
Shown as millisecond
k6.iteration_duration.99percentile
(gauge)
99th time spent for a VU iteration
Shown as millisecond
k6.iteration_duration.count
(rate)
The number of iteration_duration values submitted during the interval
Shown as unit
k6.iterations
(count)
Aggregated number of VU iterations
Shown as unit
k6.vus
(gauge)
Current number of active virtual users
Shown as user
k6.vus_max
(gauge)
Max possible number of virtual users
Shown as user

Checks de servicio

La integración de k6 no incluye ningún check de servicio.

Eventos

La integración de k6 no incluye ningún evento.

Solucionar problemas

¿Necesitas ayuda? Lee la documentación de k6 Datadog o ponte en contacto con el soporte de k6.