承接 leocavalcante/newrelic-telemetry-sdk 相关项目开发

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

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

leocavalcante/newrelic-telemetry-sdk

Composer 安装命令:

composer require leocavalcante/newrelic-telemetry-sdk

包简介

Unofficial PHP library for sending telemetry data to New Relic

README 文档

README

Unofficial PHP library for sending telemetry data to New Relic.

Status API Description
Trace API Used to send distributed tracing data to New Relic (New Relic's format).
Metric API Used to send metric data to New Relic.
Event API Is one way to report custom events to New Relic.
- Log API Not planned.
  • ⚠️ Heavily under development, but open-sourced seeking for contributions.
  • It is not an agent wrapper, it calls the New Relic Ingest APIs.

Usage

Example

Sending a Gauge metric.

use NewRelic\Adapter;
use NewRelic\Metric;

$metric_api = new Metric\API(new Adapter\Curl(getenv('NR_API_KEY')));
$metric_api->setCommonAttrs(['service.name' => 'PHP-SDK']);
$metric_api->send(new Metric\Gauge('memory.heap', 2.3));

$response = $metric_api->commit();

if ($response->isOk()) {
    echo sprintf("Request ID: %s\n", $response->getId());
} else {
    echo sprintf("Metric send error: %s\n", $response->getMessage());
}

Companion resources

Tips

Why

Main reasons includes:

  • Too many segfaults with the regular agent.
  • Even for simple use cases the regular agent doesn't play well with Swoole. This small snippet is enough to throw a segfault:
    Co\run(static function () {
      go(static function () {
        (new Co\Http\Client('swoole.co.uk'))->get('/');
      });
    });
  • There are other SDKs for other languages, this is an unofficial PHP version.
  • Could be used to build a New Relic exporter for the upcoming OpenTelemetry PHP library.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2020-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固