PHPackages                             phptars/tars-monitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. phptars/tars-monitor

ActiveLibrary

phptars/tars-monitor
====================

tars的主调和特性上报

0.2.3(7y ago)411.6k↓100%3[1 issues](https://github.com/TarsPHP/tars-monitor/issues)PHPPHP &gt;=5.5

Since Sep 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/TarsPHP/tars-monitor)[ Packagist](https://packagist.org/packages/phptars/tars-monitor)[ RSS](/packages/phptars-tars-monitor/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (10)Used By (0)

tars-monitor
============

[](#tars-monitor)

---

tars-monitor is a `phptars` service and feature monitoring and reporting module

It consists of two sub modules:

- Service monitoring
- Feature monitoring

How to use
----------

[](#how-to-use)

Installation of cable vehicles

Using composer for installation

`composer install phptars/tars-monitor`

### How to call

[](#how-to-call)

#### Service Monitoring Report

[](#service-monitoring-report)

- Locator is the report address, which is generally distributed by the server
- Socket mode is set to 1, and socket mode is used for reporting

Socketmode is set to 2. Use swoole TCP client mode for reporting (need swoole support)

Socketmode is set to 3. Use swoole TCP coroutine client to report (need support of swoole 2.0 or above)

#### Scheduled reporting (default)

[](#scheduled-reporting-default)

> The use of scheduled reporting requires the support of swoole table. By calling addstat, the reporting information will be temporarily saved. The task process of the tar server will collect and package the reporting information for a period of time (the reporting interval is issued by the server, generally 60s), which can reduce the reporting request

```
$locator = "tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890";

$socketMode = 1;

$statfWrapper = new \Tars\monitor\StatFWrapper($locator,$socketMode);

$statfWrapper->addStat("PHPTest.helloTars.obj","test","172.16.0.116",51003,200,0,0);

$statfWrapper->addStat("PHPTest.helloTars.obj","test","172.16.0.116",51003,200,0,0);

$statfWrapper->addStat("PHPTest.helloTars.obj","test","172.16.0.116",51003,200,0,0);
```

Report data can be stored in a variety of ways. Cache provides the implementation of 'swoole table' and 'redis'. Users can also implement' contract / storecache interface 'by themselves. Refer to the configuration of' Src / services. PHP 'in demo' tar HTTP server 'for the configuration of storage methods.

```
return array(

'namespaceName' => 'HttpServer\\',

'monitorStoreConf' => [

'className' => Tars\monitor\cache\SwooleTableStoreCache::class,

'config' => []

]

);
```

`Monitorstoreconf` is the configuration of storage mode, where `classname` is the implementation class and' config 'is the corresponding configuration. For example, when using the redis storage mode, the host, port and key prefix of redis need to be configured in config.

When `monitorstoreconf` is not configured, `swooletablestorecache` is used for storage by default.

#### Single report

[](#single-report)

> At the same time, 'tar monitor' also provides a single escalation interface, 'monitorstat'. That is to say, each call of tar request will be reported once, which is not recommended

```
$locator = "tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890";

$socketMode = 1;

$statfWrapper = new \Tars\monitor\StatFWrapper($locator,$socketMode);

$statfWrapper->monitorStat("PHPTest.helloTars.obj","test","172.16.0.116",51003,200,0,0);
```

#### Feature monitoring

[](#feature-monitoring)

Parameters are similar to service monitoring

```
$statfWrapper = new \Tars\monitor\PropertyFWrapper("tars.tarsregistry.QueryObj@tcp -h 172.16.0.161 -p 17890",1);

$statfWrapper->monitorProperty("127.0.0.1","userdefined",'Sum',2);

$statfWrapper->monitorProperty("127.0.0.1","userdefined",'Count',2);

$statfWrapper->monitorProperty("127.0.0.1","userdefined",'Count',1);
```

### Monitor view

[](#monitor-view)

After data reporting, users can view the reported data in the service monitoring / feature monitoring tab.

Others

Because other modules have integrated this module, in general, service scripts do not need to explicitly use this module.

###  Health Score

29

—

LowBetter than 63% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

9

Last Release

2644d ago

PHP version history (2 changes)0.1.4PHP &gt;=5.3

0.1.7PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/bf1b3ee26ddb9ebe4490a8f1bcd84a7450fa70cf0bf367fd6c267ba7d353d3fd?d=identicon)[phptars](/maintainers/phptars)

---

Top Contributors

[![meijing0114](https://avatars.githubusercontent.com/u/2072584?v=4)](https://github.com/meijing0114 "meijing0114 (14 commits)")[![copyrenzhe](https://avatars.githubusercontent.com/u/2667735?v=4)](https://github.com/copyrenzhe "copyrenzhe (4 commits)")[![danielzheng-Tencent](https://avatars.githubusercontent.com/u/60135050?v=4)](https://github.com/danielzheng-Tencent "danielzheng-Tencent (1 commits)")

---

Tags

tarstars-monitortarsphp

### Embed Badge

![Health badge](/badges/phptars-tars-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/phptars-tars-monitor/health.svg)](https://phpackages.com/packages/phptars-tars-monitor)
```

###  Alternatives

[phptars/tars-server

tars的php框架

1110.9k3](/packages/phptars-tars-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
