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

[WIP] Add metrics for database operations #52

Closed
wants to merge 17 commits into from

Conversation

neoaggelos
Copy link
Contributor

Summary

Review after #49

Add metrics for individual transactions (k8s_dqlite_generic_tx_result) and operations (k8s_dqlite_generic_op_result) by transaction name and result (success or fail).

Example metrics from a cluster:

root@t1:~# curl localhost:9042/metrics --silent | grep k8s_dqlite
# HELP k8s_dqlite_generic_op_result Total number of database operations by tx_name and result
# TYPE k8s_dqlite_generic_op_result counter
k8s_dqlite_generic_op_result{result="fail",tx_name="insert_last_insert_id_sql"} 1
k8s_dqlite_generic_op_result{result="success",tx_name="after_sql"} 1105
k8s_dqlite_generic_op_result{result="success",tx_name="after_sql_prefix"} 71
k8s_dqlite_generic_op_result{result="success",tx_name="count_sql"} 113
k8s_dqlite_generic_op_result{result="success",tx_name="get_current_sql"} 1697
k8s_dqlite_generic_op_result{result="success",tx_name="get_revision_after_sql"} 1
k8s_dqlite_generic_op_result{result="success",tx_name="get_size_sql"} 4
k8s_dqlite_generic_op_result{result="success",tx_name="insert_last_insert_id_sql"} 994
k8s_dqlite_generic_op_result{result="success",tx_name="list_revision_start_sql"} 230
k8s_dqlite_generic_op_result{result="success",tx_name="rev_sql"} 232
# HELP k8s_dqlite_generic_tx_result Total number of individual database transactions by tx_name and result
# TYPE k8s_dqlite_generic_tx_result counter
k8s_dqlite_generic_tx_result{result="fail",tx_name="insert_last_insert_id_sql"} 1
k8s_dqlite_generic_tx_result{result="success",tx_name="after_sql"} 1105
k8s_dqlite_generic_tx_result{result="success",tx_name="after_sql_prefix"} 71
k8s_dqlite_generic_tx_result{result="success",tx_name="count_sql"} 113
k8s_dqlite_generic_tx_result{result="success",tx_name="get_current_sql"} 1697
k8s_dqlite_generic_tx_result{result="success",tx_name="get_revision_after_sql"} 1
k8s_dqlite_generic_tx_result{result="success",tx_name="get_size_sql"} 4
k8s_dqlite_generic_tx_result{result="success",tx_name="insert_last_insert_id_sql"} 994
k8s_dqlite_generic_tx_result{result="success",tx_name="list_revision_start_sql"} 230
k8s_dqlite_generic_tx_result{result="success",tx_name="rev_sql"} 232

- kine: https://github.com/canonical/kine@a8897e06632c8c2b4f54e8e6f9de156ebbde2eb3 (v0.4.1-k8s-dqlite.9+1)
- k8s-dqlite: https://github.com/canonical/k8s-dqlite@f6fefc12bbf8d497bf6f0a3d549596c7b4204ea5 (v1.1.6)

Organize code structure like this:

- `github.com/rancher/kine` -> `github.com/canonical/k8s-dqlite/pkg/kine`
- `github.com/canonical/k8s-dqlite/{server,app}` -> `github.com/canonical/k8s-dqlite/pkg/{server,app}`

Misc changes:

- Update `Makefile` to run against k8s-dqlite
- Add GitHub actions workflows to run kine tests
- metrics are a counter by tx_name and result
- remove unused execute() function
- remove unused queryInt64() function
- remove unused Migrate() function
@neoaggelos neoaggelos changed the title Add metrics for kine operations [WIP] Add metrics for kine operations Aug 18, 2023
@neoaggelos neoaggelos changed the title [WIP] Add metrics for kine operations [WIP] Add metrics for database operations Aug 30, 2023
@neoaggelos neoaggelos closed this Aug 30, 2023
@ktsakalozos ktsakalozos deleted the MK-1303/metrics branch February 23, 2024 06:34
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.

1 participant