Skip to content

Commit

Permalink
refactor data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsaks committed Dec 22, 2024
1 parent 52ed64d commit b342512
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 104 deletions.
60 changes: 30 additions & 30 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57816,7 +57816,7 @@ type: long

--

*`pgbouncer.lists.dns_names`*::
*`pgbouncer.lists.dns.names`*::
+
--
Count of DNS names in the cache.
Expand All @@ -57826,7 +57826,7 @@ type: long

--

*`pgbouncer.lists.dns_zones`*::
*`pgbouncer.lists.dns.zones`*::
+
--
Count of DNS zones in the cache.
Expand All @@ -57836,7 +57836,7 @@ type: long

--

*`pgbouncer.lists.dns_queries`*::
*`pgbouncer.lists.dns.queries`*::
+
--
Count of in-flight DNS queries.
Expand Down Expand Up @@ -58320,7 +58320,7 @@ type: keyword

--

*`pgbouncer.pools.cl_active`*::
*`pgbouncer.pools.client.active`*::
+
--
Client connections that are either linked to server connections or are idle with no queries waiting to be processed.
Expand All @@ -58330,7 +58330,7 @@ type: long

--

*`pgbouncer.pools.cl_waiting`*::
*`pgbouncer.pools.client.waiting`*::
+
--
Client connections that have sent queries but have not yet got a server connection.
Expand All @@ -58340,7 +58340,7 @@ type: long

--

*`pgbouncer.pools.cl_active_cancel_req`*::
*`pgbouncer.pools.client.active_cancel_req`*::
+
--
Client connections that have forwarded query cancellations to the server and are waiting for the server response.
Expand All @@ -58350,7 +58350,7 @@ type: long

--

*`pgbouncer.pools.cl_waiting_cancel_req`*::
*`pgbouncer.pools.client.waiting_cancel_req`*::
+
--
Client connections that have not forwarded query cancellations to the server yet.
Expand All @@ -58360,7 +58360,7 @@ type: long

--

*`pgbouncer.pools.sv_active`*::
*`pgbouncer.pools.server.active`*::
+
--
Server connections that are linked to a client.
Expand All @@ -58370,7 +58370,7 @@ type: long

--

*`pgbouncer.pools.sv_active_cancel`*::
*`pgbouncer.pools.server.active_cancel`*::
+
--
Server connections that are currently forwarding a cancel request.
Expand All @@ -58380,7 +58380,7 @@ type: long

--

*`pgbouncer.pools.sv_being_canceled`*::
*`pgbouncer.pools.server.being_canceled`*::
+
--
Servers that normally could become idle but are waiting to do so until all in-flight cancel requests have completed that were sent to cancel a query on this server.
Expand All @@ -58390,7 +58390,7 @@ type: long

--

*`pgbouncer.pools.sv_idle`*::
*`pgbouncer.pools.server.idle`*::
+
--
Server connections that are unused and immediately usable for client queries.
Expand All @@ -58400,7 +58400,7 @@ type: long

--

*`pgbouncer.pools.sv_used`*::
*`pgbouncer.pools.server.used`*::
+
--
Server connections that have been idle for more than server_check_delay, so they need server_check_query to run on them before they can be used again.
Expand All @@ -58410,7 +58410,7 @@ type: long

--

*`pgbouncer.pools.sv_tested`*::
*`pgbouncer.pools.server.tested`*::
+
--
Server connections that are currently running either server_reset_query or server_check_query.
Expand All @@ -58420,7 +58420,7 @@ type: long

--

*`pgbouncer.pools.sv_login`*::
*`pgbouncer.pools.server.login`*::
+
--
Server connections currently in the process of logging in.
Expand Down Expand Up @@ -58467,7 +58467,7 @@ type: keyword

--

*`pgbouncer.stats.total_query_count`*::
*`pgbouncer.stats.query_count.total`*::
+
--
Total number of SQL commands pooled by pgbouncer.
Expand All @@ -58477,7 +58477,7 @@ type: long

--

*`pgbouncer.stats.total_server_assignment_count`*::
*`pgbouncer.stats.server_assignment_count.total`*::
+
--
Total times a server was assigned to a client.
Expand All @@ -58487,7 +58487,7 @@ type: long

--

*`pgbouncer.stats.total_received`*::
*`pgbouncer.stats.received.total`*::
+
--
Total volume in bytes of network traffic received by pgbouncer.
Expand All @@ -58497,7 +58497,7 @@ type: long

--

*`pgbouncer.stats.total_sent`*::
*`pgbouncer.stats.sent.total`*::
+
--
Total volume in bytes of network traffic sent by pgbouncer.
Expand All @@ -58507,7 +58507,7 @@ type: long

--

*`pgbouncer.stats.total_xact_time`*::
*`pgbouncer.stats.xact_time.total`*::
+
--
Total number of microseconds spent by pgbouncer when connected to PostgreSQL in a transaction, either idle in transaction or executing queries.
Expand All @@ -58517,7 +58517,7 @@ type: long

--

*`pgbouncer.stats.total_query_time`*::
*`pgbouncer.stats.query_time.total`*::
+
--
Total number of microseconds spent by pgbouncer when actively connected to PostgreSQL, executing queries.
Expand All @@ -58527,7 +58527,7 @@ type: long

--

*`pgbouncer.stats.total_wait_time`*::
*`pgbouncer.stats.wait_time.total`*::
+
--
Time spent by clients waiting for a server, in microseconds. Updated when a client connection is assigned a backend connection.
Expand All @@ -58537,7 +58537,7 @@ type: long

--

*`pgbouncer.stats.total_xact_count`*::
*`pgbouncer.stats.xact_count.total`*::
+
--
Total number of SQL transactions pooled by pgbouncer.
Expand All @@ -58547,7 +58547,7 @@ type: long

--

*`pgbouncer.stats.avg_xact_count`*::
*`pgbouncer.stats.xact_count.avg`*::
+
--
Average transactions per second in last stat period.
Expand All @@ -58557,7 +58557,7 @@ type: long

--

*`pgbouncer.stats.avg_query_count`*::
*`pgbouncer.stats.query_count.avg`*::
+
--
Average queries per second in last stat period.
Expand All @@ -58567,7 +58567,7 @@ type: long

--

*`pgbouncer.stats.avg_server_assignment_count`*::
*`pgbouncer.stats.server_assignment_count.avg`*::
+
--
Average number of times a server as assigned to a client per second in the last stat period.
Expand All @@ -58577,7 +58577,7 @@ type: long

--

*`pgbouncer.stats.avg_recv`*::
*`pgbouncer.stats.recv.avg`*::
+
--
Average received (from clients) bytes per second.
Expand All @@ -58587,7 +58587,7 @@ type: long

--

*`pgbouncer.stats.avg_sent`*::
*`pgbouncer.stats.sent.avg`*::
+
--
Average sent (to clients) bytes per second.
Expand All @@ -58597,7 +58597,7 @@ type: long

--

*`pgbouncer.stats.avg_xact_time`*::
*`pgbouncer.stats.xact_time.avg`*::
+
--
Average transaction duration, in microseconds.
Expand All @@ -58607,7 +58607,7 @@ type: long

--

*`pgbouncer.stats.avg_query_time`*::
*`pgbouncer.stats.query_time.avg`*::
+
--
Average query duration, in microseconds.
Expand All @@ -58617,7 +58617,7 @@ type: long

--

*`pgbouncer.stats.avg_wait_time`*::
*`pgbouncer.stats.wait_time.avg`*::
+
--
Time spent by clients waiting for a server, in microseconds (average of the wait times for clients assigned a backend during the current stats_period).
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/pgbouncer/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions metricbeat/module/pgbouncer/lists/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
type: long
description: >
Count of used servers.
- name: dns_names
- name: dns.names
type: long
description: >
Count of DNS names in the cache.
- name: dns_zones
- name: dns.zones
type: long
description: >
Count of DNS zones in the cache.
- name: dns_queries
- name: dns.queries
type: long
description: >
Count of in-flight DNS queries.
8 changes: 5 additions & 3 deletions metricbeat/module/pgbouncer/lists/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ var schema = s.Schema{
"free": c.Int("free_servers"),
"used": c.Int("used_servers"),
},
"dns_names": c.Int("dns_names"),
"dns_zones": c.Int("dns_zones"),
"dns_queries": c.Int("dns_queries"),
"dns": s.Object{
"names": c.Int("dns_names"),
"zones": c.Int("dns_zones"),
"queries": c.Int("dns_queries"),
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestMetricSet_Fetch(t *testing.T) {
assert.Contains(t, event["clients"], "used")
assert.Contains(t, event["servers"], "free")
assert.Contains(t, event["servers"], "used")
assert.Contains(t, event["dns"], "names")
}
func getConfig(host string) map[string]interface{} {
return map[string]interface{}{
Expand Down
22 changes: 11 additions & 11 deletions metricbeat/module/pgbouncer/pools/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@
type: keyword
description: >
Name of the user.
- name: cl_active
- name: client.active
type: long
description: >
Client connections that are either linked to server connections or are idle with no queries waiting to be processed.
- name: cl_waiting
- name: client.waiting
type: long
description: >
Client connections that have sent queries but have not yet got a server connection.
- name: cl_active_cancel_req
- name: client.active_cancel_req
type: long
description: >
Client connections that have forwarded query cancellations to the server and are waiting for the server response.
- name: cl_waiting_cancel_req
- name: client.waiting_cancel_req
type: long
description: >
Client connections that have not forwarded query cancellations to the server yet.
- name: sv_active
- name: server.active
type: long
description: >
Server connections that are linked to a client.
- name: sv_active_cancel
- name: server.active_cancel
type: long
description: >
Server connections that are currently forwarding a cancel request.
- name: sv_being_canceled
- name: server.being_canceled
type: long
description: >
Servers that normally could become idle but are waiting to do so until all in-flight cancel requests have completed that were sent to cancel a query on this server.
- name: sv_idle
- name: server.idle
type: long
description: >
Server connections that are unused and immediately usable for client queries.
- name: sv_used
- name: server.used
type: long
description: >
Server connections that have been idle for more than server_check_delay, so they need server_check_query to run on them before they can be used again.
- name: sv_tested
- name: server.tested
type: long
description: >
Server connections that are currently running either server_reset_query or server_check_query.
- name: sv_login
- name: server.login
type: long
description: >
Server connections currently in the process of logging in.
Expand Down
Loading

0 comments on commit b342512

Please sign in to comment.