Poco::Prometheus

class IntCounter

File Information

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

Description

IntCounter is a very low overhead implementation of a Counter, supporting 64-bit unsigned integer values only, using std::atomic

Labels are not supported.

Inheritance

Direct Base Classes: Metric

All Base Classes: Collector, Metric

Member Summary

Member Functions: exportTo, help, inc, setToCurrentTime, value

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

Nested Classes

struct Params

 

Types Aliases

Sample

using Sample = Poco::UInt64;

Constructors

IntCounter inline

explicit IntCounter(
    const std::string & name
);

Creates a IntCounter with the given name and registers it with the default registry.

IntCounter

IntCounter(
    const std::string & name,
    const Params & params
);

Creates a IntCounter with the given name and help text (via params), and registers it with the default registry.

IntCounter

IntCounter(
    const std::string & name,
    Registry * pRegistry
);

Creates a IntCounter with the given name and registers it with the given registry (if not nullptr).

IntCounter

IntCounter(
    const std::string & name,
    const Params & params,
    Registry * pRegistry
);

Creates a IntCounter with the given name and help text (via params), and registers it with the given registry (if not nullptr).

Destructor

~IntCounter virtual

~IntCounter() = default;

Destroys the IntCounter.

Member Functions

exportTo virtual

void exportTo(
    Exporter & exporter
) const override;

help inline

IntCounter & help(
    const std::string & text
);

Sets the IntCounter's help text.

Must only be set once, immediately after creating the IntCounter.

inc inline

void inc();

Increments the IntCounter's current value by one.

inc

void inc(
    Sample v
);

Increments the IntCounter's current value by the given value.

setToCurrentTime

void setToCurrentTime();

Sets the Gauge's current value to the current epoch time (seconds since midnight January 1st 1970).

value inline

Sample value() const;

Returns the IntCounter's current value.

Securely control IoT edge devices from anywhere   Connect a Device