@@ -75,14 +75,64 @@ class PROMETHEUS_CPP_CORE_EXPORT Summary {
75
75
std::chrono::milliseconds max_age = std::chrono::seconds{60 },
76
76
int age_buckets = 5 );
77
77
78
+ // / \brief Create a summary metric.
79
+ // /
80
+ // / \param quantiles A list of 'targeted' Phi-quantiles. A targeted
81
+ // / Phi-quantile is specified in the form of a Phi-quantile and tolerated
82
+ // / error. For example a Quantile{0.5, 0.1} means that the median (= 50th
83
+ // / percentile) should be returned with 10 percent error or a Quantile{0.2,
84
+ // / 0.05} means the 20th percentile with 5 percent tolerated error. Note that
85
+ // / percentiles and quantiles are the same concept, except percentiles are
86
+ // / expressed as percentages. The Phi-quantile must be in the interval [0, 1].
87
+ // / Note that a lower tolerated error for a Phi-quantile results in higher
88
+ // / usage of resources (memory and cpu) to calculate the summary.
89
+ // /
90
+ // / The Phi-quantiles are calculated over a sliding window of time. The
91
+ // / sliding window of time is configured by max_age and age_buckets.
92
+ // /
93
+ // / \param creation_time The time of when this constructor was called.
94
+ // /
95
+ // / \param max_age Set the duration of the time window, i.e., how long
96
+ // / observations are kept before they are discarded. The default value is 60
97
+ // / seconds.
98
+ // /
99
+ // / \param age_buckets Set the number of buckets of the time window. It
100
+ // / determines the number of buckets used to exclude observations that are
101
+ // / older than max_age from the summary, e.g., if max_age is 60 seconds and
102
+ // / age_buckets is 5, buckets will be switched every 12 seconds. The value is
103
+ // / a trade-off between resources (memory and cpu for maintaining the bucket)
104
+ // / and how smooth the time window is moved. With only one age bucket it
105
+ // / effectively results in a complete reset of the summary each time max_age
106
+ // / has passed. The default value is 5.
107
+ Summary (const Quantiles& quantiles,
108
+ const std::chrono::system_clock::time_point& creation_time,
109
+ std::chrono::milliseconds max_age = std::chrono::seconds{60 },
110
+ int age_buckets = 5 );
111
+
78
112
// / \brief Observe the given amount.
79
113
void Observe (double value);
80
114
115
+ // / \brief Observe the given amount.
116
+ // /
117
+ // / \param quantiles The given amount.
118
+ // /
119
+ // / \param time The time of when this function was called.
120
+ void Observe (double value, const std::chrono::system_clock::time_point& time);
121
+
81
122
// / \brief Get the current value of the summary.
82
123
// /
83
124
// / Collect is called by the Registry when collecting metrics.
84
125
ClientMetric Collect () const ;
85
126
127
+ // / \brief Get the current value of the summary.
128
+ // /
129
+ // / \param time The time of when this function was called.
130
+ // /
131
+ // / \return The current value.
132
+ // /
133
+ // / Collect is called by the Registry when collecting metrics.
134
+ ClientMetric Collect (const std::chrono::system_clock::time_point& time) const ;
135
+
86
136
// / \brief Check if the summary has expired.
87
137
// /
88
138
// / Expires is called by the Registry when collecting metrics.
0 commit comments