Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect Prometheus Go process metrics #2101

Merged
merged 2 commits into from
Dec 9, 2021

Conversation

guscarreon
Copy link
Contributor

This pull request modifies Prebid Server's Prometheus metrics adapter. It adds the ability to collect data about the system's Go process such as memory stats that Prometheus' GoCollector provides (documentation of Prometheus GoCollector here). In a similar fashion to Prebid Server custom-defined metrics, these newly added Go process metrics will also come prefixed with prebid_server_.

Prometheus endpoint output after changes implemented in this PR:

   # TYPE prebid_server_account_cache_performance counter
   prebid_server_account_cache_performance{cache_result="hit"} 0
   prebid_server_account_cache_performance{cache_result="miss"} 0
   # HELP prebid_server_adapter_bids Count of bids labeled by adapter and markup delivery type (adm or nurl).
   # TYPE prebid_server_adapter_bids counter
   prebid_server_adapter_bids{adapter="33across",delivery="adm"} 0
   prebid_server_adapter_bids{adapter="33across",delivery="nurl"} 0
      .
      .
   prebid_server_dns_lookup_time_bucket{le="+Inf"} 0
   prebid_server_dns_lookup_time_sum 0
   prebid_server_dns_lookup_time_count 0
 + # HELP prebid_server_go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
 + # TYPE prebid_server_go_gc_duration_seconds summary
 + prebid_server_go_gc_duration_seconds{quantile="0"} 3.1718e-05
 + prebid_server_go_gc_duration_seconds{quantile="0.25"} 3.4872e-05
 + prebid_server_go_gc_duration_seconds{quantile="0.5"} 4.7144e-05
 + prebid_server_go_gc_duration_seconds{quantile="0.75"} 5.0752e-05
 + prebid_server_go_gc_duration_seconds{quantile="1"} 7.2693e-05
 + prebid_server_go_gc_duration_seconds_sum 0.000430668
 + prebid_server_go_gc_duration_seconds_count 9
 + # HELP prebid_server_go_goroutines Number of goroutines that currently exist.
 + # TYPE prebid_server_go_goroutines gauge
 + prebid_server_go_goroutines 19
 + # HELP prebid_server_go_info Information about the Go environment.
 + # TYPE prebid_server_go_info gauge
 + prebid_server_go_info{version="go1.15.7"} 1
 + # HELP prebid_server_go_memstats_alloc_bytes Number of bytes allocated and still in use.
 + # TYPE prebid_server_go_memstats_alloc_bytes gauge
 + prebid_server_go_memstats_alloc_bytes 8.239408e+06
 + # HELP prebid_server_go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
 + # TYPE prebid_server_go_memstats_alloc_bytes_total counter
 + prebid_server_go_memstats_alloc_bytes_total 2.5249528e+07
 + # HELP prebid_server_go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
 + # TYPE prebid_server_go_memstats_buck_hash_sys_bytes gauge
 + prebid_server_go_memstats_buck_hash_sys_bytes 1.453995e+06
 + # HELP prebid_server_go_memstats_frees_total Total number of frees.
 + # TYPE prebid_server_go_memstats_frees_total counter
 + prebid_server_go_memstats_frees_total 330332
 + # HELP prebid_server_go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
 + # TYPE prebid_server_go_memstats_gc_cpu_fraction gauge
 + prebid_server_go_memstats_gc_cpu_fraction 0.004450995461694631
 + # HELP prebid_server_go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
 + # TYPE prebid_server_go_memstats_gc_sys_bytes gauge
 + prebid_server_go_memstats_gc_sys_bytes 5.556832e+06
 + # HELP prebid_server_go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
 + # TYPE prebid_server_go_memstats_heap_alloc_bytes gauge
 + prebid_server_go_memstats_heap_alloc_bytes 8.239408e+06
 + # HELP prebid_server_go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
 + # TYPE prebid_server_go_memstats_heap_idle_bytes gauge
 + prebid_server_go_memstats_heap_idle_bytes 5.5730176e+07
 + # HELP prebid_server_go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
 + # TYPE prebid_server_go_memstats_heap_inuse_bytes gauge
 + prebid_server_go_memstats_heap_inuse_bytes 1.0395648e+07
 + # HELP prebid_server_go_memstats_heap_objects Number of allocated objects.
 + # TYPE prebid_server_go_memstats_heap_objects gauge
 + prebid_server_go_memstats_heap_objects 83762
 + # HELP prebid_server_go_memstats_heap_released_bytes Number of heap bytes released to OS.
 + # TYPE prebid_server_go_memstats_heap_released_bytes gauge
 + prebid_server_go_memstats_heap_released_bytes 5.5558144e+07
 + # HELP prebid_server_go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
 + # TYPE prebid_server_go_memstats_heap_sys_bytes gauge
 + prebid_server_go_memstats_heap_sys_bytes 6.6125824e+07
 + # HELP prebid_server_go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
 + # TYPE prebid_server_go_memstats_last_gc_time_seconds gauge
 + prebid_server_go_memstats_last_gc_time_seconds 1.6384276154002712e+09
 + # HELP prebid_server_go_memstats_lookups_total Total number of pointer lookups.
 + # TYPE prebid_server_go_memstats_lookups_total counter
 + prebid_server_go_memstats_lookups_total 0
 + # HELP prebid_server_go_memstats_mallocs_total Total number of mallocs.
 + # TYPE prebid_server_go_memstats_mallocs_total counter
 + prebid_server_go_memstats_mallocs_total 414094
 + # HELP prebid_server_go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
 + # TYPE prebid_server_go_memstats_mcache_inuse_bytes gauge
 + prebid_server_go_memstats_mcache_inuse_bytes 20832
 + # HELP prebid_server_go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
 + # TYPE prebid_server_go_memstats_mcache_sys_bytes gauge
 + prebid_server_go_memstats_mcache_sys_bytes 32768
 + # HELP prebid_server_go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
 + # TYPE prebid_server_go_memstats_mspan_inuse_bytes gauge
 + prebid_server_go_memstats_mspan_inuse_bytes 235552
 + # HELP prebid_server_go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
 + # TYPE prebid_server_go_memstats_mspan_sys_bytes gauge
 + prebid_server_go_memstats_mspan_sys_bytes 245760
 + # HELP prebid_server_go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
 + # TYPE prebid_server_go_memstats_next_gc_bytes gauge
 + prebid_server_go_memstats_next_gc_bytes 1.1201072e+07
 + # HELP prebid_server_go_memstats_other_sys_bytes Number of bytes used for other system allocations.
 + # TYPE prebid_server_go_memstats_other_sys_bytes gauge
 + prebid_server_go_memstats_other_sys_bytes 2.230773e+06
 + # HELP prebid_server_go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
 + # TYPE prebid_server_go_memstats_stack_inuse_bytes gauge
 + prebid_server_go_memstats_stack_inuse_bytes 983040
 + # HELP prebid_server_go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
 + # TYPE prebid_server_go_memstats_stack_sys_bytes gauge
 + prebid_server_go_memstats_stack_sys_bytes 983040
 + # HELP prebid_server_go_memstats_sys_bytes Number of bytes obtained from system.
 + # TYPE prebid_server_go_memstats_sys_bytes gauge
 + prebid_server_go_memstats_sys_bytes 7.6628992e+07
 + # HELP prebid_server_go_threads Number of OS threads created.
 + # TYPE prebid_server_go_threads gauge
 + prebid_server_go_threads 16
   # HELP prebid_server_impressions_requests Count of requested impressions to Prebid Server labeled by type.
   # TYPE prebid_server_impressions_requests counter
   prebid_server_impressions_requests{audio="false",banner="false",native="false",video="false"} 0
   .
   .

Copy link
Contributor

@bsardo bsardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bsardo bsardo merged commit 5bb455c into prebid:master Dec 9, 2021
wwwyyy pushed a commit to wwwyyy/prebid-server that referenced this pull request Dec 20, 2021
* 'master' of https://github.com/wwwyyy/prebid-server: (23 commits)
  Add GPID Reserved Bidder Name (prebid#2107)
  Marsmedia adapter - param zoneId can get string and int (prebid#2105)
  Algorix: add Server Region Support (prebid#2096)
  New Adapter: Bizzclick (prebid#2056)
  Collect Prometheus Go process metrics (prebid#2101)
  Added channel support (prebid#2037)
  Rubicon: update fpd fields resolving (prebid#2091)
  Beachfront - Currency conversion (prebid#2078)
  New Adapter: Groupm (Alias Of PubMatic) (prebid#2042)
  Adform adapter lacked gross/net parameter support (prebid#2084)
  add iframe sync for openx (prebid#2094)
  changes to the correct user sync url (prebid#2092)
  Smaato: Add instl to tests (prebid#2089)
  Correct MakeRequests() output assertion in adapter JSON tests (prebid#2087)
  Adview: adapter currency fix. (prebid#2060)
  New Adapter: Coinzilla (prebid#2074)
  Syncer Level ExternalURL Override (prebid#2072)
  33Across: Enable Support for SRA requests (prebid#2079)
  Currency conversion on adapter JSON tests (prebid#2071)
  New Adapter: VideoByte (prebid#2058)
  ...
jorgeluisrocha pushed a commit to jwplayer/prebid-server that referenced this pull request Sep 28, 2022
shunj-nb pushed a commit to ParticleMedia/prebid-server that referenced this pull request Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants