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

Introduce --metrics-bind-address flag to karmada-controller-manager #1341

Merged
merged 1 commit into from
Feb 10, 2022

Conversation

pigletfly
Copy link
Contributor

@pigletfly pigletfly commented Feb 7, 2022

Signed-off-by: pigletfly [email protected]

What type of PR is this?
/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

karmada-controller-manager: Introduced `--metrics-bind-address` flag to specify the customized address for metrics.

@karmada-bot karmada-bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 7, 2022
@RainbowMango
Copy link
Member

Have you tested this patch? Is there an example for grabbing the metrics? I wonder to know what are metrics in there.

@pigletfly
Copy link
Contributor Author

@RainbowMango
Copy link
Member

Yeah, I got it:

# curl localhost:8080/metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 4.551e-05
go_gc_duration_seconds{quantile="0.25"} 4.7856e-05
go_gc_duration_seconds{quantile="0.5"} 5.1514e-05
go_gc_duration_seconds{quantile="0.75"} 7.7271e-05
go_gc_duration_seconds{quantile="1"} 0.000970289
go_gc_duration_seconds_sum 0.001708818
go_gc_duration_seconds_count 13
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 32
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.16.7"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 5.121984e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 1.957508e+07
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.45634e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 148102
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
go_memstats_gc_cpu_fraction 9.448612907731443e-06
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 5.649312e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 5.121984e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 5.849088e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 7.929856e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 34288
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 5.7843712e+07
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 6.6420736e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.6443982826349502e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 182390
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 4800
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 16384
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 127704
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 147456
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 8.72192e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 939924
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 688128
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 688128
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 7.531828e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 9
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.63
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 12
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.8512256e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.64439719837e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 7.7182976e+08
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19
# HELP rest_client_requests_total Number of HTTP requests, partitioned by status code, method, and host.
# TYPE rest_client_requests_total counter
rest_client_requests_total{code="200",host="karmada-apiserver.karmada-system.svc.cluster.local:5443",method="GET"} 424
# HELP workqueue_adds_total Total number of adds handled by workqueue
# TYPE workqueue_adds_total counter
workqueue_adds_total{name="service-export"} 0
workqueue_adds_total{name="work-status"} 0
# HELP workqueue_depth Current depth of workqueue
# TYPE workqueue_depth gauge
workqueue_depth{name="service-export"} 0
workqueue_depth{name="work-status"} 0
# HELP workqueue_longest_running_processor_seconds How many seconds has the longest running processor for workqueue been running.
# TYPE workqueue_longest_running_processor_seconds gauge
workqueue_longest_running_processor_seconds{name="service-export"} 0
workqueue_longest_running_processor_seconds{name="work-status"} 0
# HELP workqueue_queue_duration_seconds How long in seconds an item stays in workqueue before being requested
# TYPE workqueue_queue_duration_seconds histogram
workqueue_queue_duration_seconds_bucket{name="service-export",le="1e-08"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="1e-07"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="1e-06"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="9.999999999999999e-06"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="9.999999999999999e-05"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="0.001"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="0.01"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="0.1"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="1"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="10"} 0
workqueue_queue_duration_seconds_bucket{name="service-export",le="+Inf"} 0
workqueue_queue_duration_seconds_sum{name="service-export"} 0
workqueue_queue_duration_seconds_count{name="service-export"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="1e-08"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="1e-07"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="1e-06"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="9.999999999999999e-06"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="9.999999999999999e-05"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="0.001"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="0.01"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="0.1"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="1"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="10"} 0
workqueue_queue_duration_seconds_bucket{name="work-status",le="+Inf"} 0
workqueue_queue_duration_seconds_sum{name="work-status"} 0
workqueue_queue_duration_seconds_count{name="work-status"} 0
# HELP workqueue_retries_total Total number of retries handled by workqueue
# TYPE workqueue_retries_total counter
workqueue_retries_total{name="service-export"} 0
workqueue_retries_total{name="work-status"} 0
# HELP workqueue_unfinished_work_seconds How many seconds of work has been done that is in progress and hasn't been observed by work_duration. Large values indicate stuck threads. One can deduce the number of stuck threads by observing the rate at which this increases.
# TYPE workqueue_unfinished_work_seconds gauge
workqueue_unfinished_work_seconds{name="service-export"} 0
workqueue_unfinished_work_seconds{name="work-status"} 0
# HELP workqueue_work_duration_seconds How long in seconds processing an item from workqueue takes.
# TYPE workqueue_work_duration_seconds histogram
workqueue_work_duration_seconds_bucket{name="service-export",le="1e-08"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="1e-07"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="1e-06"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="9.999999999999999e-06"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="9.999999999999999e-05"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="0.001"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="0.01"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="0.1"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="1"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="10"} 0
workqueue_work_duration_seconds_bucket{name="service-export",le="+Inf"} 0
workqueue_work_duration_seconds_sum{name="service-export"} 0
workqueue_work_duration_seconds_count{name="service-export"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="1e-08"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="1e-07"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="1e-06"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="9.999999999999999e-06"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="9.999999999999999e-05"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="0.001"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="0.01"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="0.1"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="1"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="10"} 0
workqueue_work_duration_seconds_bucket{name="work-status",le="+Inf"} 0
workqueue_work_duration_seconds_sum{name="work-status"} 0
workqueue_work_duration_seconds_count{name="work-status"} 0

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

How about using the --metrics-bind-address as the flag name?

cmd/controller-manager/app/options/options.go Outdated Show resolved Hide resolved
cmd/controller-manager/app/controllermanager.go Outdated Show resolved Hide resolved
cmd/controller-manager/app/options/options.go Outdated Show resolved Hide resolved
@karmada-bot karmada-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Feb 9, 2022
@RainbowMango
Copy link
Member

/retitle Introduce --metrics-bind-address flag to karmada-controller-manager

I updated the release notes too.

@karmada-bot karmada-bot changed the title Add metrics-addr to expose prometheus metrics Introduce --metrics-bind-address flag to karmada-controller-manager Feb 9, 2022
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 10, 2022
@karmada-bot karmada-bot merged commit ca29972 into karmada-io:master Feb 10, 2022
@pigletfly pigletfly deleted the add-metrics-addr branch February 25, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants