# Poco::Prometheus

# class Metric

Library: Prometheus
Package: Core
Header: Poco/Prometheus/Metric.h

## Description

This is the base class for all metrics, such as Counter, Gauge and Histogram.

## Inheritance

Direct Base Classes: Collector

All Base Classes: Collector

Known Derived Classes: CallbackMetric, IntCounter, IntGauge, LabeledMetric, LabeledMetricImpl

## Member Summary

Member Functions: help, setHelp, type

Inherited Functions: exportTo, name, validateName

## Enumerations

### Type

COUNTER

GAUGE

HISTOGRAM

SUMMARY

UNTYPED

## Constructors

### Metric

Metric(
Type type,
const std::string & name
);

Creates a Metric with the given type and name, and registers it with the default Registry.

The name must be a valid metric name and match the regular expression [a-zA-Z_:][a-zA-Z0-9_:]*.

### Metric

Metric(
Type type,
const std::string & name,
Registry * pRegistry
);

Creates a Metric with the given type and name, and registers it with the given Registry (if not nullptr).

The name must be a valid metric name and match the regular expression [a-zA-Z_:][a-zA-Z0-9_:]*.

## Destructor

### ~Metric

~Metric() = default;

Destroys the Metric.

## Member Functions

### help

const std::string & help() const;

Returns the metric's help text.

### type

Type type() const;

Returns the metric's type.

### setHelp

void setHelp(
const std::string & help
);

Sets the metric's help text.