Package org.hyperledger.fabric.metrics

Provides interfaces and classes to support 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, add a CHAINCODE_METRICS_ENABLED=true setting to the config.props chaincode configuration file. See the Overview for details of how to configure chaincode.

Open Telemetry

To use Open Telemetry, set the following properties:
 CHAINCODE_METRICS_ENABLED=true
 CHAINCODE_METRICS_PROVIDER=org.hyperledger.fabric.metrics.impl.OpenTelemetryMetricsProvider
 
Additionally, you can set properties after the specification: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-environment-variables.md Example:
 OTEL_EXPORTER_OTLP_ENDPOINT=otelcollector:4317
 OTEL_EXPORTER_OTLP_INSECURE=true