/
intrumented.go
113 lines (96 loc) · 3.97 KB
/
intrumented.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// This code is auto generated. DO NOT EDIT.
package account_user
import (
"time"
"github.com/go-openapi/runtime"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
type InstrumentedClientService struct {
ClientService
cv *prometheus.CounterVec
hv *prometheus.HistogramVec
}
func NewInstrumentedClientService(impl ClientService, r prometheus.Registerer) *InstrumentedClientService {
hv := promauto.With(r).NewHistogramVec(
prometheus.HistogramOpts{
Name: "nuki_http_client_requests_duration_seconds",
Help: "the total number of http requests to the Nuki API",
Buckets: prometheus.DefBuckets,
}, []string{"method"})
cv := promauto.With(r).NewCounterVec(
prometheus.CounterOpts{
Name: "nuki_http_client_requests",
Help: "the total number of http requests to the Nuki API",
}, []string{"method", "result"})
return &InstrumentedClientService{
ClientService: impl,
cv: cv,
hv: hv,
}
}
func (c *InstrumentedClientService) AccountUserResourceDeleteDelete(_c0 *AccountUserResourceDeleteDeleteParams, _c1 runtime.ClientAuthInfoWriter, _c2 ...ClientOption) (*AccountUserResourceDeleteDeleteNoContent, error) {
t := time.Now()
defer func() {
c.hv.WithLabelValues("AccountUserResourceDeleteDelete").Observe(time.Since(t).Seconds())
}()
_a0, err := c.ClientService.AccountUserResourceDeleteDelete(_c0, _c1, _c2...)
if err != nil {
c.cv.WithLabelValues("AccountUserResourceDeleteDelete", "error").Inc()
return _a0, err
}
c.cv.WithLabelValues("AccountUserResourceDeleteDelete", "success").Inc()
return _a0, err
}
func (c *InstrumentedClientService) AccountUserResourceGetGet(_c0 *AccountUserResourceGetGetParams, _c1 runtime.ClientAuthInfoWriter, _c2 ...ClientOption) (*AccountUserResourceGetGetOK, error) {
t := time.Now()
defer func() {
c.hv.WithLabelValues("AccountUserResourceGetGet").Observe(time.Since(t).Seconds())
}()
_a0, err := c.ClientService.AccountUserResourceGetGet(_c0, _c1, _c2...)
if err != nil {
c.cv.WithLabelValues("AccountUserResourceGetGet", "error").Inc()
return _a0, err
}
c.cv.WithLabelValues("AccountUserResourceGetGet", "success").Inc()
return _a0, err
}
func (c *InstrumentedClientService) AccountUserResourcePostPost(_c0 *AccountUserResourcePostPostParams, _c1 runtime.ClientAuthInfoWriter, _c2 ...ClientOption) (*AccountUserResourcePostPostOK, *AccountUserResourcePostPostNoContent, error) {
t := time.Now()
defer func() {
c.hv.WithLabelValues("AccountUserResourcePostPost").Observe(time.Since(t).Seconds())
}()
_a0, _a1, err := c.ClientService.AccountUserResourcePostPost(_c0, _c1, _c2...)
if err != nil {
c.cv.WithLabelValues("AccountUserResourcePostPost", "error").Inc()
return _a0, _a1, err
}
c.cv.WithLabelValues("AccountUserResourcePostPost", "success").Inc()
return _a0, _a1, err
}
func (c *InstrumentedClientService) AccountUsersResourceGetGet(_c0 *AccountUsersResourceGetGetParams, _c1 runtime.ClientAuthInfoWriter, _c2 ...ClientOption) (*AccountUsersResourceGetGetOK, error) {
t := time.Now()
defer func() {
c.hv.WithLabelValues("AccountUsersResourceGetGet").Observe(time.Since(t).Seconds())
}()
_a0, err := c.ClientService.AccountUsersResourceGetGet(_c0, _c1, _c2...)
if err != nil {
c.cv.WithLabelValues("AccountUsersResourceGetGet", "error").Inc()
return _a0, err
}
c.cv.WithLabelValues("AccountUsersResourceGetGet", "success").Inc()
return _a0, err
}
func (c *InstrumentedClientService) AccountUsersResourcePutPut(_c0 *AccountUsersResourcePutPutParams, _c1 runtime.ClientAuthInfoWriter, _c2 ...ClientOption) (*AccountUsersResourcePutPutOK, error) {
t := time.Now()
defer func() {
c.hv.WithLabelValues("AccountUsersResourcePutPut").Observe(time.Since(t).Seconds())
}()
_a0, err := c.ClientService.AccountUsersResourcePutPut(_c0, _c1, _c2...)
if err != nil {
c.cv.WithLabelValues("AccountUsersResourcePutPut", "error").Inc()
return _a0, err
}
c.cv.WithLabelValues("AccountUsersResourcePutPut", "success").Inc()
return _a0, err
}