👁️ Monitoring Dashboards

  1. Exportal la variable KONG_GATEWAY_SERVER con el valor que corresponde a tu nombre de servidor docker.
    export KONG_GATEWAY_SERVER=student-0-aio.34-82-238-123.nip.io
    
  2. Crear un archivo llamado request.sh con el siguiente contenido en el servidor Docker:
    #!/bin/bash
    
    # Asegúrate de tener definida esta variable de entorno
    # export KONG_GATEWAY_SERVER=localhost
    
    for i in {1..5}; do
      echo "Ejecutando iteración $i..."
    
      curl -s http://$KONG_GATEWAY_SERVER:30080/api/chat \
        -X POST \
        -H "Content-Type: application/json" \
        -d '{
          "model": "tinyllama",
          "messages": [
            { "role": "user", "content": "¿Cuál es la capital de Francia?" }
          ]
        }'
      echo
    
      curl -s http://$KONG_GATEWAY_SERVER:30080/openai \
        -X POST \
        -H "Content-Type: application/json" \
        -d '{
          "model": "gpt-4o-mini",
          "messages": [
            { "role": "user", "content": "¿Cuál es la capital de Francia?" }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "Tell me a joke about AI." }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "How to implement a custom iterator class in Python" }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "How can I configure my corporate VPN?" }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "How can I create a Pod in Kubernetes?" }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "How can I create a volume in Docker?" }
          ]
        }'
      echo
    
      curl -s -X POST http://$KONG_GATEWAY_SERVER:30080/anything \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            { "role": "user", "content": "How can I create a persistent storage in Docker?" }
          ]
        }'
      echo
    
    done
    
  3. Asignar permisos de ejecución:
    chmod +x ./request.sh
    
  4. Ejecutar el script para generar tráfico.
    ./request.sh
    
  5. Esperar a que finalice.
  6. En Konnect seleccionar Analytics > Dashboards
  7. Luego Create from template, seleccionar AI gateway dashboard y dar click en el botón Use template
  8. Con el mismo procedimiento anterior, crear un nuevo Dashboard a partir de del template Shared services dashboard
  9. Observa los resultados en cada uno de los Dashboards, prueba ajustar los periodos de tiempo para obtener mejores resultados.