承接 hgg/metrics 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hgg/metrics

Composer 安装命令:

composer require hgg/metrics

包简介

Minimalistic library for collecting metrics during script execution

关键字:

README 文档

README

Build Status Latest Stable Version License Code Climate

Metrics is a container for keeping track of counters or any value for that matter and for tracking time. A common application would be to use it for a process that takes a few seconds for which various information should be collected and then logged.

The collected data can be emitted as an array or as a JSON string.

Installation

Using Composer:

{
    "require": {
        "hgg/metrics": "*"
    }
}

Usage

Simple use case

<?php
$metrics = new Metrics(true);
$metrics->myCounter = 0;

while (1) {
    // Do some work
    ++$metrics->myCounter;
}

print_r($metrics->toArray());

The above constructs a Metrics object with time tracking turned on and a single counter that is incremented as a result of some process. The metrics container is then emitted as an array.

Initialize multiple counters more efficiently

<?php
$metrics = new Metrics(true);
$metrics->initMembers(array('counter1', 'counter2', 'counter3'), 0);

This initializes the named counters to 0 with a single call.

Output to Array

<?php
$arrayResult = $metrics->toArray();

Output to JSON

<?php
$json = $metrics->toJson();

Sample output (JSON)

{
  "counter1": 23,
  "counter2": 569,
  "counter3": 0,
  "elapsed-time": "00:00:24"
}

Note

For a more comprehensive solution take a look at beberlei/metrics.

统计信息

  • 总下载量: 399
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-03-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固