# Poco::Prometheus

# class ThreadPoolCollector

Library: Prometheus
Package: Collectors
Header: Poco/Prometheus/ThreadPoolCollector.h

## Description

This Collector provides Poco::ThreadPool specific metrics:

- poco_threadpool_max_threads: Maximum number of threads available in the thread pool (capacity).
- poco_threadpool_used_threads: Number of currently used threads.
- poco_threadpool_allocated_threads: Number of currently allocated threads.

Metrics have a single label "name" identifying the thread pool. The name of the default thread pool is "default".

## Inheritance

Direct Base Classes: Collector

All Base Classes: Collector

## Member Summary

Member Functions: buildMetrics, collectorName, exportTo

Inherited Functions: exportTo, name, validateName

## Constructors

### ThreadPoolCollector

ThreadPoolCollector();

Creates a default ThreadPoolCollector for the default Poco::ThreadPool.

### ThreadPoolCollector

explicit ThreadPoolCollector(
const Poco::ThreadPool & threadPool
);

Creates a default ThreadPoolCollector for the given Poco::ThreadPool. The Poco::ThreadPool must have a non-empty name and the name must be unique across all ThreadPoolCollector instances.

### ThreadPoolCollector

ThreadPoolCollector(
const std::string & name,
const Poco::ThreadPool & threadPool,
Registry * pRegistry
);

Creates a custom ThreadPoolCollector with the given name and registers it with the given Registry.

## Destructor

### ~ThreadPoolCollector

~ThreadPoolCollector() = default;

Destroys the ThreadPoolCollector.

## Member Functions

### exportTo

void exportTo(
Exporter & exporter
) const override;

Writes the given Metric to the Exporter.

See also: Poco::Prometheus::Collector::exportTo()

### buildMetrics

void buildMetrics();

### collectorName

static std::string collectorName(
const std::string & threadPoolName
);

## Variables

### NAME_PREFIX

static const std::string NAME_PREFIX;