A plugin statistic is created by TSStatCreate(). The
name must be globally unique and should follow the standard dotted
tag form. To avoid collisions and for easy of use the first tag should be
the plugin name or something easily derived from it. Currently only integers
are supported therefore type must be TS_RECORDDATATYPE_INT.
The return value is the index of the statistic. In general this should work
but if it doesn't it will assert. In particular, creating the same
statistic twice will fail in this way, which can happen if statistics are
created as part of or based on configuration files and Traffic Server is
reloaded.
TSStatFindName() locates a statistic by name. If
found the function returns TS_SUCCESS and the value pointed at by
idx_ptr is updated to be the index of the statistic. Otherwise it
returns TS_ERROR.
The values in statistics are manipulated by TSStatIntSet()
to set the statistic directly, TSStatIntIncrement() to increase it by
value, and TSStatIntDecrement() to decrease it by
value.
A group of records can be examined via TSRecordDump(). A
set of records is specified and the iterated over. For each record in the
set the callbac callback is invoked.
The records are specified by the TSRecordType. This this is
TS_RECORDTYPE_NULL then all records are examined. The callback is
passed
- type
- The record type.
- edata
- Callback context. This is the edata value passed to
TSRecordDump().
- registered
- A flag indicating if the value has been registered.
- name
- The name of the record. This is nul terminated.
- type
- The storage type of the data in the record.
- datum
- The record data.
TSMgmtStringCreate() and TSMgmtIntCreate() return
TS_SUCCESS if the management value was created and TS_ERROR if
not.
2020, dev@trafficserver.apache.org