# Poco::Prometheus

# class LabeledMetric

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

## Description

This class adds support for labels to the basic Metric class.

## Inheritance

Direct Base Classes: Metric

All Base Classes: Collector, Metric

Known Derived Classes: LabeledMetricImpl

## Member Summary

Member Functions: labelNames, setLabelNames, validateLabelName

Inherited Functions: exportTo, help, name, setHelp, type, validateName

## Constructors

### LabeledMetric

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

Creates a LabeledMetric 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_:]*.

### LabeledMetric

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

Creates a LabeledMetric 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

### ~LabeledMetric

virtual ~LabeledMetric();

Destroys the LabeledMetric.

## Member Functions

### labelNames

const std::vector < std::string > & labelNames() const;

Returns the metric's label names.

### setLabelNames

void setLabelNames(
const std::vector < std::string > & labelNames
);

Sets the metric's label names.

### validateLabelName

static const std::string & validateLabelName(
const std::string & name
);

Validates the given name against the regular expression defining a valid label name ([a-zA-Z_:][a-zA-Z0-9_:]*).

## Variables

### EMPTY_LABEL

static const std::vector < std::string > EMPTY_LABEL;