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

feat: enable TcpClient metrics #298

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

rxdcxdrnine
Copy link
Contributor

Motivation:
cannot check if LoopResources event loop has pending tasks with metrics.

Modification:
add TcpClient.metrics(true) with if statements, check if micrometer is available.

Result:
expose the metrics of LoopResources including reactor_netty_event_loop_pending_tasks.
The following is a list of metrics exposed when the commit was applied (with default TcpResources)

reactor_netty_eventloop_pending_tasks{name="reactor-tcp-nio-4"} 0.0
reactor_netty_eventloop_pending_tasks{name="reactor-tcp-nio-5"} 0.0
reactor_netty_eventloop_pending_tasks{name="reactor-tcp-nio-6"} 0.0
reactor_netty_eventloop_pending_tasks{name="reactor-tcp-nio-7"} 0.0
reactor_netty_eventloop_pending_tasks{name="reactor-tcp-nio-8"} 0.0
reactor_netty_tcp_client_address_resolver_seconds_count{remote_address="localhost:64921",status="SUCCESS"} 100
reactor_netty_tcp_client_address_resolver_seconds_sum{remote_address="localhost:64921",status="SUCCESS"} 1.095592293
reactor_netty_tcp_client_address_resolver_seconds_max{remote_address="localhost:64921",status="SUCCESS"} 0.01396475
reactor_netty_tcp_client_connect_time_seconds_count{proxy_address="na",remote_address="localhost:64921",status="SUCCESS"} 100
reactor_netty_tcp_client_connect_time_seconds_sum{proxy_address="na",remote_address="localhost:64921",status="SUCCESS"} 3.49526084
reactor_netty_tcp_client_connect_time_seconds_max{proxy_address="na",remote_address="localhost:64921",status="SUCCESS"} 0.039677708
reactor_netty_tcp_client_data_received_bytes_count{proxy_address="na",remote_address="localhost:64921",uri="tcp"} 814
reactor_netty_tcp_client_data_received_bytes_sum{proxy_address="na",remote_address="localhost:64921",uri="tcp"} 325900.0
reactor_netty_tcp_client_data_received_bytes_max{proxy_address="na",remote_address="localhost:64921",uri="tcp"} 2048.0
reactor_netty_tcp_client_data_sent_bytes_count{proxy_address="na",remote_address="localhost:64921",uri="tcp"} 1200
reactor_netty_tcp_client_data_sent_bytes_sum{proxy_address="na",remote_address="localhost:64921",uri="tcp"} 108700.0

@rxdcxdrnine rxdcxdrnine changed the title enable TcpClient metrics feat: enable TcpClient metrics Jan 18, 2025
@jchrys jchrys added this to the 1.3.2 milestone Jan 18, 2025
@jchrys jchrys added the enhancement New feature or request label Jan 18, 2025
@jchrys jchrys self-assigned this Jan 18, 2025
@rxdcxdrnine
Copy link
Contributor Author

@jchrys
I added property named metrics in MysqlConnectionConfiguration.

  • define property as primitive type for setting the default value with false.
  • if you call Builder.metrics() without micrometer-core dependency, throw IllegalArgumentException for fast fail.

Thanks!

@rxdcxdrnine rxdcxdrnine requested a review from jchrys January 23, 2025 02:54
Copy link
Collaborator

@jchrys jchrys left a comment

Choose a reason for hiding this comment

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

@rxdcxdrnine Thanks a lot!

@jchrys
Copy link
Collaborator

jchrys commented Jan 23, 2025

@rxdcxdrnine To maintain a clean and concise commit history, could you please squash your commits into a single one?

@rxdcxdrnine rxdcxdrnine force-pushed the expose_tcp_client_metrics branch from 727f2b7 to 6539914 Compare January 23, 2025 19:31
@rxdcxdrnine
Copy link
Contributor Author

@jchrys
I squashed commits and force pushed to this branch.

Copy link
Collaborator

@jchrys jchrys left a comment

Choose a reason for hiding this comment

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

LGTM

@jchrys jchrys merged commit d285439 into asyncer-io:trunk Jan 23, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants