Skip to content

Commit a533e11

Browse files
committed
feat: Add metrics for infoblox API calls
Signed-off-by: Dinar Valeev <[email protected]>
1 parent a2de1d4 commit a533e11

File tree

6 files changed

+112
-4
lines changed

6 files changed

+112
-4
lines changed

cmd/webhook/init/server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"net/http"
2626

2727
"github.com/AbsaOSS/external-dns-infoblox-webhook/cmd/webhook/init/configuration"
28+
"github.com/prometheus/client_golang/prometheus/promhttp"
2829
"sigs.k8s.io/external-dns/provider"
2930
"sigs.k8s.io/external-dns/provider/webhook/api"
3031
)
@@ -55,6 +56,7 @@ func (wh *WebhookServer) StartHealth(config configuration.Config) {
5556
go func() {
5657
listenAddr := fmt.Sprintf("0.0.0.0:%d", config.HealthCheckPort)
5758
m := http.NewServeMux()
59+
m.Handle("/metrics", promhttp.Handler())
5860
m.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
5961
select {
6062
case <-wh.Channel:

go.mod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ require (
66
github.com/caarlos0/env/v11 v11.0.0
77
github.com/infobloxopen/infoblox-go-client/v2 v2.10.0
88
github.com/miekg/dns v1.1.59
9+
github.com/prometheus/client_golang v1.19.1
910
github.com/sirupsen/logrus v1.9.3
1011
github.com/stretchr/testify v1.9.0
1112
sigs.k8s.io/external-dns v0.14.2
1213
)
1314

1415
require (
1516
github.com/aws/aws-sdk-go v1.53.3 // indirect
17+
github.com/beorn7/perks v1.0.1 // indirect
18+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
1619
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1720
github.com/go-logr/logr v1.4.2 // indirect
1821
github.com/gogo/protobuf v1.3.2 // indirect
@@ -24,14 +27,17 @@ require (
2427
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2528
github.com/modern-go/reflect2 v1.0.2 // indirect
2629
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
30+
github.com/prometheus/client_model v0.6.1 // indirect
31+
github.com/prometheus/common v0.53.0 // indirect
32+
github.com/prometheus/procfs v0.12.0 // indirect
2733
github.com/rogpeppe/go-internal v1.11.0 // indirect
2834
golang.org/x/mod v0.20.0 // indirect
2935
golang.org/x/net v0.28.0 // indirect
3036
golang.org/x/sync v0.8.0 // indirect
3137
golang.org/x/sys v0.24.0 // indirect
3238
golang.org/x/text v0.17.0 // indirect
3339
golang.org/x/tools v0.24.0 // indirect
34-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
40+
google.golang.org/protobuf v1.34.1 // indirect
3541
gopkg.in/inf.v0 v0.9.1 // indirect
3642
gopkg.in/yaml.v2 v2.4.0 // indirect
3743
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
github.com/aws/aws-sdk-go v1.53.3 h1:xv0iGCCLdf6ZtlLPMCBjm+tU9UBLP5hXnSqnbKFYmto=
22
github.com/aws/aws-sdk-go v1.53.3/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
3+
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
4+
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
35
github.com/caarlos0/env/v11 v11.0.0 h1:ZIlkOjuL3xoZS0kmUJlF74j2Qj8GMOq3CDLX/Viak8Q=
46
github.com/caarlos0/env/v11 v11.0.0/go.mod h1:2RC3HQu8BQqtEK3V4iHPxj0jOdWdbPpWJ6pOueeU1xM=
7+
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
8+
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
59
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
610
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
711
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -32,11 +36,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
3236
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
3337
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
3438
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
35-
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
3639
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
3740
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
38-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
39-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
4041
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
4142
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
4243
github.com/miekg/dns v1.1.59 h1:C9EXc/UToRwKLhK5wKU/I4QVsBUc8kE6MkHBkeypWZs=
@@ -54,6 +55,14 @@ github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeD
5455
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5556
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
5657
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
58+
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
59+
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
60+
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
61+
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
62+
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=
63+
github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U=
64+
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
65+
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
5766
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
5867
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
5968
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
@@ -109,6 +118,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
109118
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
110119
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
111120
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
121+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
122+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
112123
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
113124
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
114125
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

internal/infoblox/infoblox.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import (
2828
"reflect"
2929
"strconv"
3030
"strings"
31+
"time"
3132

33+
"github.com/AbsaOSS/external-dns-infoblox-webhook/internal/metrics"
3234
ibclient "github.com/infobloxopen/infoblox-go-client/v2"
3335
log "github.com/sirupsen/logrus"
3436

@@ -199,6 +201,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
199201
objA.Zone = zone.Fqdn
200202
err = PagingGetObject(p.client, objA, "", searchParams, &resA)
201203
if err != nil && !isNotFoundError(err) {
204+
metrics.FailedApiCallsTotal.Inc()
202205
return nil, fmt.Errorf("could not fetch A records from zone '%s': %w", zone.Fqdn, err)
203206
}
204207
endpointsA := ToAResponseMap(resA).ToEndpoints()
@@ -212,6 +215,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
212215
objH.Zone = zone.Fqdn
213216
err = PagingGetObject(p.client, objH, "", searchParams, &resH)
214217
if err != nil && !isNotFoundError(err) {
218+
metrics.FailedApiCallsTotal.Inc()
215219
return nil, fmt.Errorf("could not fetch host records from zone '%s': %w", zone.Fqdn, err)
216220
}
217221
endpointsHost := ToHostResponseMap(resH).ToEndpoints()
@@ -224,6 +228,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
224228
objC.Zone = zone.Fqdn
225229
err = PagingGetObject(p.client, objC, "", searchParams, &resC)
226230
if err != nil && !isNotFoundError(err) {
231+
metrics.FailedApiCallsTotal.Inc()
227232
return nil, fmt.Errorf("could not fetch CNAME records from zone '%s': %w", zone.Fqdn, err)
228233
}
229234
endpointsCNAME := ToCNAMEResponseMap(resC).ToEndpoints()
@@ -236,6 +241,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
236241
objT.Zone = zone.Fqdn
237242
err = PagingGetObject(p.client, objT, "", searchParams, &resT)
238243
if err != nil && !isNotFoundError(err) {
244+
metrics.FailedApiCallsTotal.Inc()
239245
return nil, fmt.Errorf("could not fetch TXT records from zone '%s': %w", zone.Fqdn, err)
240246
}
241247
endpointsTXT := ToTXTResponseMap(resT).ToEndpoints()
@@ -247,6 +253,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
247253
objNS.Zone = zone.Fqdn
248254
err = PagingGetObject(p.client, objNS, "", searchParams, &resNS)
249255
if err != nil && !isNotFoundError(err) {
256+
metrics.FailedApiCallsTotal.Inc()
250257
return nil, fmt.Errorf("could not fetch NS records from zone '%s': %w", zone.Fqdn, err)
251258
}
252259
endpointsNS := ToNSResponseMap(resNS).ToEndpoints()
@@ -262,6 +269,7 @@ func (p *Provider) Records(_ context.Context) (endpoints []*endpoint.Endpoint, e
262269
objP.Zone = arpaZone
263270
err = PagingGetObject(p.client, objP, "", map[string]string{"zone": arpaZone, "view": p.config.View}, &resP)
264271
if err != nil && !isNotFoundError(err) {
272+
metrics.FailedApiCallsTotal.Inc()
265273
return nil, fmt.Errorf("could not fetch PTR records from zone '%s': %w", zone.Fqdn, err)
266274
}
267275
endpointsPTR := ToPTRResponseMap(resP).ToEndpoints()
@@ -371,6 +379,7 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error {
371379

372380
zones, err := p.zones()
373381
if err != nil {
382+
metrics.FailedApiCallsTotal.Inc()
374383
return fmt.Errorf("could not fetch zones: %w", err)
375384
}
376385

@@ -399,14 +408,24 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error {
399408

400409
log.WithFields(logFields).Info("Changing record")
401410
var actionErr error
411+
startTime := time.Now()
402412

403413
switch change.Action {
404414
case infobloxCreate:
405415
_, actionErr = p.client.CreateObject(record.obj)
416+
duration := time.Since(startTime)
417+
metrics.ApiCallLatency.WithLabelValues("GetObject").Observe(duration.Seconds())
418+
metrics.TotalApiCalls.Inc()
406419
case infobloxDelete:
407420
_, actionErr = p.client.DeleteObject(refId)
421+
duration := time.Since(startTime)
422+
metrics.ApiCallLatency.WithLabelValues("DeleteObject").Observe(duration.Seconds())
423+
metrics.TotalApiCalls.Inc()
408424
case infobloxUpdate:
409425
_, actionErr = p.client.UpdateObject(record.obj, refId)
426+
duration := time.Since(startTime)
427+
metrics.ApiCallLatency.WithLabelValues("UpdateObject").Observe(duration.Seconds())
428+
metrics.TotalApiCalls.Inc()
410429
default:
411430
actionErr = fmt.Errorf("unknown action '%s'", change.Action)
412431
}
@@ -600,6 +619,7 @@ func (p *Provider) zones() ([]ibclient.ZoneAuth, error) {
600619
}
601620
err := PagingGetObject(p.client, obj, "", searchFields, &res)
602621
if err != nil && !isNotFoundError(err) {
622+
metrics.FailedApiCallsTotal.Inc()
603623
return nil, err
604624
}
605625

@@ -695,13 +715,15 @@ func (p *Provider) findReverseZone(zones []*ibclient.ZoneAuth, name string) *ibc
695715

696716
func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet infobloxRecordSet, err error) {
697717
var ttl uint32
718+
var startTime time.Time
698719
if ep.RecordTTL.IsConfigured() {
699720
ttl = uint32(ep.RecordTTL)
700721
}
701722
extAttrs, err := deserializeEAs(p.config.ExtAttrsJSON)
702723
if err != nil {
703724
return
704725
}
726+
startTime = time.Now()
705727
ptrToBoolTrue := true
706728
switch ep.RecordType {
707729
case endpoint.RecordTypeA:
@@ -716,10 +738,14 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
716738
if getObject {
717739
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name, "ipv4addr": *obj.Ipv4Addr})
718740
err = p.client.GetObject(obj, "", queryParams, &res)
741+
duration := time.Since(startTime)
742+
metrics.TotalApiCalls.Inc()
719743
if err != nil && !isNotFoundError(err) {
744+
metrics.FailedApiCallsTotal.Inc()
720745
err = fmt.Errorf("could not fetch A record ['%s':'%s'] : %w", *obj.Name, *obj.Ipv4Addr, err)
721746
return
722747
}
748+
metrics.ApiCallLatency.WithLabelValues("GetObjectA").Observe(duration.Seconds())
723749
} else {
724750
// If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
725751
// If View is set for the other actions, Infoblox will complain that the view field is not allowed
@@ -741,9 +767,14 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
741767
if getObject {
742768
queryParams := ibclient.NewQueryParams(false, map[string]string{"ptrdname": *obj.PtrdName, "ipv4addr": *obj.Ipv4Addr})
743769
err = p.client.GetObject(obj, "", queryParams, &res)
770+
duration := time.Since(startTime)
771+
metrics.TotalApiCalls.Inc()
744772
if err != nil && !isNotFoundError(err) {
773+
metrics.FailedApiCallsTotal.Inc()
745774
return
746775
}
776+
metrics.ApiCallLatency.WithLabelValues("GetObjectPTR").Observe(duration.Seconds())
777+
747778
} else {
748779
// If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
749780
// If View is set for the other actions, Infoblox will complain that the view field is not allowed
@@ -764,9 +795,13 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
764795
if getObject {
765796
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name})
766797
err = p.client.GetObject(obj, "", queryParams, &res)
798+
duration := time.Since(startTime)
799+
metrics.TotalApiCalls.Inc()
767800
if err != nil && !isNotFoundError(err) {
801+
metrics.FailedApiCallsTotal.Inc()
768802
return
769803
}
804+
metrics.ApiCallLatency.WithLabelValues("GetObjectCNAME").Observe(duration.Seconds())
770805
} else {
771806
// If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
772807
// If View is set for the other actions, Infoblox will complain that the view field is not allowed
@@ -784,9 +819,13 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
784819
if getObject {
785820
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.Name})
786821
err = p.client.GetObject(obj, "", queryParams, &res)
822+
duration := time.Since(startTime)
823+
metrics.TotalApiCalls.Inc()
787824
if err != nil && !isNotFoundError(err) {
825+
metrics.FailedApiCallsTotal.Inc()
788826
return
789827
}
828+
metrics.ApiCallLatency.WithLabelValues("GetObjectNS").Observe(duration.Seconds())
790829
} else {
791830
// If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
792831
// If View is set for the other actions, Infoblox will complain that the view field is not allowed
@@ -813,9 +852,13 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
813852
if getObject {
814853
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name})
815854
err = p.client.GetObject(obj, "", queryParams, &res)
855+
duration := time.Since(startTime)
856+
metrics.TotalApiCalls.Inc()
816857
if err != nil && !isNotFoundError(err) {
858+
metrics.FailedApiCallsTotal.Inc()
817859
return
818860
}
861+
metrics.ApiCallLatency.WithLabelValues("GetObjectTXT").Observe(duration.Seconds())
819862
} else {
820863
// If getObject is not set (action == create), we need to set the View for Infoblox to find the parent zone
821864
// If View is set for the other actions, Infoblox will complain that the view field is not allowed

internal/infoblox/paging_ibclient.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"reflect"
2424

25+
"github.com/AbsaOSS/external-dns-infoblox-webhook/internal/metrics"
2526
ibclient "github.com/infobloxopen/infoblox-go-client/v2"
2627
)
2728

@@ -50,6 +51,7 @@ func PagingGetObject[T any](
5051

5152
err = c.GetObject(obj, "", ibclient.NewQueryParams(false, queryParamsCopy), &pagingResponse)
5253
if err != nil {
54+
metrics.FailedApiCallsTotal.Inc()
5355
return fmt.Errorf("could not fetch object: %s", err)
5456
} else {
5557
*res = append(*res, pagingResponse.Result...)
@@ -63,6 +65,7 @@ func PagingGetObject[T any](
6365
pagingResponse.NextPageId = ""
6466
pagingResponse.Result = make([]T, 0)
6567
err = c.GetObject(obj, "", ibclient.NewQueryParams(false, queryParamsCopy), &pagingResponse)
68+
metrics.TotalApiCalls.Inc()
6669
if err != nil {
6770
return fmt.Errorf("could not fetch object: %s", err)
6871
}

internal/metrics/metrics.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package metrics
2+
3+
/*
4+
Copyright 2024 The external-dns-infoblox-webhook Contributors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
19+
*/
20+
21+
import (
22+
"github.com/prometheus/client_golang/prometheus"
23+
)
24+
25+
var (
26+
FailedApiCallsTotal = prometheus.NewCounter(prometheus.CounterOpts{
27+
Name: "external_dns_webhook_failed_api_calls_total",
28+
Help: "Total number of failed API calls",
29+
})
30+
TotalApiCalls = prometheus.NewCounter(prometheus.CounterOpts{
31+
Name: "external_dns_webhook_total_api_calls",
32+
Help: "Total number of API calls",
33+
})
34+
35+
ApiCallLatency = prometheus.NewSummaryVec(prometheus.SummaryOpts{
36+
Name: "external_dns_webhook_api_call_latency_seconds",
37+
Help: "Latency of Infoblox API calls",
38+
}, []string{"method"}) // method label to differentiate API calls
39+
)
40+
41+
func init() {
42+
prometheus.MustRegister(FailedApiCallsTotal, ApiCallLatency, TotalApiCalls)
43+
}

0 commit comments

Comments
 (0)