The cat client can be compiled and used on both Linux (both glibc and musl-libc) and OSX.
The `ccat` can be compiled and used on both Linux (both glibc and musl-libc) and OSX.
The following Operating Systems are tested:
...
...
@@ -47,7 +47,7 @@ gcc -lcatclient x.c
## Initialization
Some [preparations](../_/preparations.md) needs to be done before initialize`ccat`.
Some [preparations](../_/preparations.md) needs to be done before initializing`ccat`.
With all the preparations have been done, it's easy to initialize `ccat` in your c codes.
...
...
@@ -59,7 +59,7 @@ catClientInit("appkey");
> Only English characters (a-z, A-Z), numbers (0-9), underscore (\_) and dash (-) is allowed in appkey.
Note that `sampling`, built-in `heartbeat` and `binary` encoder is enabled by default, which you may want to disable it. We also offered an API to customize your initialization, please refer to our [apidoc](./docs/api.md).
Note that `sampling`, built-in `heartbeat` and `binary` encoder is enabled by default, which you may want to disable it. We also offered an API to customize your initialization, please refer to our [API doc](./docs/api.md).
@@ -268,7 +268,7 @@ void logMetricForCount(const char *name, int quantity);
The metric will be sent every 1 second.
For example, if you called this API 3 times in one second (can be in different threads, we use a concurrent hash map to cache the value), only the aggregated value (summarized) will be reported to the server.
For example, if you have called this API 3 times in one second (can be in different threads, we use a concurrent hash map to cache the value), only the aggregated value (summarized) will be reported to the server.
#### logMetricForDuration
...
...
@@ -276,7 +276,7 @@ For example, if you called this API 3 times in one second (can be in different t
Like `logMetricForCount`, the metrics reported in the same second will be aggregated, the only difference is `averaged` value is used instead of `summarized` value.
Like `logMetricForCount`, the metrics that have been logged in the same second will be aggregated, the only difference is `averaged` value is used instead of `summarized` value.
The cat client can be compiled and used both on Linux (both glibc and musl-libc) and OSX.
The `cppcat` can be compiled and used both on Linux (both glibc and musl-libc) and OSX.
The following Operating Systems are tested:
...
...
@@ -53,7 +53,7 @@ g++ -lcatclient x.cpp
## Initialization
Some [preparations](../_/preparations.md) needs to be done before initialize`cppcat`.
Some [preparations](../_/preparations.md) needs to be done before initializing`cppcat`.
With all the preparations have been done, it's easy to initialize `cppcat` in your c++ codes.
...
...
@@ -65,7 +65,7 @@ cat::init("appkey");
> Only English characters (a-z, A-Z), numbers (0-9), underscore (\_) and dash (-) is allowed in appkey.
Note that `sampling`, built-in `heartbeat` and `binary` encoder is enabled by default, which you may want to disable it. We also offered an API to customize your initialization, please refer to our [apidoc](./docs/api.md).
Note that `sampling`, built-in `heartbeat` and `binary` encoder is enabled by default, which you may want to disable it. We also offered an API to customize your initialization, please refer to our [API doc](./docs/api.md).
For example, if you called this API 3 times in one second (can be in different threads, we use a concurrent hash map to cache the value), only the aggregated value (summarized) will be reported to the server.
For example, if you have called this API 3 times in one second (can be in different threads, we use a concurrent hash map to cache the value), only the aggregated value (summarized) will be reported to the server.
#### logMetricForDuration
...
...
@@ -176,4 +176,4 @@ For example, if you called this API 3 times in one second (can be in different t
Like `logMetricForCount`, the metrics reported in the same second will be aggregated, the only difference is `averaged` value is used instead of `summarized` value.
Like `logMetricForCount`, the metrics that have been logged in the same second will be aggregated, the only difference is `averaged` value is used instead of `summarized` value.
Gocat is highly dependent on `ccat`. (through CGO)
`gocat` is highly dependent on `ccat`. (through CGO)
Since we using the thread local to storage the transaction stack in `ccat`, which is necessary to build a message tree. It's hard for us to let it work appropriately with goroutines. (Because a goroutine can be run in different threads, due to the MPG model)
Since we are using the thread local to storage the transaction stack in `ccat`, which is necessary to build a `message tree`. It's hard for us to let it work appropriately with goroutines. (Because a goroutine can be run in different threads, due to the MPG model)
So we don't support `message tree` in this version. Don't worry, we are still working on it and have some great ideas at the moment.
...
...
@@ -20,9 +20,9 @@ $ go get github.com/dianping/cat/lib/go/...
## Initialization
Some [preparations](../_/preparations.md) needs to be done before initialize `ccat`.
Some [preparations](../_/preparations.md) needs to be done before initializing `gocat`.
And then you can initialize `gocat` with following codes:
And then you can initialize `gocat` with the following codes:
```c
import(
...
...
@@ -45,11 +45,11 @@ t := cat.NewTransaction(TTYPE, "test")
defert.Complete()
```
We strongly recommend using `defer` keyword to make sure the transaction be completed, or it may cause problems.
We strongly recommend using `defer` keyword to make sure that the transaction completed, or it may cause problems.
#### Transaction apis
We offered a list of APIs to modify the transaction.
We offered a series of APIs to modify the transaction.
* AddData
* SetStatus
...
...
@@ -58,7 +58,7 @@ We offered a list of APIs to modify the transaction.
* SetTimestamp
* Complete
These APIs can be easily used as the following codes.
These APIs can be easily used with the following codes.
For example, if you called count 3 times in the same second (with the same name), we will just summarise the value of them and reported once to the server.
For example, if you have called count 3 times in the same second (with the same name), we will just summarise the value of them and report once to the server.
In the case of `duration`, we use `averaged` value instead of `summarised` value.
The `nodecat` required `libcatclient.so` installed in `LD_LIBRARY_PATH`.
The `nodecat` required `libcatclient.so`to be installed in `LD_LIBRARY_PATH`.
Please refer to [ccat installation](../c/README.md) for further information.
...
...
@@ -18,31 +18,18 @@ npm install nodecat
## Initialization
First of all, you have to create `/data/appdatas/cat` directory, read and write permission is required (0644).`/data/applogs/cat` is also required if you'd like to preserve a debug log, it can be very useful while debugging.
Some [preparations](../_/preparations.md) needs to be done before initializing `ccat`.
And create a config file `/data/appdatas/cat/client.xml` with the following contents.
The pycat can be used both in python2 (>=2.6) and python3 (>=3.5)
The `pycat` can be used both in python2 (>=2.6) and python3 (>=3.5)
## Installation
...
...
@@ -20,9 +20,9 @@ python setup.py install
## Initialization
Some [preparations](../_/preparations.md) needs to be done before initialize`pycat`.
Some [preparations](../_/preparations.md) needs to be done before initializing`pycat`.
With all the preparations have been done, it's easy to initialize `pycat` in your python codes.
And then you can initialize `pycat` with the following codes:
```python
cat.init("appkey")
...
...
@@ -32,11 +32,11 @@ cat.init("appkey")
### Coroutine Mode
Since we are using `ThreadLocal` to storage the transaction stack in `ccat`, which is neccessary to build message tree, and `pycat` is highly dependent on `ccat`. (with cffi)
Since we are using `ThreadLocal` to storage the transaction stack in `ccat`, which is neccessary to build the `message tree`, and `pycat` is highly dependent on `ccat`. (with cffi)
So we don't support message tree in `coroutine` modes, like `gevent`, `greenlet`.
So we don't support message tree in `coroutine` modes, like `gevent`, `greenlet` because different coroutines that in the same thread run alternately.
In these cases, you should use the following code to initialize `pycat` to disable message tree.
In these cases, you should use the following code to initialize `pycat`.
```python
cat.init("appkey",logview=False)
...
...
@@ -46,7 +46,7 @@ Then we will disable the context manager which is used for building `message tre
### Sampling
Sampling is enabled by default, you can disable it.
Sampling is enabled by default, you can disable it through the following codes.
The default encoder is `binary encoder`, you can switch it to `text encoder`, which can be recognized by the earlier version of `cat server`.
The default encoder is `binary encoder`, you can switch it to `text encoder`, which can be recognized by the earlier version of the cat server.
```python
cat.init("appkey",encoder=cat.ENCODER_TEXT)
...
...
@@ -102,7 +102,7 @@ t = cat.Transaction("Trans", "t3")
t.complete()
```
To avoid of forgetting to complete the transaction, we strongly recommend to surround the transaction by a `try-finally` block, and complete the transaction in the `finally` code block.
To avoid of forgetting to complete the transaction, we strongly recommend you to surround the transaction by a `try-finally` block, and complete the transaction in the `finally` code block.
```python
try:
...
...
@@ -113,7 +113,7 @@ finally:
We also provide `decorator` and `context manager` usages, which can complete the transaction automatically.
And we highly recommend to use the transaction in these ways.
And we highly recommend you to use the transaction in these ways.
#### via decorator
...
...
@@ -128,7 +128,7 @@ def test():
If something goes wrong in the decorated function, the status of the transaction will be set to `FAILED`, and whatever the function raised a exception or not, the transaction will be auto-completed.
The only problem is that you can't get the transaction object if you monitor a function via transaction decorator.
The only problem is that you can't get the transaction object if you monitor a function via decorator.
#### via context manager
...
...
@@ -148,7 +148,7 @@ Though it is a bit complex, you can get the transaction object :)
### Transaction apis
We offered a list of APIs to modify the transaction.
We offered a series of APIs to modify the transaction.
* add\_data
* set\_status
...
...
@@ -157,7 +157,7 @@ We offered a list of APIs to modify the transaction.
* set\_timestamp
* complete
These APIs can be easily used like the following codes.
These APIs can be easily used with the following codes.
```python
try:
...
...
@@ -187,14 +187,14 @@ There is something you may want to know:
# Log a event with success status and empty data.
cat.log_event("Event","E1")
# The third parameter (status) is optional, default is "0".
# The 3rd parameter (status) is optional, default is "0".
# It can be any of string value.
# The event will be treated as a "problem" unless the given status == cat.CAT_CUSSESS ("0")
# which will be recorded in our problem report.
cat.log_event("Event","E2",cat.CAT_ERROR)
cat.log_event("Event","E3","failed")
# The fourth parameter (data) is optional, default is "".
# The 4th parameter (data) is optional, default is "".
For example, if you called count 3 times in one second (with the same name), we will just summarised the value of them and reported once to the server.
For example, if you have called count 3 times in one second (with the same name), we will just summarised the value of them and report once to the server.
In case of `duration`, we use `averaged` value instead of `summarised` value.