承接 lamoda/metrics 相关项目开发

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

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

lamoda/metrics

Composer 安装命令:

composer require lamoda/metrics

包简介

Library for handling and displaying custom project metrics

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Build Status Latest Stable Version

Features

  • Metric responder with lazy sourcing
  • Multiple metric response formats
  • Symfony bundle [optional]
  • Doctrine and redis/predis integration out of the box

Installation

  • install with composer
composer require lamoda/metrics:^2.0

Usage examples

Main terms

  • Metric is a named value, representing system running state, health check or cumulative measurement, optionally tagged

  • Metric response is a set of metrics collected for the fixed moment of time, formatted for single input format

  • Metric responder is a http endpoint used to render collected metrics into suitable web response format

  • Metrics can be sourced in the terms of dynamic spawning for collection generation

    • The general advice is to have metrics as lazy as possible, resolving to the fixed at the time of generation response
    • Usually Source is implemented as an instance of \Traversable object to embed into collection

Metric are generally of two types:

  • Precomputed metrics are usually generated outside of responding process, like counters
  • Runtime metrics are generated on call, representing the current state of the system

From the point of metric responding the difference between types is nominal since PHP has share nothing architecture and most stored values should be obtained from storage in any case (and thus waste some caller time), so in general Precomputed metrics are just very fast Runtime metrics

But from the point of metric storing Precomputed metrics have more significant difference - some of them can be retrieved from metric storage for update

  • Mutable metric is the Metric, which can be updated with either with some delta or with absolute value according to business rules:

    • Counters
    • Accumulated total
    • Balance
  • Precomputed metrics MAY NOT be Mutable since precomputing can be part of the responder performance optimization process and there is no sense in adjusting such value as it is overwritten during metric computation

  • Mutable Metric Storage is the general storage interface which allows end user to mutate some metric by name and tags. It's depends on internal storage implementation, what happens if the metric is not found. If the storage allows dynamic metric generation - new metric would be stored silently with given value

Supplementary terms

  • Collector is the generic class serving the metric Source to other parts of the library

    • Responder to render
    • Storage receiver to cache them
    • Debug utilities for metric profiling and inspection

    In general Collector could just keep preconfigured Source or retrieve data from other sources (API, DB, Cache)

  • Materializing is the process of resolving single metric Collector into precomputed metric Source and storing it in a resolved form for fast access to some Storage (Cache, DB, etc)

  • Storage is the metric storing driver. It is responsible for the following actions

    • Create new metric instance by its primary parts - name, value and tags
    • Find metric by name and tags
    • Work as a Source of metrics
    • Work as a receiver accepting Source to be materialized in it

Extending

See extending chapter

Development

Running tests

composer install
vendor/bin/phpunit

统计信息

  • 总下载量: 1.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 37
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 36
  • Watchers: 33
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固