File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -242,8 +242,18 @@ impl<T: MetricVecBuilder> MetricVec<T> {
242242 }
243243
244244 /// `with_label_values` works as `get_metric_with_label_values`, but panics if an error
245- /// occurs. The method allows neat syntax like:
246- /// httpReqs.with_label_values("404", "POST").inc()
245+ /// occurs.
246+ ///
247+ /// # Examples
248+ ///
249+ /// ```
250+ /// use prometheus::{CounterVec, Opts};
251+ /// let vec = CounterVec::new(
252+ /// Opts::new("requests", "Number of requests"),
253+ /// &["code", "http_method"]
254+ /// ).unwrap();
255+ /// vec.with_label_values(&["404", "POST"]).inc()
256+ /// ```
247257 pub fn with_label_values ( & self , vals : & [ & str ] ) -> T :: M {
248258 self . get_metric_with_label_values ( vals) . unwrap ( )
249259 }
You can’t perform that action at this time.
0 commit comments