Skip to content

Commit cb7e2dd

Browse files
author
Christian Hergert
committed
counters: add counters for DNS resolution.
1 parent e0401bb commit cb7e2dd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/mongoc/mongoc-client.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ mongoc_client_connect_tcp (const mongoc_uri_t *uri,
118118
s = getaddrinfo (host->host, portstr, &hints, &result);
119119

120120
if (s != 0) {
121+
mongoc_counter_dns_failure_inc ();
121122
bson_set_error(error,
122123
MONGOC_ERROR_STREAM,
123124
MONGOC_ERROR_STREAM_NAME_RESOLUTION,
@@ -126,6 +127,8 @@ mongoc_client_connect_tcp (const mongoc_uri_t *uri,
126127
RETURN (NULL);
127128
}
128129

130+
mongoc_counter_dns_success_inc ();
131+
129132
for (rp = result; rp; rp = rp->ai_next) {
130133
/*
131134
* Create a new non-blocking socket.

src/mongoc/mongoc-counters.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ COUNTER(protocol_ingress_error, "Protocol", "Ingress Errors", "The numb
5959

6060
COUNTER(auth_failure, "Auth", "Failures", "The number of failed authentication requests.")
6161
COUNTER(auth_success, "Auth", "Success", "The number of successful authentication requests.")
62+
63+
64+
COUNTER(dns_failure, "DNS", "Failure", "The number of failed DNS requests.")
65+
COUNTER(dns_success, "DNS", "Success", "The number of successful DNS requests.")

0 commit comments

Comments
 (0)