pingevt/timing_monitor

Drupal Module for running tests on external sites.

Installs: 830

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 8

Type:drupal-module

1.0.0 2024-04-22 17:02 UTC

README

  • Introduction
  • Installation
  • Configuration
  • FAQ
  • Maintainers
  • Changelog

INTRODUCTION

This module handles custom functionality for Timing monitor. Current Functionality:

  • Creates a singlton class to track timing to monitor large processes.

INSTALLATION

CONFIGURATION

Configuration can be found at: /admin/config/development/timing-monitor

USAGE

$tm = TimingMonitor::getInstance();

$tm->logTiming("preprocess_node:$bundle:" . $variables['view_mode'], TimingMonitor::START, "Starting...");
$tm->logTiming("preprocess_node:$bundle:" . $variables['view_mode'], TimingMonitor::MARK, "...Mark...");
$tm->logTiming("preprocess_node:$bundle:" . $variables['view_mode'], TimingMonitor::FINISH, "...Finishing");

API Documentation

Endpoint: GET /api/timing-monitor/status

Example Response

{
  "status": "OK",
  "data": {
    "count": "261",
    "type_count": "4"
  }
}

Endpoint: GET /api/timing-monitor/types

Example Response

{
  "status": "OK",
  "data": {
    "preprocess_node:article:full": {
      "id": "preprocess_node:article:full",
      "count": "60"
    },
    "preprocess_node:article:teaser": {
      "id": "preprocess_node:article:teaser",
      "count": "141"
    },
    "preprocess_node:page:full": {
      "id": "preprocess_node:page:full",
      "count": "12"
    },
    "timing_monitor": {
      "id": "timing_monitor",
      "count": "48"
    }
  }
}

Endpoint: GET /api/timing-monitor/{type}/list

Path Arguments

arg description options
type string - The type string from the monitor You can use % in the url (%25 as url encoded) as a wildcard.

Query Arguments

arg description options
limit to be implemented
start to be implemented
end to be implemented

Example Response

{
  "status": "OK",
  "data": [
    {
      "id": "260",
      "uid": "1",
      "session_uuid": "c76cda75-6341-4d81-9396-29b65704ae62",
      "type": "preprocess_node:article:full",
      "marker": "finish",
      "message": "...Finishing",
      "variables": "a:0:{}",
      "path": "/sketches-notes/checking-field-content-twig-file",
      "method": "GET",
      "timer": "0.0022380352020264",
      "duration": "0.0021839141845703",
      "timestamp": "1698894252"
    },
    {
      "id": "259",
      "uid": "1",
      "session_uuid": "c76cda75-6341-4d81-9396-29b65704ae62",
      "type": "preprocess_node:article:full",
      "marker": "mark",
      "message": "...Mark...",
      "variables": "a:0:{}",
      "path": "/sketches-notes/checking-field-content-twig-file",
      "method": "GET",
      "timer": "0.0001380443572998",
      "duration": "8.392333984375E-5",
      "timestamp": "1698894252"
    }
  ]
}

Endpoint: GET /api/timing-monitor/{type}/daily-average

Path Arguments

arg description options
type string - The type string from the monitor You can use % in the url (%25 as url encoded) as a wildcard.

Query Arguments

arg description options
start to be implemented
end to be implemented
days to be implemented

Example Response

{
  "status": "OK",
  "data": {
    "type": "preprocess_node:article:full",
    "dates": {
      "2023-11-01": 0.0020719766616821,
      "2023-10-31": 0.0016613245010376,
      "2023-10-30": null,
      "2023-10-29": null,
      "2023-10-28": null,
      "2023-10-27": null,
      "2023-10-26": null
    }
  }
}

MAINTAINERS

Current maintainers:

This project has been sponsored by:

CHANGELOG

Unreleased