@@ -125,13 +125,32 @@ trait StatsReceiver {
125
125
@ varargs
126
126
def counter (name : String * ): Counter = counter(Verbosity .Default , name : _* )
127
127
128
+ /**
129
+ * Get a [[Counter counter ]] with the given `description` and `name`.
130
+ */
131
+ @ varargs
132
+ def counter (description : Some [String ], name : String * ): Counter =
133
+ counter(description.get, Verbosity .Default , name : _* )
134
+
128
135
/**
129
136
* Get a [[Counter counter ]] with the given `name`.
130
137
*/
131
138
@ varargs
132
139
def counter (verbosity : Verbosity , name : String * ): Counter =
133
140
counter(this .metricBuilder(CounterType ).withVerbosity(verbosity).withName(name : _* ))
134
141
142
+ /**
143
+ * Get a [[Counter counter ]] with the given `description` and `name`.
144
+ */
145
+ @ varargs
146
+ def counter (description : String , verbosity : Verbosity , name : String * ): Counter =
147
+ counter(
148
+ this
149
+ .metricBuilder(CounterType )
150
+ .withVerbosity(verbosity)
151
+ .withName(name : _* )
152
+ .withDescription(description))
153
+
135
154
/**
136
155
* Get a [[Counter counter ]] with the given schema.
137
156
*/
@@ -143,13 +162,32 @@ trait StatsReceiver {
143
162
@ varargs
144
163
def stat (name : String * ): Stat = stat(Verbosity .Default , name : _* )
145
164
165
+ /**
166
+ * Get a [[Stat stat ]] with the given `description` and `name`.
167
+ */
168
+ @ varargs
169
+ def stat (description : Some [String ], name : String * ): Stat =
170
+ stat(description.get, Verbosity .Default , name : _* )
171
+
146
172
/**
147
173
* Get a [[Stat stat ]] with the given name.
148
174
*/
149
175
@ varargs
150
176
def stat (verbosity : Verbosity , name : String * ): Stat =
151
177
stat(this .metricBuilder(HistogramType ).withVerbosity(verbosity).withName(name : _* ))
152
178
179
+ /**
180
+ * Get a [[Stat stat ]] with the given `description` and `name`.
181
+ */
182
+ @ varargs
183
+ def stat (description : String , verbosity : Verbosity , name : String * ): Stat =
184
+ stat(
185
+ this
186
+ .metricBuilder(HistogramType )
187
+ .withVerbosity(verbosity)
188
+ .withName(name : _* )
189
+ .withDescription(description))
190
+
153
191
/**
154
192
* Get a [[Stat stat ]] with the given schema.
155
193
*/
@@ -203,6 +241,12 @@ trait StatsReceiver {
203
241
*/
204
242
def addGauge (name : String * )(f : => Float ): Gauge = addGauge(Verbosity .Default , name : _* )(f)
205
243
244
+ /**
245
+ * Add the function `f` as a [[Gauge gauge ]] with the given name and description.
246
+ */
247
+ def addGauge (description : Some [String ], name : String * )(f : => Float ): Gauge =
248
+ addGauge(description.get, Verbosity .Default , name : _* )(f)
249
+
206
250
/**
207
251
* Add the function `f` as a [[Gauge gauge ]] with the given name.
208
252
*
@@ -225,6 +269,15 @@ trait StatsReceiver {
225
269
def addGauge (verbosity : Verbosity , name : String * )(f : => Float ): Gauge =
226
270
addGauge(this .metricBuilder(GaugeType ).withVerbosity(verbosity).withName(name : _* ))(f)
227
271
272
+ /**
273
+ * Add the function `f` as a [[Gauge gauge ]] with the given name and description.
274
+ */
275
+ def addGauge (description : String , verbosity : Verbosity , name : String * )(f : => Float ): Gauge =
276
+ addGauge(
277
+ this
278
+ .metricBuilder(GaugeType ).withVerbosity(verbosity).withName(name : _* ).withDescription(
279
+ description))(f)
280
+
228
281
/**
229
282
* Just like $AddGaugeScaladocLink but optimized for better Java experience.
230
283
*/
0 commit comments