Skip to content

fix: enable annotations #1471

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

alexcastilio
Copy link
Contributor

@alexcastilio alexcastilio commented Mar 25, 2025

Description

Feature description: when using option enableAnnotation: true advanced metrics should only be generated for pods annotated with retina.sh: observe or pods in a namespace with that annotation.

Bug: When enableAnnotation: true advanced metrics are still being generated for all pods.

Fix:

  • add filtering to metrics module based on IPs stored on its cache
  • fixed documentation to reflect current behavior (kube-system namespace is not generating metrics by default)

Related Issue

x

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Namespace without annotation:
image

Retina agent logs before annotating:
image

Retina agent metrics before annotation:

# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000141203
go_gc_duration_seconds{quantile="0.25"} 0.000247904
go_gc_duration_seconds{quantile="0.5"} 0.000366208
go_gc_duration_seconds{quantile="0.75"} 0.00056051
go_gc_duration_seconds{quantile="1"} 0.001654131
go_gc_duration_seconds_sum 0.018364692
go_gc_duration_seconds_count 38
# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function. Sourced from /gc/gogc:percent.
# TYPE go_gc_gogc_percent gauge
go_gc_gogc_percent 100
# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function. Sourced from /gc/gomemlimit:bytes.
# TYPE go_gc_gomemlimit_bytes gauge
go_gc_gomemlimit_bytes 9.223372036854776e+18
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 110
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.24.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 5.6582616e+07
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 2.085932904e+09
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.764249e+06
# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 1.7801147e+07
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 4.926152e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 5.6582616e+07
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 6.6658304e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 6.8345856e+07
# HELP go_memstats_heap_objects Number of currently allocated objects. Equals to /gc/heap/objects:objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 411633
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 8.716288e+06
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 1.3500416e+08
# 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.7455675433045332e+09
# HELP go_memstats_mallocs_total Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 1.821278e+07
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 77312
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 78520
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 1.15792e+06
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 1.7952e+06
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 1.22507786e+08
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 8.905972e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 3.407872e+06
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 3.407872e+06
# HELP go_memstats_sys_bytes Number of bytes obtained from system. Equals to /memory/classes/total:byte.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 1.55882125e+08
# HELP go_sched_gomaxprocs_threads The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously. Sourced from /sched/gomaxprocs:threads.
# TYPE go_sched_gomaxprocs_threads gauge
go_sched_gomaxprocs_threads 64
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 59
# HELP networkobservability_adv_node_apiserver_latency Latency of node apiserver in ms
# TYPE networkobservability_adv_node_apiserver_latency histogram
networkobservability_adv_node_apiserver_latency_bucket{le="0"} 4668
networkobservability_adv_node_apiserver_latency_bucket{le="0.5"} 4668
networkobservability_adv_node_apiserver_latency_bucket{le="1"} 5220
networkobservability_adv_node_apiserver_latency_bucket{le="1.5"} 5220
networkobservability_adv_node_apiserver_latency_bucket{le="2"} 5610
networkobservability_adv_node_apiserver_latency_bucket{le="2.5"} 5610
networkobservability_adv_node_apiserver_latency_bucket{le="3"} 5778
networkobservability_adv_node_apiserver_latency_bucket{le="3.5"} 5778
networkobservability_adv_node_apiserver_latency_bucket{le="4"} 5844
networkobservability_adv_node_apiserver_latency_bucket{le="4.5"} 5844
networkobservability_adv_node_apiserver_latency_bucket{le="+Inf"} 9225
networkobservability_adv_node_apiserver_latency_sum 14980
networkobservability_adv_node_apiserver_latency_count 9225
# HELP networkobservability_adv_node_apiserver_no_response Number of packets that did not get a response from node apiserver
# TYPE networkobservability_adv_node_apiserver_no_response counter
networkobservability_adv_node_apiserver_no_response{no_response="no_response"} 3877
# HELP networkobservability_adv_node_apiserver_tcp_handshake_latency Latency of node apiserver tcp handshake in ms
# TYPE networkobservability_adv_node_apiserver_tcp_handshake_latency histogram
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="0"} 0
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="0.5"} 0
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="1"} 8
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="1.5"} 8
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="2"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="2.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="3"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="3.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="4"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="4.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="+Inf"} 13
networkobservability_adv_node_apiserver_tcp_handshake_latency_sum 31
networkobservability_adv_node_apiserver_tcp_handshake_latency_count 13
# HELP networkobservability_dns_request_count DNS requests by statistics
# TYPE networkobservability_dns_request_count counter
networkobservability_dns_request_count 1192
# HELP networkobservability_dns_response_count DNS responses by statistics
# TYPE networkobservability_dns_response_count counter
networkobservability_dns_response_count 636
# HELP networkobservability_forward_bytes Total forwarded bytes
# TYPE networkobservability_forward_bytes gauge
networkobservability_forward_bytes{direction="egress"} 2.43025672e+08
networkobservability_forward_bytes{direction="ingress"} 3.16481913e+08
# HELP networkobservability_forward_count Total forwarded packets
# TYPE networkobservability_forward_count gauge
networkobservability_forward_count{direction="egress"} 231234
networkobservability_forward_count{direction="ingress"} 199584
# HELP networkobservability_tcp_connection_remote Number of active TCP connections by remote address
# TYPE networkobservability_tcp_connection_remote gauge
networkobservability_tcp_connection_remote{address="AllIPs"} 172
# HELP networkobservability_tcp_connection_stats TCP connections statistics
# TYPE networkobservability_tcp_connection_stats gauge
networkobservability_tcp_connection_stats{statistic_name="TCPLossProbes"} 133
networkobservability_tcp_connection_stats{statistic_name="TCPLostRetransmit"} 27
networkobservability_tcp_connection_stats{statistic_name="TCPTimeouts"} 41
# HELP networkobservability_tcp_state Number of active TCP connections by state
# TYPE networkobservability_tcp_state gauge
networkobservability_tcp_state{state="ESTABLISHED"} 12
networkobservability_tcp_state{state="LISTEN"} 12
networkobservability_tcp_state{state="TIME_WAIT"} 148
# HELP networkobservability_udp_connection_stats UDP connections statistics
# TYPE networkobservability_udp_connection_stats gauge
networkobservability_udp_connection_stats{statistic_name="ACTIVE"} 3
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 63.71
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_network_receive_bytes_total Number of bytes received by the process over the network.
# TYPE process_network_receive_bytes_total counter
process_network_receive_bytes_total 1.2352170602e+10
# HELP process_network_transmit_bytes_total Number of bytes sent by the process over the network.
# TYPE process_network_transmit_bytes_total counter
process_network_transmit_bytes_total 2.0733816371e+10
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 261
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.61210112e+08
# 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.74556519627e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 4.439564288e+09
# 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

Annotation added:
image

Retina agent logs after annotation: image

Retina agent metrics after annotation:

# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000141203
go_gc_duration_seconds{quantile="0.25"} 0.000264406
go_gc_duration_seconds{quantile="0.5"} 0.000361608
go_gc_duration_seconds{quantile="0.75"} 0.00056051
go_gc_duration_seconds{quantile="1"} 0.001654131
go_gc_duration_seconds_sum 0.019019104
go_gc_duration_seconds_count 40
# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function. Sourced from /gc/gogc:percent.
# TYPE go_gc_gogc_percent gauge
go_gc_gogc_percent 100
# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function. Sourced from /gc/gomemlimit:bytes.
# TYPE go_gc_gomemlimit_bytes gauge
go_gc_gomemlimit_bytes 9.223372036854776e+18
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 109
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.24.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 6.0938608e+07
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 2.212964048e+09
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.766641e+06
# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 1.8884729e+07
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 4.926152e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 6.0938608e+07
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 6.4036864e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 7.0836224e+07
# HELP go_memstats_heap_objects Number of currently allocated objects. Equals to /gc/heap/objects:objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 456008
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 1.0272768e+07
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 1.34873088e+08
# 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.7455676821034563e+09
# HELP go_memstats_mallocs_total Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 1.9340737e+07
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 77312
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 78520
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 1.17056e+06
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 1.7952e+06
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 1.1677089e+08
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 8.90358e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 3.538944e+06
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 3.538944e+06
# HELP go_memstats_sys_bytes Number of bytes obtained from system. Equals to /memory/classes/total:byte.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 1.55882125e+08
# HELP go_sched_gomaxprocs_threads The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously. Sourced from /sched/gomaxprocs:threads.
# TYPE go_sched_gomaxprocs_threads gauge
go_sched_gomaxprocs_threads 64
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 59
# HELP networkobservability_adv_forward_bytes Total number of forwarded bytes
# TYPE networkobservability_adv_forward_bytes gauge
networkobservability_adv_forward_bytes{direction="egress",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 6250
networkobservability_adv_forward_bytes{direction="ingress",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 6934
# HELP networkobservability_adv_forward_count Total number of forwarded packets
# TYPE networkobservability_adv_forward_count gauge
networkobservability_adv_forward_count{direction="egress",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 63
networkobservability_adv_forward_count{direction="ingress",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 70
# HELP networkobservability_adv_node_apiserver_latency Latency of node apiserver in ms
# TYPE networkobservability_adv_node_apiserver_latency histogram
networkobservability_adv_node_apiserver_latency_bucket{le="0"} 4977
networkobservability_adv_node_apiserver_latency_bucket{le="0.5"} 4977
networkobservability_adv_node_apiserver_latency_bucket{le="1"} 5567
networkobservability_adv_node_apiserver_latency_bucket{le="1.5"} 5567
networkobservability_adv_node_apiserver_latency_bucket{le="2"} 5981
networkobservability_adv_node_apiserver_latency_bucket{le="2.5"} 5981
networkobservability_adv_node_apiserver_latency_bucket{le="3"} 6171
networkobservability_adv_node_apiserver_latency_bucket{le="3.5"} 6171
networkobservability_adv_node_apiserver_latency_bucket{le="4"} 6243
networkobservability_adv_node_apiserver_latency_bucket{le="4.5"} 6243
networkobservability_adv_node_apiserver_latency_bucket{le="+Inf"} 9873
networkobservability_adv_node_apiserver_latency_sum 18792
networkobservability_adv_node_apiserver_latency_count 9873
# HELP networkobservability_adv_node_apiserver_no_response Number of packets that did not get a response from node apiserver
# TYPE networkobservability_adv_node_apiserver_no_response counter
networkobservability_adv_node_apiserver_no_response{no_response="no_response"} 4120
# HELP networkobservability_adv_node_apiserver_tcp_handshake_latency Latency of node apiserver tcp handshake in ms
# TYPE networkobservability_adv_node_apiserver_tcp_handshake_latency histogram
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="0"} 0
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="0.5"} 0
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="1"} 8
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="1.5"} 8
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="2"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="2.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="3"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="3.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="4"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="4.5"} 12
networkobservability_adv_node_apiserver_tcp_handshake_latency_bucket{le="+Inf"} 13
networkobservability_adv_node_apiserver_tcp_handshake_latency_sum 31
networkobservability_adv_node_apiserver_tcp_handshake_latency_count 13
# HELP networkobservability_adv_tcpflags_count Total number of packets by TCP flag
# TYPE networkobservability_adv_tcpflags_count gauge
networkobservability_adv_tcpflags_count{flag="ACK",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 113
networkobservability_adv_tcpflags_count{flag="FIN",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 20
networkobservability_adv_tcpflags_count{flag="PSH",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 34
networkobservability_adv_tcpflags_count{flag="SYN",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 10
networkobservability_adv_tcpflags_count{flag="SYNACK",ip="100.64.9.173",namespace="kube-system",podname="retina-operator-bffb4569f-4sllj",workload_kind="ReplicaSet",workload_name="retina-operator-bffb4569f"} 10
# HELP networkobservability_dns_request_count DNS requests by statistics
# TYPE networkobservability_dns_request_count counter
networkobservability_dns_request_count 1312
# HELP networkobservability_dns_response_count DNS responses by statistics
# TYPE networkobservability_dns_response_count counter
networkobservability_dns_response_count 706
# HELP networkobservability_forward_bytes Total forwarded bytes
# TYPE networkobservability_forward_bytes gauge
networkobservability_forward_bytes{direction="egress"} 2.57174993e+08
networkobservability_forward_bytes{direction="ingress"} 3.35559404e+08
# HELP networkobservability_forward_count Total forwarded packets
# TYPE networkobservability_forward_count gauge
networkobservability_forward_count{direction="egress"} 245323
networkobservability_forward_count{direction="ingress"} 211809
# HELP networkobservability_tcp_connection_remote Number of active TCP connections by remote address
# TYPE networkobservability_tcp_connection_remote gauge
networkobservability_tcp_connection_remote{address="AllIPs"} 179
# HELP networkobservability_tcp_connection_stats TCP connections statistics
# TYPE networkobservability_tcp_connection_stats gauge
networkobservability_tcp_connection_stats{statistic_name="TCPLossProbes"} 133
networkobservability_tcp_connection_stats{statistic_name="TCPLostRetransmit"} 27
networkobservability_tcp_connection_stats{statistic_name="TCPTimeouts"} 41
# HELP networkobservability_tcp_state Number of active TCP connections by state
# TYPE networkobservability_tcp_state gauge
networkobservability_tcp_state{state="ESTABLISHED"} 14
networkobservability_tcp_state{state="LISTEN"} 12
networkobservability_tcp_state{state="TIME_WAIT"} 153
# HELP networkobservability_udp_connection_stats UDP connections statistics
# TYPE networkobservability_udp_connection_stats gauge
networkobservability_udp_connection_stats{statistic_name="ACTIVE"} 3
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 67.59
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_network_receive_bytes_total Number of bytes received by the process over the network.
# TYPE process_network_receive_bytes_total counter
process_network_receive_bytes_total 1.2362491689e+10
# HELP process_network_transmit_bytes_total Number of bytes sent by the process over the network.
# TYPE process_network_transmit_bytes_total counter
process_network_transmit_bytes_total 2.0755089749e+10
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 261
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.59534848e+08
# 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.74556519627e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 4.439564288e+09
# 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

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@alexcastilio alexcastilio requested a review from a team as a code owner March 25, 2025 09:41
@alexcastilio alexcastilio force-pushed the alexcastilio/enable-annotations branch 2 times, most recently from 692e884 to 88bc343 Compare March 25, 2025 10:21
@alexcastilio alexcastilio force-pushed the alexcastilio/enable-annotations branch from 9391a97 to 1118da4 Compare April 11, 2025 11:25
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
…y default

Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
@alexcastilio alexcastilio force-pushed the alexcastilio/enable-annotations branch from 1118da4 to feffe34 Compare April 11, 2025 11:30
@vakalapa
Copy link
Contributor

Can we have a testing done section ?

@alexcastilio
Copy link
Contributor Author

Can we have a testing done section ?

@vakalapa PR description updated with test details.

@@ -108,6 +108,9 @@ type Module struct {

// pubsub subscription uuid
pubsubPodSub string

// resetRegistry is the function to reset the registry
resetRegistry func(*Module, []api.MetricsContextOptions)
Copy link
Member

Choose a reason for hiding this comment

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

curious as to why we're using resetRegistry as an anonymous function and not a method? the usage seems to pass the pointer receiver as it is

Suggested change
resetRegistry func(*Module, []api.MetricsContextOptions)
func (m *Module)resetRegistry(contextOptions []api.MetricsContextOptions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resetRegistry is a function that receives *Module and resets it's registry. Originally there's some logic in the function with its own dependencies that is not needed in the test. I don't want to consider m.daemonConfig, ctxType, naming logic and functions for creating specific metrics for resetting registry in my test.

There's a test to check generation of advanced metrics. For that, I want to validate the creation of metrics without following the original logic of resetting registry. So I only want to provide a simple way of registry reset:

resetRegistry: func(m *Module, _ []api.MetricsContextOptions) {
m.registry[mockMetricName] = myMockMetric
myMockMetric.Init(mockMetricName)
},

If it was a method, this would be way more complex.

Copy link
Member

Choose a reason for hiding this comment

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

In my opinion, mixing and matching CRUD operation patterns here is a slight code smell, especially when reading (m *Module) updateMetricsContexts where we have both

	exporter.ResetAdvancedMetricsRegistry()
...
	resetRegistry(m, spec.ContextOptions)

Performing reset operations. Can we not perform any noop dependency injection to match the rest of metricsmodule?

Copy link
Contributor Author

@alexcastilio alexcastilio May 29, 2025

Choose a reason for hiding this comment

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

@matmerr I think now I know what you mean. I have changed resetRegistry to RegistryResetter interface:

m.registryResetter.Reset(spec.ContextOptions)

Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
@alexcastilio alexcastilio requested a review from matmerr May 9, 2025 14:54
@alexcastilio alexcastilio requested a review from vakalapa May 16, 2025 10:53
vakalapa
vakalapa previously approved these changes May 16, 2025
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
@alexcastilio alexcastilio force-pushed the alexcastilio/enable-annotations branch from c836caa to 02b33d1 Compare May 29, 2025 13:58
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.

6 participants