splunk/tracer

Splunk 仪表化 API

0.1.0 2019-10-22 15:24 UTC

README

MIT license

PHP 分布式跟踪库 SplunkTracing。

安装

composer require splunk/tracer

splunk/tracer 包可在 packagist.org 上找到,具体链接为:这里

入门

<?php

require __DIR__ . '/vendor/autoload.php';

SplunkTracing::initGlobalTracer('examples/trivial_process', '{your_access_token}');

$span = SplunkTracing::startSpan("trivial/loop");
for ($i = 0; $i < 10; $i++) {
    $span->logEvent("loop_iteration", $i);
    echo "The current unix time is " . time() . "\n";
    usleep(1e5);
    $child = SplunkTracing::startSpan("child_span", array(parent => $span));
    usleep(2e5);
    $child->logEvent("hello world");
    $child->finish();
    usleep(1e5);
}
$span->finish();

详细 API 文档请参考 lib/api.php

开发者配置

brew install composer
make install
make test

这个库是 Splunk 对 OpenTracing 的绑定。更多详细信息请参考 OpenTracing PHP API

许可证

PHP 的 Splunk Tracer 采用 MIT 许可证。详情请见 LICENSE 文件。

第三方库

这是 Lightstep 的 PHP 跟踪器的分支,Lightstep 的跟踪器也采用 MIT 许可证。以下是原始仓库和许可证的链接: