Supports collection of metrics
The main metrics that are available are the statistics around the number of tasks that are running, and how the thread pool is handling these. Note a 'task' is a message from the Peer to the Chaincode - this message is either a new transaction, or a response from a stub API, eg getState(). Query apis may return more than one response. To enable metrics ensure that there is a standard format Java properites file called `config.props` in the root of your contract code. For example this path
myjava-contract-project/java/src/main/resources/config.propsThis should contain the following
CHAINCODE_METRICS_ENABLED=true TP_CORE_POOL_SIZE=5 TP_MAX_POOL_SIZE=5 TP_QUEUE_SIZE=5000The metrics enabled flag will turn on default metrics logging. (it's off by default) The TP values establish the core thread pool size, max thread poolsize, and the number of of tasks that will wait. (5, 5, 5000 are the default values, so don't need to be explicitly specified). If no file is supplied mertics are not enabled, the values shown for the thread pool are used.
Interface Summary Interface Description MetricsProviderInterface to be implemented to send metrics on the chaincode to the 'backend-of-choice'. TaskMetricsCollectorCollect metrics relating to the task execution.
Class Summary Class Description MetricsMetrics setups up the provider in use from the configuration supplied If not enabled, nothing happens, but if enabled but no specific logger default is used that uses the org.hyperledger.Performance logger