承接 vend/statsd 相关项目开发

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

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

vend/statsd

最新稳定版本:v1.1.1

Composer 安装命令:

composer require vend/statsd

包简介

Simple extensible StatsD client library for PHP 5.5+

README 文档

README

Simple extensible StatsD client for PHP 5.5+

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

Features

  • Correctly splits large numbers of metrics across multiple datagrams
  • Can substitute out the underlying format of the metrics being sent, to support things like Datadog's tags and histograms
  • Supports sample rates, but leaves skipping the send to the caller (use the factory and socket directly)
  • Doesn't block during metric sending, and only supports UDP (opinionated, but that's all you should need)

Usage

This library uses dependency injection throughout. To instantiate a Client, you'll need a Socket and a Factory:

use Vend\Statsd\Client;
use Vend\Statsd\Socket;
use Vend\Statsd\Factory;

$client = new Client(
    new Socket(),
    new Factory()
);

Once you have a client, you can use the familiar statsd methods to enqueue metrics on the client. The client doesn't send them until ->flush() is called.

$client->increment('some.metric_key'); // incremented by 1
$client->decrement('some.metric_key'); // decremented by 1
$client->counter('some.counter', 3);   // incremented by 3
$client->gauge('some.gauge', 10);
$client->timer('some.timer', 0.25);
$client->set('some.set', 'some_value');

$client->flush(); // actually sends the metrics

These methods return the MetricInterface produced by the factory (so you can then attach extra information).

You can also use the factory and socket to directly and immediately send metrics. The ->getData() method on MetricInterface provides the serialized string that should be sent to the statsd server.

$socket = new Socket('127.0.0.1', 8125);
$factory = new Factory();

$socket->open();
$socket->write($factory->increment('some.key')->getData());
$socket->close();

Extending

For an example of how to extend the library, see the Vend\Statsd\Datadog namespace. A different Factory is used by passing it to the Client. The Datadog-specific factory will allow the metrics to carry tag information.

NullClient, ClientAwareInterface and ClientAwareTrait

Helpful utility classes for performing optional (setter) injection of statsd clients into your classes. Use them in pretty much the same way as their PSR3 equivalents.

vend/statsd 适用场景与选型建议

vend/statsd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 289.85k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 12 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「monitoring」 「statsd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 vend/statsd 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 8
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-01