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

*: add metrics to prometheus #79

Merged
merged 6 commits into from
Sep 13, 2022
Merged

*: add metrics to prometheus #79

merged 6 commits into from
Sep 13, 2022

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented Sep 9, 2022

What problem does this PR solve?

Issue Number: close None

Problem Summary:
Add metrics to prometheus. This doesn't include grafana.

What is changed and how it works:
Add metrics to prometheus.
StartMonitor and pushMetric are copied from TiDB. pushMetric pushes the metrics to the address specified in the configurations.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Open 3080/api/metrics and you'll see:

# HELP weirproxy_balance_b_conn Number of backend connections.
# TYPE weirproxy_balance_b_conn gauge
weirproxy_balance_b_conn{backend="192.168.0.101:60582"} 1
# HELP weirproxy_balance_b_status Gauge of backend status.
# TYPE weirproxy_balance_b_status gauge
weirproxy_balance_b_status{backend="192.168.0.101:60582",status="down"} 0
weirproxy_balance_b_status{backend="192.168.0.101:60582",status="healthy"} 1
# HELP weirproxy_monitor_keep_alive_total Counter of proxy keep alive.
# TYPE weirproxy_monitor_keep_alive_total counter
weirproxy_monitor_keep_alive_total 2
# HELP weirproxy_monitor_time_jump_back_total Counter of system time jumps backward.
# TYPE weirproxy_monitor_time_jump_back_total counter
weirproxy_monitor_time_jump_back_total 0
# HELP weirproxy_server_connections Number of connections.
# TYPE weirproxy_server_connections gauge
weirproxy_server_connections 1
# HELP weirproxy_session_query_duration_seconds Bucketed histogram of processing time (s) of handled queries.
# TYPE weirproxy_session_query_duration_seconds histogram
weirproxy_session_query_duration_seconds_bucket{backend="192.168.0.101:60582",cmd_type="Query",le="0.0005"} 0
weirproxy_session_query_duration_seconds_bucket{backend="192.168.0.101:60582",cmd_type="Query",le="0.001"} 1
weirproxy_session_query_duration_seconds_bucket{backend="192.168.0.101:60582",cmd_type="Query",le="0.002"} 1
weirproxy_session_query_duration_seconds_bucket{backend="192.168.0.101:60582",cmd_type="Query",le="0.004"} 1

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/proxy/backend/metrics.go Show resolved Hide resolved
lib/util/systimemon/systime_mon.go Outdated Show resolved Hide resolved
pkg/metrics/metrics_test.go Outdated Show resolved Hide resolved
lib/util/systimemon/systime_mon.go Outdated Show resolved Hide resolved
@djshow832 djshow832 merged commit 349d1d6 into pingcap:main Sep 13, 2022
@djshow832 djshow832 deleted the prom branch September 13, 2022 03:32
@xhebox xhebox mentioned this pull request Sep 24, 2022
9 tasks
xhebox pushed a commit to xhebox/TiProxy that referenced this pull request Mar 7, 2023
xhebox pushed a commit to xhebox/TiProxy that referenced this pull request Mar 13, 2023
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

2 participants