Package list golang-github-go-kit-kit / 8cdb962
Fix panic on inconsistent label cardinality and error semantic Michal Budzyn 5 years ago
2 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1515
1616 func (mw instrumentingMiddleware) Uppercase(s string) (output string, err error) {
1717 defer func(begin time.Time) {
18 lvs := []string{"method", "uppercase", "error", fmt.Sprint(err == nil)}
18 lvs := []string{"method", "uppercase", "error", fmt.Sprint(err != nil)}
1919 mw.requestCount.With(lvs...).Add(1)
2020 mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
2121 }(time.Now())
2626
2727 func (mw instrumentingMiddleware) Count(s string) (n int) {
2828 defer func(begin time.Time) {
29 lvs := []string{"method", "count"}
29 lvs := []string{"method", "count", "error", "false"}
3030 mw.requestCount.With(lvs...).Add(1)
3131 mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
3232 mw.countResult.Observe(float64(n))
2525
2626 func (mw instrmw) Uppercase(s string) (output string, err error) {
2727 defer func(begin time.Time) {
28 lvs := []string{"method", "uppercase", "error", fmt.Sprint(err == nil)}
28 lvs := []string{"method", "uppercase", "error", fmt.Sprint(err != nil)}
2929 mw.requestCount.With(lvs...).Add(1)
3030 mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
3131 }(time.Now())
3636
3737 func (mw instrmw) Count(s string) (n int) {
3838 defer func(begin time.Time) {
39 lvs := []string{"method", "count"}
39 lvs := []string{"method", "count", "error", "false"}
4040 mw.requestCount.With(lvs...).Add(1)
4141 mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
4242 mw.countResult.Observe(float64(n))