jonnyanyc/gmetric-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jonnyanyc/gmetric-php

Composer 安装命令:

composer require jonnyanyc/gmetric-php

包简介

A simple, lightweight PHP client for sending Gmetric data to a Ganglia node via UDP.

README 文档

README

A very simple, lightweight PHP client for sending Gmetric data to a Ganglia node via UDP. This lets you integrate your PHP application with Ganglia and track app-specific metrics via the Ganglia web UI.

Ganglia automatically generates a graph for any new metric it sees. So tracking a new metric just takes one or two lines of code in your application.

The message is sent optimistically, via one-way, non-blocking UDP datagrams. This keeps the cost of tracking metrics as close to zero as possible.

Installation

The easiest way to install is to use Composer:

composer require jonnyanyc/gmetric-php:~0.2.0

Or add the package to your composer.json file manually:

    "require": {
    	"jonnyanyc/gmetric-php": "~0.2.0"
    }

Usage

$gmetric = new \jonnyanyc\Ganglia\Gmetric\Gmetric();

$gmetric->sendMetric("app1.job2.execution_time", "app", "float", 3.12, "hours");
$gmetric->sendMetric("app1.job2.method3.failures", "app", "uint16", 3, "failures");
// send more metrics if needed

If you're running gmond locally, then you can use the Gmetric->useConfigFile() method to set the connectivity details. This method reads the local gmond config file to set the host and port of the server that should receive your metrics. It also sets the correct name for your host when reporting your metrics.

If you prefer, you can define these settings when you instantiate the Gmetric object. Or you can use the defaults: send metrics to localhost at UDP port 8649, and use your host's default host name when reporting metrics.

Gmetric fields

  • name: The name of the metric you're tracking.
  • group: An arbitrary group under which the metric should appear in the Ganglia web interface. Collect all of your app-specific metrics under a group named "app", or separate them by service, job, consumer, type (such as error counts), etc.
  • type: The data type of the value. Valid values are:
    • uint16
    • int16
    • uint32
    • int32
    • float
    • double
    • string
  • value: The value that you want to record for the given metric.
  • unit: The arbitrary units of your value, which is displayed as the Y axis on the graph. Examples: "seconds", "failures", "rows", etc.
  • valueTTL: The normal lifetime for a value for this metric, in seconds. For example, the error count for an hourly batch job would have a lifetime of 1 hour (3600 seconds).
  • metricTTL: The amount of time (in seconds) that Ganglia should still display the graph after not receiving any new values. For example, if you set this to 3 days (259,200 seconds), then Ganglia will drop the graph after 3 days of inactivity. The prior data will be retained, so the graph will re-appear with historical data if you send a new value.
  • counter: Used to determine how the data should be stored in RRDtool. In most cases you'll want to use the default data-handling. You can pass a value of "counter" instead if your metric will only increase, in which case RRDtool will store the deltas. This is equivalent to passing a value of "positive" to the slope option of the Gmetric binary.

Coming soon

Performance

Details to come. In preliminary testing, sending a value appears to cost less than 1ms.

jonnyanyc/gmetric-php 适用场景与选型建议

jonnyanyc/gmetric-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22.67k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jonnyanyc/gmetric-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jonnyanyc/gmetric-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 jonnyanyc/gmetric-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-10-21